Mercurial > hg > dmlib
comparison tools/libgfx.c @ 2599:c3c1d3c75f53
s/DM_PROBE_SCORE_false/DM_PROBE_SCORE_FALSE/g
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 19 Nov 2023 18:33:52 +0200 |
parents | 9807ae37ad69 |
children |
comparison
equal
deleted
inserted
replaced
2598:bf43bf9d6556 | 2599:c3c1d3c75f53 |
---|---|
324 { | 324 { |
325 if (len == 0x304 && | 325 if (len == 0x304 && |
326 buf[0x300] == 0) | 326 buf[0x300] == 0) |
327 return DM_PROBE_SCORE_MAX; | 327 return DM_PROBE_SCORE_MAX; |
328 | 328 |
329 return DM_PROBE_SCORE_false; | 329 return DM_PROBE_SCORE_FALSE; |
330 } | 330 } |
331 | 331 |
332 | 332 |
333 int dmReadACTPalette(DMResource *fp, DMPalette **pdst) | 333 int dmReadACTPalette(DMResource *fp, DMPalette **pdst) |
334 { | 334 { |
393 (void) buf; | 393 (void) buf; |
394 | 394 |
395 if (len == 0x300) | 395 if (len == 0x300) |
396 return DM_PROBE_SCORE_MAX; | 396 return DM_PROBE_SCORE_MAX; |
397 | 397 |
398 return DM_PROBE_SCORE_false; | 398 return DM_PROBE_SCORE_FALSE; |
399 } | 399 } |
400 | 400 |
401 | 401 |
402 int dmReadRAWPalette(DMResource *fp, DMPalette **pdst) | 402 int dmReadRAWPalette(DMResource *fp, DMPalette **pdst) |
403 { | 403 { |
1031 if (len > 32 && | 1031 if (len > 32 && |
1032 buf[0] == 'P' && | 1032 buf[0] == 'P' && |
1033 (buf[1] == '5' || buf[1] == '6')) | 1033 (buf[1] == '5' || buf[1] == '6')) |
1034 return DM_PROBE_SCORE_MAX; | 1034 return DM_PROBE_SCORE_MAX; |
1035 | 1035 |
1036 return DM_PROBE_SCORE_false; | 1036 return DM_PROBE_SCORE_FALSE; |
1037 } | 1037 } |
1038 | 1038 |
1039 | 1039 |
1040 #ifdef DM_USE_LIBPNG | 1040 #ifdef DM_USE_LIBPNG |
1041 static int fmtProbePNG(const Uint8 *buf, const size_t len) | 1041 static int fmtProbePNG(const Uint8 *buf, const size_t len) |
1049 return DM_PROBE_SCORE_MAX; | 1049 return DM_PROBE_SCORE_MAX; |
1050 else | 1050 else |
1051 return DM_PROBE_SCORE_GOOD; | 1051 return DM_PROBE_SCORE_GOOD; |
1052 } | 1052 } |
1053 | 1053 |
1054 return DM_PROBE_SCORE_false; | 1054 return DM_PROBE_SCORE_FALSE; |
1055 } | 1055 } |
1056 | 1056 |
1057 | 1057 |
1058 static int dmWritePNGRow(void *cbdata, const Uint8 *row, const size_t len) | 1058 static int dmWritePNGRow(void *cbdata, const Uint8 *row, const size_t len) |
1059 { | 1059 { |
1434 buf[2] == 1 && | 1434 buf[2] == 1 && |
1435 (buf[3] == 8 || buf[3] == 4 || buf[3] == 3 || buf[3] == 1) && | 1435 (buf[3] == 8 || buf[3] == 4 || buf[3] == 3 || buf[3] == 1) && |
1436 buf[65] >= 1 && buf[65] <= 4) | 1436 buf[65] >= 1 && buf[65] <= 4) |
1437 return DM_PROBE_SCORE_GOOD; | 1437 return DM_PROBE_SCORE_GOOD; |
1438 | 1438 |
1439 return DM_PROBE_SCORE_false; | 1439 return DM_PROBE_SCORE_FALSE; |
1440 } | 1440 } |
1441 | 1441 |
1442 | 1442 |
1443 // Returns one byte from row buffer (of length len) at offset soffs, | 1443 // Returns one byte from row buffer (of length len) at offset soffs, |
1444 // OR zero if the offset is outside buffer. | 1444 // OR zero if the offset is outside buffer. |
2038 return DM_PROBE_SCORE_MAX; | 2038 return DM_PROBE_SCORE_MAX; |
2039 else | 2039 else |
2040 return DM_PROBE_SCORE_GOOD; | 2040 return DM_PROBE_SCORE_GOOD; |
2041 } | 2041 } |
2042 | 2042 |
2043 return DM_PROBE_SCORE_false; | 2043 return DM_PROBE_SCORE_FALSE; |
2044 } | 2044 } |
2045 | 2045 |
2046 | 2046 |
2047 static int fmtProbeIFF_ILBM(const Uint8 *buf, const size_t len) | 2047 static int fmtProbeIFF_ILBM(const Uint8 *buf, const size_t len) |
2048 { | 2048 { |
3053 const int ndmImageFormatList = sizeof(dmImageFormatList) / sizeof(dmImageFormatList[0]); | 3053 const int ndmImageFormatList = sizeof(dmImageFormatList) / sizeof(dmImageFormatList[0]); |
3054 | 3054 |
3055 | 3055 |
3056 int dmImageProbeGeneric(const Uint8 *buf, const size_t len, const DMImageFormat **pfmt, int *index) | 3056 int dmImageProbeGeneric(const Uint8 *buf, const size_t len, const DMImageFormat **pfmt, int *index) |
3057 { | 3057 { |
3058 int scoreMax = DM_PROBE_SCORE_false, scoreIndex = -1; | 3058 int scoreMax = DM_PROBE_SCORE_FALSE, scoreIndex = -1; |
3059 | 3059 |
3060 for (int i = 0; i < ndmImageFormatList; i++) | 3060 for (int i = 0; i < ndmImageFormatList; i++) |
3061 { | 3061 { |
3062 const DMImageFormat *fmt = &dmImageFormatList[i]; | 3062 const DMImageFormat *fmt = &dmImageFormatList[i]; |
3063 if (fmt->probe != NULL) | 3063 if (fmt->probe != NULL) |
3076 *pfmt = &dmImageFormatList[scoreIndex]; | 3076 *pfmt = &dmImageFormatList[scoreIndex]; |
3077 *index = scoreIndex; | 3077 *index = scoreIndex; |
3078 return scoreMax; | 3078 return scoreMax; |
3079 } | 3079 } |
3080 else | 3080 else |
3081 return DM_PROBE_SCORE_false; | 3081 return DM_PROBE_SCORE_FALSE; |
3082 } | 3082 } |
3083 | 3083 |
3084 | 3084 |
3085 // | 3085 // |
3086 // List of formats | 3086 // List of formats |
3102 const int ndmPaletteFormatList = sizeof(dmPaletteFormatList) / sizeof(dmPaletteFormatList[0]); | 3102 const int ndmPaletteFormatList = sizeof(dmPaletteFormatList) / sizeof(dmPaletteFormatList[0]); |
3103 | 3103 |
3104 | 3104 |
3105 int dmPaletteProbeGeneric(const Uint8 *buf, const size_t len, const DMPaletteFormat **pfmt, int *index) | 3105 int dmPaletteProbeGeneric(const Uint8 *buf, const size_t len, const DMPaletteFormat **pfmt, int *index) |
3106 { | 3106 { |
3107 int scoreMax = DM_PROBE_SCORE_false, scoreIndex = -1; | 3107 int scoreMax = DM_PROBE_SCORE_FALSE, scoreIndex = -1; |
3108 | 3108 |
3109 for (int i = 0; i < ndmPaletteFormatList; i++) | 3109 for (int i = 0; i < ndmPaletteFormatList; i++) |
3110 { | 3110 { |
3111 const DMPaletteFormat *fmt = &dmPaletteFormatList[i]; | 3111 const DMPaletteFormat *fmt = &dmPaletteFormatList[i]; |
3112 if (fmt->probe != NULL) | 3112 if (fmt->probe != NULL) |
3125 *pfmt = &dmPaletteFormatList[scoreIndex]; | 3125 *pfmt = &dmPaletteFormatList[scoreIndex]; |
3126 *index = scoreIndex; | 3126 *index = scoreIndex; |
3127 return scoreMax; | 3127 return scoreMax; |
3128 } | 3128 } |
3129 else | 3129 else |
3130 return DM_PROBE_SCORE_false; | 3130 return DM_PROBE_SCORE_FALSE; |
3131 } | 3131 } |