changeset 2147:735b55414a1e

Fix format reporting.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 02 Jun 2019 23:03:55 +0300
parents 26f21e487fe2
children 487157934904
files tools/lib64gfx.c
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64gfx.c	Sun Jun 02 21:26:48 2019 +0300
+++ b/tools/lib64gfx.c	Sun Jun 02 23:03:55 2019 +0300
@@ -36,16 +36,19 @@
 
 char * dmC64GetImageTypeString(char *buf, const size_t len, const int type, const BOOL lng)
 {
-    static const char *fmtModesShort[] = { "ERROR", "HiR", "MC", "ECM" };
-    static const char *fmtModesLong[] = { "ERROR", "HiRes", "MultiColor", "Extended Color Mode" };
+    static const char *fmtModesShort[] = { "*", "HiR", "MC", "ECM" };
+    static const char *fmtModesLong[] = { "*", "HiRes", "MultiColor", "Extended Color Mode" };
+    const char *fmtStr;
     size_t nfmt = type & D64_FMT_MASK;
 
-    if (nfmt >= sizeof(fmtModesShort) / sizeof(fmtModesShort[0]))
-        nfmt = 0;
+    if (nfmt < sizeof(fmtModesShort) / sizeof(fmtModesShort[0]))
+        fmtStr = lng ? fmtModesLong[nfmt] : fmtModesShort[nfmt];
+    else
+        fmtStr = lng ? "ERROR" : "ERR";
 
     snprintf(buf, len,
         "%s %s%s%s",
-        lng ? fmtModesLong[nfmt] : fmtModesShort[nfmt],
+        fmtStr,
         (type & D64_FMT_ILACE) ? (lng ? "Interlaced " : "ILace ") : "",
         (type & D64_FMT_FLI)   ? "FLI " : "",
         (type & D64_FMT_CHAR)  ? "CHAR" : ""