|
Rockbox mail archiveSubject: bug fix for id3.cbug fix for id3.c
From: Ray Lambert <listlizard_at_interthingy.net>
Date: Tue, 14 Jun 2005 22:49:55 +0000 Hi, I just found and fixed a bug in firmware/id3.c regarding the parsing of ID3v2 tags. The bug was an off-by-one error when applying a zero-delimiter to the parsed value and caused some fields to have an extra garbage character on the end. I first noticed the problem after re-configuring grip to output both ID3v1 and v2 tags (I had previously only used v1 tags). Afterwards, the new files that I ripped had an extra garbage digit on the track number. All single digit track numbers had an extra '2' character tacked on and all two digit track numbers had an extra ')' tacked on. I suspect that these characters were left over in the buffer from the last WPS screen update: the last item that was formatted (using the default WPS format on an FMR) was the ID3 type indicator: "(id3v2)" (note the '2' and the ')'). Anywho, I've pasted a patch below that fixes this, in case anyone wants to merge it into the tree. As you can see, "+1" on the line "tag[bytesread + 1] = 0;" was incorrect (since this is a zero-based offset, tag[bytesread] already points to the location that needs the delimiter), and the line that follows unnecessarily counted the extraneous character. ~ray diff -Nauw rockbox-daily-20050614/firmware/id3.c rockbox-daily-20050614-id3fix/firmware/id3.c --- rockbox-daily-20050614/firmware/id3.c 2005-02-10 05:00:06.000000000 +0000 +++ rockbox-daily-20050614-id3fix/firmware/id3.c 2005-06-14 22:09:38.470693608 +0000 _at__at_ -673,8 +673,8 _at__at_ unicode_munge( ptag, &bytesread ); tag = *ptag; - tag[bytesread + 1] = 0; - bufferpos += bytesread + 2; + tag[bytesread++] = 0; + bufferpos += bytesread; if( tr->ppFunc ) bufferpos = tr->ppFunc(entry, tag, bufferpos); break; -- #b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b "The music business is a cruel and shallow money trench, a long plastic hallway where thieves and pimps run free, and good men die like dogs ....... There's also a negative side." -- Hunter S. Thompson #b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b _______________________________________________ http://cool.haxx.se/mailman/listinfo/rockboxReceived on 2005-06-15 Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy |