changeset 223:a76276ff7ba8

Rename PSID_* constant defines to SIDLIB_PSID_*.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 27 Dec 2019 12:15:51 +0200
parents 3a01518fffe0
children 4bec78f45188
files sidlib.c sidlib.h
diffstat 2 files changed, 15 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/sidlib.c	Fri Dec 27 11:12:42 2019 +0200
+++ b/sidlib.c	Fri Dec 27 12:15:51 2019 +0200
@@ -54,18 +54,18 @@
     BOOL ret = FALSE, first = TRUE;
     size_t read;
 
-    if ((data = (uint8_t *) th_malloc(PSID_BUFFER_SIZE)) == NULL)
+    if ((data = (uint8_t *) th_malloc(SIDLIB_PSID_BUFFER_SIZE)) == NULL)
     {
         th_io_error(ctx, THERR_MALLOC,
             "Error allocating temporary data buffer of %d bytes.\n",
-            PSID_BUFFER_SIZE);
+            SIDLIB_PSID_BUFFER_SIZE);
         goto error;
     }
 
     psid->dataSize = 0;
     do
     {
-        read = thfread(data, sizeof(uint8_t), PSID_BUFFER_SIZE, ctx);
+        read = thfread(data, sizeof(uint8_t), SIDLIB_PSID_BUFFER_SIZE, ctx);
         psid->dataSize += read;
 
         // If load address is 0 in header and we have the first block, grab it
@@ -122,7 +122,7 @@
     hdrStart = thftell(ctx);
 
     // Read PSID header in
-    if (!thfread_str(ctx, (uint8_t *) psid->magic, PSID_MAGIC_LEN) ||
+    if (!thfread_str(ctx, (uint8_t *) psid->magic, SIDLIB_PSID_MAGIC_LEN) ||
         !thfread_be16(ctx, &psid->version) ||
         !thfread_be16(ctx, &psid->dataOffset) ||
         !thfread_be16(ctx, &psid->loadAddress) ||
@@ -138,7 +138,7 @@
         goto error;
     }
 
-    psid->magic[PSID_MAGIC_LEN] = 0;
+    psid->magic[SIDLIB_PSID_MAGIC_LEN] = 0;
 
     if ((psid->magic[0] != 'R' && psid->magic[0] != 'P') ||
         psid->magic[1] != 'S' || psid->magic[2] != 'I' || psid->magic[3] != 'D' ||
@@ -152,9 +152,9 @@
 
     psid->isRSID = psid->magic[0] == 'R';
 
-    if (!sidlib_fread_str(ctx, &psid->sidName, PSID_STR_LEN) ||
-        !sidlib_fread_str(ctx, &psid->sidAuthor, PSID_STR_LEN) ||
-        !sidlib_fread_str(ctx, &psid->sidCopyright, PSID_STR_LEN))
+    if (!sidlib_fread_str(ctx, &psid->sidName, SIDLIB_PSID_STR_LEN) ||
+        !sidlib_fread_str(ctx, &psid->sidAuthor, SIDLIB_PSID_STR_LEN) ||
+        !sidlib_fread_str(ctx, &psid->sidCopyright, SIDLIB_PSID_STR_LEN))
     {
         th_io_error(ctx, ctx->status,
             "Error reading SID file header from '%s': %s.\n",
@@ -452,15 +452,15 @@
 {
     char *line = NULL;
 
-    if ((line = th_malloc(PSID_BUFFER_SIZE)) == NULL)
+    if ((line = th_malloc(SIDLIB_PSID_BUFFER_SIZE)) == NULL)
     {
         th_io_error(ctx, THERR_MALLOC,
             "Error allocating temporary data buffer of %d bytes.\n",
-            PSID_BUFFER_SIZE);
+            SIDLIB_PSID_BUFFER_SIZE);
         return ctx->status;
     }
 
-    while (thfgets(line, PSID_BUFFER_SIZE, ctx) != NULL)
+    while (thfgets(line, SIDLIB_PSID_BUFFER_SIZE, ctx) != NULL)
     {
         SIDLibSLDBNode *tmnode;
         size_t pos = 0;
--- a/sidlib.h	Fri Dec 27 11:12:42 2019 +0200
+++ b/sidlib.h	Fri Dec 27 12:15:51 2019 +0200
@@ -19,9 +19,9 @@
 //
 // Some constants
 //
-#define PSID_MAGIC_LEN    4
-#define PSID_STR_LEN      32
-#define PSID_BUFFER_SIZE  (1024 * 16)
+#define SIDLIB_PSID_MAGIC_LEN    4
+#define SIDLIB_PSID_STR_LEN      32
+#define SIDLIB_PSID_BUFFER_SIZE  (1024 * 16)
 
 
 enum
@@ -68,7 +68,7 @@
 
 typedef struct
 {
-    char magic[PSID_MAGIC_LEN + 1]; // "PSID" / "RSID" magic identifier
+    char magic[SIDLIB_PSID_MAGIC_LEN + 1]; // "PSID" / "RSID" magic identifier
     uint16_t
         version,         // Version number
         dataOffset,      // Start of actual c64 data in file