changeset 1662:34d7c708649e

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 30 May 2018 17:22:01 +0300
parents dc3fbd130db7
children 8ae32df3c184
files tools/lib64fmts.c
diffstat 1 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64fmts.c	Wed May 30 17:10:24 2018 +0300
+++ b/tools/lib64fmts.c	Wed May 30 17:22:01 2018 +0300
@@ -91,11 +91,10 @@
 
 static int fmtProbeDrazPaint20Packed(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
 {
-    const char *ident = (const char *) buf + 2;
-
+    const Uint8 *ident = buf + 2;
     if (len > 22 &&
         dmCompareAddr16(buf, 0, fmt->addr) &&
-        strncmp(ident, "DRAZPAINT ", 10) == 0 &&
+        memcmp(ident, "DRAZPAINT ", 10) == 0 &&
         ident[11] == '.' && (
         (ident[10] == '1' && ident[12] == '4') ||
         (ident[10] == '2' && ident[12] == '0')
@@ -167,7 +166,7 @@
 {
     if (len > 22 &&
         dmCompareAddr16(buf, 0, fmt->addr) &&
-        strncmp((const char *) (buf + 2), "DRAZLACE! 1.0", 13) == 0)
+        memcmp(buf + 2, "DRAZLACE! 1.0", 13) == 0)
         return DM_PROBE_SCORE_MAX;
 
     return DM_PROBE_SCORE_FALSE;
@@ -193,13 +192,13 @@
 }
 
 
+static const char *fmtBDP5MagicID = "BDP 5.00";
+
 static int fmtProbeBDP5Packed(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
 {
-    const char *ident = (const char *) buf + 2;
-
     if (len > 20 &&
         dmCompareAddr16(buf, 0, fmt->addr) &&
-        strncmp(ident, "BDP 5.00", 8) == 0)
+        memcmp(buf + 2, fmtBDP5MagicID, strlen(fmtBDP5MagicID)) == 0)
         return DM_PROBE_SCORE_MAX;
 
     return DM_PROBE_SCORE_FALSE;
@@ -232,7 +231,7 @@
 {
     if (len > 0x400 &&
         dmCompareAddr16(buf, 0, fmt->addr) &&
-        strncmp((const char *) (buf + 0x3ea), "GUNPAINT (JZ) ", 14) == 0)
+        memcmp(buf + 0x3ea, "GUNPAINT (JZ) ", 14) == 0)
         return DM_PROBE_SCORE_MAX;
 
     return DM_PROBE_SCORE_FALSE;
@@ -531,7 +530,7 @@
 {
     if (len > 30 &&
         dmCompareAddr16(buf, 0, fmt->addr) &&
-        strncmp((const char *) (buf + 2), fmtFunPaint2MagicID, strlen(fmtFunPaint2MagicID)) == 0)
+        memcmp(buf + 2, fmtFunPaint2MagicID, strlen(fmtFunPaint2MagicID)) == 0)
         return DM_PROBE_SCORE_MAX;
     else
         return DM_PROBE_SCORE_FALSE;