changeset 352:4978ff445572

Add lowercase versions of the STIL field names array as sidlib_stil_fields_lc[]. Rename the uppercase array as sidlib_stil_fields_uc[].
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 21 Jan 2020 04:41:49 +0200
parents d54112385845
children bf954444cce7
files sidinfo.c sidlib.c sidlib.h
diffstat 3 files changed, 32 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/sidinfo.c	Mon Jan 20 17:13:32 2020 +0200
+++ b/sidinfo.c	Tue Jan 21 04:41:49 2020 +0200
@@ -945,12 +945,12 @@
                             if (nsubtune > 0)
                             {
                                 snprintf(tmp, sizeof(tmp), "STIL#%d/%s",
-                                    subtune->tune, sidlib_stil_fields[nfield]);
+                                    subtune->tune, sidlib_stil_fields_uc[nfield]);
                             }
                             else
                             {
                                 snprintf(tmp, sizeof(tmp), "STIL/%s",
-                                    sidlib_stil_fields[nfield]);
+                                    sidlib_stil_fields_uc[nfield]);
                             }
 
                             siPrintFieldPrefixName(outfh, tmp, TRUE);
--- a/sidlib.c	Mon Jan 20 17:13:32 2020 +0200
+++ b/sidlib.c	Tue Jan 21 04:41:49 2020 +0200
@@ -8,6 +8,32 @@
 #include "th_string.h"
 
 
+const char *sidlib_stil_fields_uc[STF_LAST] =
+{
+    "NAME",
+    "AUTHOR",
+    "TITLE",
+    "INFO",
+    "ARTIST",
+    "COMMENT",
+
+    // STF_LAST
+};
+
+
+const char *sidlib_stil_fields_lc[STF_LAST] =
+{
+    "name",
+    "author",
+    "title",
+    "info",
+    "artist",
+    "comment",
+
+    // STF_LAST
+};
+
+
 static char *sidlib_strdup_convert(SIDLibChConvCtx *chconv, const char *str)
 {
     if (chconv != NULL)
@@ -752,19 +778,6 @@
 };
 
 
-const char *sidlib_stil_fields[STF_LAST] =
-{
-    "NAME",
-    "AUTHOR",
-    "TITLE",
-    "INFO",
-    "ARTIST",
-    "COMMENT",
-
-    // STF_LAST
-};
-
-
 typedef struct
 {
     size_t lineNum;
@@ -774,11 +787,11 @@
 } SIDLibSTILParserCtx;
 
 
-static int sidlib_stildb_get_field(const char *name)
+static int sidlib_stildb_get_field(const char *field)
 {
     for (int n = 0; n < STF_LAST; n++)
     {
-        if (strcmp(sidlib_stil_fields[n], name) == 0)
+        if (strcmp(field, sidlib_stil_fields_uc[n]) == 0)
             return n;
     }
 
--- a/sidlib.h	Mon Jan 20 17:13:32 2020 +0200
+++ b/sidlib.h	Tue Jan 21 04:41:49 2020 +0200
@@ -161,7 +161,8 @@
 //
 // Globals
 //
-const char *     sidlib_stil_fields[STF_LAST];
+const char *     sidlib_stil_fields_uc[STF_LAST];
+const char *     sidlib_stil_fields_lc[STF_LAST];
 
 
 //