|
Rockbox mail archiveSubject: Re: bagder: tools songdb.pl,1.40,1.41Re: bagder: tools songdb.pl,1.40,1.41
From: Tomas <tomas_at_salfischberger.nl>
Date: Fri, 09 Sep 2005 14:20:56 +0200 Why not use negative error codes? Like -1 = no CRC, -2 = error? Then we can just use 0 as a valid CRC.. Tomas cvs_at_labb.contactor.se wrote: >Update of /cvsroot/rockbox/tools >In directory labb:/tmp/cvs-serv32512 > >Modified Files: > songdb.pl >Log Message: >Removed the risk of getting a zero CRC for a valid file. > > >Index: songdb.pl >=================================================================== >RCS file: /cvsroot/rockbox/tools/songdb.pl,v >retrieving revision 1.40 >retrieving revision 1.41 >diff -u -d -r1.40 -r1.41 >--- songdb.pl 3 Sep 2005 11:43:15 -0000 1.40 >+++ songdb.pl 9 Sep 2005 07:35:09 -0000 1.41 >_at__at_ -192,12 +192,12 _at__at_ > > if(!$crc) { > return 0; # fixed bad CRC when disabled! >- # better to set to 0 cause the rundb code will handle it better that way. >+ # The runtimedb treats a CRC zero as CRC disabled! > } > > if(!open(FILE, "<$filename")) { > print "failed to open \"$filename\" $!\n"; >- return -2; >+ return 0; > } > > # read $data from index $index to $buffer from the file, may return fewer >_at__at_ -266,8 +266,14 _at__at_ > # printf("%08x\n", $crc); > } > >- return $crc; >+ if($crc == 0) { >+ # rule out the very small risk that this actually returns a zero, as >+ # the current rockbox code assumes a zero CRC means it is disabled! >+ # TODO: fix the Rockbox code. This is just a hack. >+ return 1; >+ } > >+ return $crc; > } > > sub singlefile { > >_______________________________________________ >http://cool.haxx.se/mailman/listinfo/rockbox-cvs > > _______________________________________________ http://cool.haxx.se/mailman/listinfo/rockbox Received on 2005-09-09 Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy |