# HG changeset patch # User Matti Hamalainen # Date 1527690121 -10800 # Node ID 34d7c708649e7a28feea16f36aa4e8132dbe49dc # Parent dc3fbd130db7907c5548e64f6f100ec57a7384ee Cleanups. diff -r dc3fbd130db7 -r 34d7c708649e tools/lib64fmts.c --- 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;