# HG changeset patch # User Matti Hamalainen # Date 1451612369 -7200 # Node ID 1e6ad4be7f152290e23df52072a9bf11d9eeaf9c # Parent 4779bbec2f2847005bf8af7106ffa6c4279d90ac Rename a function argument. diff -r 4779bbec2f28 -r 1e6ad4be7f15 sidlib.c --- a/sidlib.c Fri Jan 01 03:32:42 2016 +0200 +++ b/sidlib.c Fri Jan 01 03:39:29 2016 +0200 @@ -16,7 +16,7 @@ } -int siReadPSIDFile(FILE *inFile, PSIDHeader *psid) +int siReadPSIDFile(FILE *fh, PSIDHeader *psid) { th_md5state_t state; uint8_t tmp8, *fileData = NULL; @@ -33,15 +33,15 @@ } // Read PSID header in - if (!th_fread_str(inFile, (uint8_t *) psid->magic, PSID_MAGIC_LEN) || - !th_fread_be16(inFile, &psid->version) || - !th_fread_be16(inFile, &psid->dataOffset) || - !th_fread_be16(inFile, &psid->loadAddress) || - !th_fread_be16(inFile, &psid->initAddress) || - !th_fread_be16(inFile, &psid->playAddress) || - !th_fread_be16(inFile, &psid->nSongs) || - !th_fread_be16(inFile, &psid->startSong) || - !th_fread_be32(inFile, &psid->speed)) + if (!th_fread_str(fh, (uint8_t *) psid->magic, PSID_MAGIC_LEN) || + !th_fread_be16(fh, &psid->version) || + !th_fread_be16(fh, &psid->dataOffset) || + !th_fread_be16(fh, &psid->loadAddress) || + !th_fread_be16(fh, &psid->initAddress) || + !th_fread_be16(fh, &psid->playAddress) || + !th_fread_be16(fh, &psid->nSongs) || + !th_fread_be16(fh, &psid->startSong) || + !th_fread_be32(fh, &psid->speed)) { THERR("Could not read PSID/RSID header.\n"); goto error; @@ -59,9 +59,9 @@ psid->isRSID = psid->magic[0] == 'R'; - if (!th_fread_str(inFile, (uint8_t *)psid->sidName, PSID_STR_LEN) || - !th_fread_str(inFile, (uint8_t *)psid->sidAuthor, PSID_STR_LEN) || - !th_fread_str(inFile, (uint8_t *)psid->sidCopyright, PSID_STR_LEN)) + if (!th_fread_str(fh, (uint8_t *)psid->sidName, PSID_STR_LEN) || + !th_fread_str(fh, (uint8_t *)psid->sidAuthor, PSID_STR_LEN) || + !th_fread_str(fh, (uint8_t *)psid->sidCopyright, PSID_STR_LEN)) { THERR("Error reading SID file header.\n"); goto error; @@ -75,10 +75,10 @@ if (psid->version >= 2) { // Yes, we need to - if (!th_fread_be16(inFile, &psid->flags) || - !th_fread_byte(inFile, &psid->startPage) || - !th_fread_byte(inFile, &psid->pageLength) || - !th_fread_be16(inFile, &psid->reserved)) + if (!th_fread_be16(fh, &psid->flags) || + !th_fread_byte(fh, &psid->startPage) || + !th_fread_byte(fh, &psid->pageLength) || + !th_fread_be16(fh, &psid->reserved)) { THERR("Error reading PSID/RSID v2+ extra header data.\n"); goto error; @@ -93,7 +93,7 @@ first = TRUE; do { - read = fread(fileData, sizeof(uint8_t), PSID_BUFFER_SIZE, inFile); + read = fread(fileData, sizeof(uint8_t), PSID_BUFFER_SIZE, fh); psid->dataSize += read; if (first && psid->loadAddress == 0) @@ -117,7 +117,7 @@ // Append "as is" th_md5_append(&state, fileData, read); } - } while (read > 0 && !feof(inFile)); + } while (read > 0 && !feof(fh)); // Append header data to hash siAppendHash16(&state, psid->initAddress);