changeset 71:1e6ad4be7f15

Rename a function argument.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 01 Jan 2016 03:39:29 +0200
parents 4779bbec2f28
children d5a34a3a602d
files sidlib.c
diffstat 1 files changed, 19 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- 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);