summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJeffrey Goode <jeffg7@gmail.com>2010-05-09 19:58:20 +0000
committerJeffrey Goode <jeffg7@gmail.com>2010-05-09 19:58:20 +0000
commita26a68d23c6376d75d9f073adee0c46e959fa2a8 (patch)
treed65088e3ba19ba04b353d0f7ed2355f877fe0872 /apps
parent70daf4ed4df7753cec5ce809265652bbaf18710c (diff)
downloadrockbox-a26a68d23c6376d75d9f073adee0c46e959fa2a8.zip
rockbox-a26a68d23c6376d75d9f073adee0c46e959fa2a8.tar.gz
rockbox-a26a68d23c6376d75d9f073adee0c46e959fa2a8.tar.bz2
rockbox-a26a68d23c6376d75d9f073adee0c46e959fa2a8.tar.xz
Fix wav metadata bug, also fix typos and some const police
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25919 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/metadata/wave.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/metadata/wave.c b/apps/metadata/wave.c
index e34c740..42203e9 100644
--- a/apps/metadata/wave.c
+++ b/apps/metadata/wave.c
@@ -251,6 +251,8 @@ static void parse_list_chunk(int fd, struct mp3entry* id3, int chunksize, bool i
lseek(fd, 4, SEEK_CUR);
else if (read(fd, bp, 4) < 4 || memcmp(bp, "INFO", 4))
return;
+ else
+ chunksize -= 4; /* don't include "INFO" tag in chunksize */
infosize = read(fd, bp, (ID3V2_BUF_SIZE > chunksize)? chunksize : ID3V2_BUF_SIZE);
if (infosize <= 8)
@@ -289,9 +291,9 @@ static bool read_header(int fd, struct mp3entry* id3, const unsigned char *chunk
struct wave_fmt fmt;
- unsigned int namelen = (is_64)? WAVE64_CHUNKNAME_LENGTH : WAVE_CHUNKNAME_LENGTH;
- unsigned int sizelen = (is_64)? WAVE64_CHUNKSIZE_LENGTH : WAVE_CHUNKSIZE_LENGTH;
- unsigned int len = namelen + sizelen;
+ const unsigned int namelen = (is_64)? WAVE64_CHUNKNAME_LENGTH : WAVE_CHUNKNAME_LENGTH;
+ const unsigned int sizelen = (is_64)? WAVE64_CHUNKSIZE_LENGTH : WAVE_CHUNKSIZE_LENGTH;
+ const unsigned int len = namelen + sizelen;
uint64_t chunksize;
uint64_t offset = len + namelen;
int read_data;
@@ -403,9 +405,9 @@ static bool read_header(int fd, struct mp3entry* id3, const unsigned char *chunk
DEBUGF(" bitspersample: %u\n", fmt.bitspersample);
DEBUGF(" samplesperblock: %u\n", fmt.samplesperblock);
DEBUGF(" totalsamples: %u\n", (unsigned int)fmt.totalsamples);
- DEBUGF(" numbytes; %u\n", (unsigned int)fmt.numbytes);
+ DEBUGF(" numbytes: %u\n", (unsigned int)fmt.numbytes);
DEBUGF("id3 info ----\n");
- DEBUGF(" frquency: %u\n", (unsigned int)id3->frequency);
+ DEBUGF(" frequency: %u\n", (unsigned int)id3->frequency);
DEBUGF(" bitrate: %d\n", id3->bitrate);
DEBUGF(" length: %u\n", (unsigned int)id3->length);