diff options
author | Daniel Stenberg <daniel@haxx.se> | 2005-09-09 07:35:09 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2005-09-09 07:35:09 +0000 |
commit | acabd28efc37d6af3e695129d4d1719a7a3f6eb6 (patch) | |
tree | 54769eed04458c7bae33c357174a5b98ce822459 /tools/songdb.pl | |
parent | 4a939ecdcd1e32bd3d77e485d137f58ba35329d8 (diff) | |
download | rockbox-acabd28efc37d6af3e695129d4d1719a7a3f6eb6.tar.gz rockbox-acabd28efc37d6af3e695129d4d1719a7a3f6eb6.tar.bz2 rockbox-acabd28efc37d6af3e695129d4d1719a7a3f6eb6.zip |
Removed the risk of getting a zero CRC for a valid file.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7503 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/songdb.pl')
-rwxr-xr-x | tools/songdb.pl | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/songdb.pl b/tools/songdb.pl index 659457d554..dad7e10496 100755 --- a/tools/songdb.pl +++ b/tools/songdb.pl @@ -192,12 +192,12 @@ sub crc32 { 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 @@ -266,8 +266,14 @@ sub crc32 { # 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 { |