comparison tools/lib64fmts.c @ 1662:34d7c708649e

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 30 May 2018 17:22:01 +0300
parents dc3fbd130db7
children 8ae32df3c184
comparison
equal deleted inserted replaced
1661:dc3fbd130db7 1662:34d7c708649e
89 } 89 }
90 90
91 91
92 static int fmtProbeDrazPaint20Packed(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) 92 static int fmtProbeDrazPaint20Packed(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
93 { 93 {
94 const char *ident = (const char *) buf + 2; 94 const Uint8 *ident = buf + 2;
95
96 if (len > 22 && 95 if (len > 22 &&
97 dmCompareAddr16(buf, 0, fmt->addr) && 96 dmCompareAddr16(buf, 0, fmt->addr) &&
98 strncmp(ident, "DRAZPAINT ", 10) == 0 && 97 memcmp(ident, "DRAZPAINT ", 10) == 0 &&
99 ident[11] == '.' && ( 98 ident[11] == '.' && (
100 (ident[10] == '1' && ident[12] == '4') || 99 (ident[10] == '1' && ident[12] == '4') ||
101 (ident[10] == '2' && ident[12] == '0') 100 (ident[10] == '2' && ident[12] == '0')
102 )) 101 ))
103 return DM_PROBE_SCORE_MAX; 102 return DM_PROBE_SCORE_MAX;
165 164
166 static int fmtProbeDrazLace10Packed(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) 165 static int fmtProbeDrazLace10Packed(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
167 { 166 {
168 if (len > 22 && 167 if (len > 22 &&
169 dmCompareAddr16(buf, 0, fmt->addr) && 168 dmCompareAddr16(buf, 0, fmt->addr) &&
170 strncmp((const char *) (buf + 2), "DRAZLACE! 1.0", 13) == 0) 169 memcmp(buf + 2, "DRAZLACE! 1.0", 13) == 0)
171 return DM_PROBE_SCORE_MAX; 170 return DM_PROBE_SCORE_MAX;
172 171
173 return DM_PROBE_SCORE_FALSE; 172 return DM_PROBE_SCORE_FALSE;
174 } 173 }
175 174
191 buf->data[op->offs] = (img->laceType == D64_ILACE_RES) ? 1 : 0; 190 buf->data[op->offs] = (img->laceType == D64_ILACE_RES) ? 1 : 0;
192 return TRUE; 191 return TRUE;
193 } 192 }
194 193
195 194
195 static const char *fmtBDP5MagicID = "BDP 5.00";
196
196 static int fmtProbeBDP5Packed(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) 197 static int fmtProbeBDP5Packed(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
197 { 198 {
198 const char *ident = (const char *) buf + 2;
199
200 if (len > 20 && 199 if (len > 20 &&
201 dmCompareAddr16(buf, 0, fmt->addr) && 200 dmCompareAddr16(buf, 0, fmt->addr) &&
202 strncmp(ident, "BDP 5.00", 8) == 0) 201 memcmp(buf + 2, fmtBDP5MagicID, strlen(fmtBDP5MagicID)) == 0)
203 return DM_PROBE_SCORE_MAX; 202 return DM_PROBE_SCORE_MAX;
204 203
205 return DM_PROBE_SCORE_FALSE; 204 return DM_PROBE_SCORE_FALSE;
206 } 205 }
207 206
230 229
231 static int fmtProbeGunPaint(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) 230 static int fmtProbeGunPaint(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
232 { 231 {
233 if (len > 0x400 && 232 if (len > 0x400 &&
234 dmCompareAddr16(buf, 0, fmt->addr) && 233 dmCompareAddr16(buf, 0, fmt->addr) &&
235 strncmp((const char *) (buf + 0x3ea), "GUNPAINT (JZ) ", 14) == 0) 234 memcmp(buf + 0x3ea, "GUNPAINT (JZ) ", 14) == 0)
236 return DM_PROBE_SCORE_MAX; 235 return DM_PROBE_SCORE_MAX;
237 236
238 return DM_PROBE_SCORE_FALSE; 237 return DM_PROBE_SCORE_FALSE;
239 } 238 }
240 239
529 528
530 static int fmtProbeFunPaint2(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) 529 static int fmtProbeFunPaint2(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
531 { 530 {
532 if (len > 30 && 531 if (len > 30 &&
533 dmCompareAddr16(buf, 0, fmt->addr) && 532 dmCompareAddr16(buf, 0, fmt->addr) &&
534 strncmp((const char *) (buf + 2), fmtFunPaint2MagicID, strlen(fmtFunPaint2MagicID)) == 0) 533 memcmp(buf + 2, fmtFunPaint2MagicID, strlen(fmtFunPaint2MagicID)) == 0)
535 return DM_PROBE_SCORE_MAX; 534 return DM_PROBE_SCORE_MAX;
536 else 535 else
537 return DM_PROBE_SCORE_FALSE; 536 return DM_PROBE_SCORE_FALSE;
538 } 537 }
539 538