comparison src/xs_length.c @ 972:74ca6fb979fd dev-0_8_99_1

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 21 Nov 2012 00:16:25 +0200
parents 3edc4c508f99
children 56368ab7d282
comparison
equal deleted inserted replaced
971:3edc4c508f99 972:74ca6fb979fd
396 { 396 {
397 xs_error("Could not read PSID/RSID header from '%s'\n", filename); 397 xs_error("Could not read PSID/RSID header from '%s'\n", filename);
398 goto error; 398 goto error;
399 } 399 }
400 400
401 if ((strncmp(psidH.magicID, "PSID", 4) && 401 if ((psidH.magic[0] != 'R' && psidH.magic[0] != 'P') ||
402 strncmp(psidH.magicID, "RSID", 4)) || 402 psidH.magic[1] != 'S' || psidH.magic[2] != 'I' || psidH.magic[3] != 'D' ||
403 psidH.version < 1 || psidH.version > 3) 403 psidH.version < 1 || psidH.version > 3)
404 { 404 {
405 xs_error("Not a supported PSID or RSID file '%s'\n", filename); 405 xs_error("Not a supported PSID or RSID file '%s'\n", filename);
406 goto error; 406 goto error;
407 } 407 }
417 } 417 }
418 418
419 /* Check if we need to load PSIDv2NG header ... */ 419 /* Check if we need to load PSIDv2NG header ... */
420 psidH2.flags = 0; /* Just silence a stupid gcc warning */ 420 psidH2.flags = 0; /* Just silence a stupid gcc warning */
421 421
422 if (psidH.version == 2 || psidH.version == 3) 422 if (psidH.version >= 2)
423 { 423 {
424 /* Yes, we need to */ 424 /* Yes, we need to */
425 if (!xs_fread_be16(inFile, &psidH2.flags) || 425 if (!xs_fread_be16(inFile, &psidH2.flags) ||
426 !xs_fread_byte(inFile, &psidH2.startPage) || 426 !xs_fread_byte(inFile, &psidH2.startPage) ||
427 !xs_fread_byte(inFile, &psidH2.pageLength) || 427 !xs_fread_byte(inFile, &psidH2.pageLength) ||
488 /* Rest of songs (more than 32) */ 488 /* Rest of songs (more than 32) */
489 for (index = 32; index < psidH.nSongs; index++) 489 for (index = 32; index < psidH.nSongs; index++)
490 xs_md5_append(&inState, &i8, sizeof(i8)); 490 xs_md5_append(&inState, &i8, sizeof(i8));
491 491
492 /* PSIDv2NG specific */ 492 /* PSIDv2NG specific */
493 if (psidH.version == 2 || psidH.version == 3) 493 if (psidH.version >= 2)
494 { 494 {
495 /* SEE SIDPLAY HEADERS FOR INFO */ 495 /* SEE SIDPLAY HEADERS FOR INFO */
496 i8 = (psidH2.flags >> 2) & 3; 496 i8 = (psidH2.flags >> 2) & 3;
497 if (i8 == 2) 497 if (i8 == 2)
498 xs_md5_append(&inState, &i8, sizeof(i8)); 498 xs_md5_append(&inState, &i8, sizeof(i8));