Mercurial > hg > xmms-sid
comparison src/xs_length.c @ 469:d600f45c92d2
Silence a gcc warning; Use xs_*() file handling functions.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 25 Jan 2007 03:50:00 +0000 |
parents | 57836945fa71 |
children | 3f02945a0c48 |
comparison
equal
deleted
inserted
replaced
468:6963982fcbb6 | 469:d600f45c92d2 |
---|---|
446 /* Try to open the file */ | 446 /* Try to open the file */ |
447 if ((inFile = xs_fopen(pcFilename, "rb")) == NULL) | 447 if ((inFile = xs_fopen(pcFilename, "rb")) == NULL) |
448 return -1; | 448 return -1; |
449 | 449 |
450 /* Read PSID header in */ | 450 /* Read PSID header in */ |
451 xs_fgets(psidH.magicID, sizeof(psidH.magicID), inFile); | 451 xs_fread(psidH.magicID, sizeof(psidH.magicID), 1, inFile); |
452 if ((psidH.magicID[0] != 'P' && psidH.magicID[0] != 'R') || | 452 if (strncmp(psidH.magicID, "PSID", 4) && strncmp(psidH.magicID, "RSID", 4)) { |
453 (psidH.magicID[1] != 'S') || (psidH.magicID[2] != 'I') || (psidH.magicID[3] != 'D')) { | |
454 xs_fclose(inFile); | 453 xs_fclose(inFile); |
455 xs_error(_("Not a PSID or RSID file '%s'\n"), pcFilename); | 454 xs_error(_("Not a PSID or RSID file '%s'\n"), pcFilename); |
456 return -2; | 455 return -2; |
457 } | 456 } |
458 | 457 |
463 psidH.playAddress = xs_fread_be16(inFile); | 462 psidH.playAddress = xs_fread_be16(inFile); |
464 psidH.nSongs = xs_fread_be16(inFile); | 463 psidH.nSongs = xs_fread_be16(inFile); |
465 psidH.startSong = xs_fread_be16(inFile); | 464 psidH.startSong = xs_fread_be16(inFile); |
466 psidH.speed = xs_fread_be32(inFile); | 465 psidH.speed = xs_fread_be32(inFile); |
467 | 466 |
468 xs_fgets(psidH.sidName, sizeof(psidH.sidName), inFile); | 467 xs_fread(psidH.sidName, sizeof(gchar), sizeof(psidH.sidName), inFile); |
469 xs_fgets(psidH.sidAuthor, sizeof(psidH.sidAuthor), inFile); | 468 xs_fread(psidH.sidAuthor, sizeof(gchar), sizeof(psidH.sidAuthor), inFile); |
470 xs_fgets(psidH.sidCopyright, sizeof(psidH.sidCopyright), inFile); | 469 xs_fread(psidH.sidCopyright, sizeof(gchar), sizeof(psidH.sidCopyright), inFile); |
471 | 470 |
472 if (xs_feof(inFile) || xs_ferror(inFile)) { | 471 if (xs_feof(inFile) || xs_ferror(inFile)) { |
473 xs_fclose(inFile); | 472 xs_fclose(inFile); |
474 xs_error(_("Error reading SID file header from '%s'\n"), pcFilename); | 473 xs_error(_("Error reading SID file header from '%s'\n"), pcFilename); |
475 return -4; | 474 return -4; |
476 } | 475 } |
477 | 476 |
478 /* Check if we need to load PSIDv2NG header ... */ | 477 /* Check if we need to load PSIDv2NG header ... */ |
478 psidH2.flags = 0; /* Just silence a stupid gcc warning */ | |
479 | |
479 if (psidH.version == 2) { | 480 if (psidH.version == 2) { |
480 /* Yes, we need to */ | 481 /* Yes, we need to */ |
481 psidH2.flags = xs_fread_be16(inFile); | 482 psidH2.flags = xs_fread_be16(inFile); |
482 psidH2.startPage = xs_fgetc(inFile); | 483 psidH2.startPage = xs_fgetc(inFile); |
483 psidH2.pageLength = xs_fgetc(inFile); | 484 psidH2.pageLength = xs_fgetc(inFile); |