From 9fe113b976de5c430978de3ef45d8d721810c665 Mon Sep 17 00:00:00 2001 From: Blue_Dude Date: Sun, 9 May 2010 19:58:20 +0000 Subject: [PATCH] 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 --- apps/metadata/wave.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/metadata/wave.c b/apps/metadata/wave.c index e34c740aa..42203e952 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); -- 2.11.4.GIT