iAudio: will also work on machines where a byte does not have 8 bits

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7161 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Christian Gmeiner 2005-07-15 21:05:02 +00:00
parent 866e0a7ea7
commit 51700bf75e

View file

@ -59,7 +59,7 @@ int main (int argc, char* argv[]) {
/* print old checksum */
fseek (pFile, CHECKSUM_BIT, SEEK_SET);
byte = fgetc(pFile);
printf("Old checksum: 0x%02x\n", (unsigned char) byte);
printf("Old checksum: 0x%02x\n", byte & 0xff);
/* get file size*/
fseek(pFile,0,SEEK_END);
@ -85,7 +85,7 @@ int main (int argc, char* argv[]) {
for (i = CHECKSUM_START; i < length; i++) {
checksum += inbuf[i];
}
printf("New checksum: 0x%02x\n", (unsigned char) checksum);
printf("New checksum: 0x%02x\n", checksum & 0xff);
/* save new checksum */
inbuf[CHECKSUM_BIT] = (unsigned char) checksum;