diff options
| author | Brandon Low <lostlogic@rockbox.org> | 2007-11-28 16:39:55 +0000 |
|---|---|---|
| committer | Brandon Low <lostlogic@rockbox.org> | 2007-11-28 16:39:55 +0000 |
| commit | 3e7f02e00789949e568b9c3f76cd97eb81ae1272 (patch) | |
| tree | 733351e06186d50a864fc4f64f65622b5f2dbcc2 /apps | |
| parent | df0df311dc2545d8332b088ad281b1dfeaf0f3c8 (diff) | |
| download | rockbox-3e7f02e00789949e568b9c3f76cd97eb81ae1272.zip rockbox-3e7f02e00789949e568b9c3f76cd97eb81ae1272.tar.gz rockbox-3e7f02e00789949e568b9c3f76cd97eb81ae1272.tar.bz2 rockbox-3e7f02e00789949e568b9c3f76cd97eb81ae1272.tar.xz | |
No functional changes, just coding tweaks for speed, codesize and style
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15843 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/metadata.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/apps/metadata.c b/apps/metadata.c index 28f5f04..2f60b11 100644 --- a/apps/metadata.c +++ b/apps/metadata.c @@ -328,7 +328,6 @@ bool get_metadata(struct mp3entry* id3, int fd, const char* trackname) #if CONFIG_CODEC == SWCODEC void strip_tags(int handle_id) { - int i; static const unsigned char tag[] = "TAG"; static const unsigned char apetag[] = "APETAGEX"; size_t len, version; @@ -337,27 +336,24 @@ void strip_tags(int handle_id) if (bufgettail(handle_id, 128, (void **)&tail) != 128) return; - for(i = 0;i < 3;i++) - if(tail[i] != tag[i]) - goto strip_ape_tag; - - /* Skip id3v1 tag */ - logf("Cutting off ID3v1 tag"); - bufcuttail(handle_id, 128); - -strip_ape_tag: - /* Check for APE tag (look for the APE tag footer) */ + if (memcmp(tail, tag, 3) == 0) + { + /* Skip id3v1 tag */ + logf("Cutting off ID3v1 tag"); + bufcuttail(handle_id, 128); + } + /* Get a new tail, as the old one may have been cut */ if (bufgettail(handle_id, 32, (void **)&tail) != 32) return; - for(i = 0;i < 8;i++) - if(tail[i] != apetag[i]) - return; + /* Check for APE tag (look for the APE tag footer) */ + if (memcmp(tail, apetag, 8) != 0) + return; /* Read the version and length from the footer */ - version = tail[8] | (tail[9] << 8) | (tail[10] << 16) | (tail[11] << 24); - len = tail[12] | (tail[13] << 8) | (tail[14] << 16) | (tail[15] << 24); + version = get_long_le(&tail[8]); + len = get_long_le(&tail[12]); if (version == 2000) len += 32; /* APEv2 has a 32 byte header */ |