changeset 2580:317d2f4b322c

Reorder some format specific probe functions etc.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 20 Mar 2022 14:50:13 +0200
parents e716a2f18da0
children 60ffbddedd07
files tools/lib64fmts.c
diffstat 1 files changed, 36 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64fmts.c	Sat Mar 12 02:42:31 2022 +0200
+++ b/tools/lib64fmts.c	Sun Mar 20 14:50:13 2022 +0200
@@ -1374,6 +1374,42 @@
 }
 
 
+#define XX2_MIN_SIZE   4000
+#define XX2_WIDTH_CH   40
+#define XX2_HEIGHT_CH  10
+#define XX2_SIZE       (XX2_WIDTH_CH * XX2_HEIGHT_CH)
+#define XX2_BSIZE      (XX2_SIZE * 8)
+
+
+static int fmtProbeFormatXX2(const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
+{
+    if (buf->len >= XX2_MIN_SIZE &&
+        buf->len <= XX2_MIN_SIZE + 8 &&
+        dmCompareAddr16(buf, 0, fmt->addr))
+        return DM_PROBE_SCORE_MAYBE;
+
+    return DM_PROBE_SCORE_FALSE;
+}
+
+
+static int fmtDecodeFormatXX2(DMC64Image *img, const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
+{
+    int res;
+    DMGrowBuf tmp;
+
+    // If there is only data for less than XX2_MIN_SIZE bytes,
+    // allocate a buffer of that size and copy data there.
+    // Otherwise allocate len bytes.
+    if (dmGrowBufCopy(&tmp, buf, buf->len < XX2_MIN_SIZE ? XX2_MIN_SIZE - buf->len : 0) == NULL)
+        return DMERR_MALLOC;
+
+    tmp.len = tmp.size;
+    res = dmC64DecodeGenericBMP(img, &tmp, fmt);
+    dmGrowBufFree(&tmp);
+    return res;
+}
+
+
 static const Uint8 fmtFormatXX3_MagicID_1[] =
 {
     0x01, 0x08, 0x0B, 0x08,  0xF0, 0x02, 0x9E, 0x32,
@@ -1442,42 +1478,6 @@
 }
 
 
-#define XX2_MIN_SIZE   4000
-#define XX2_WIDTH_CH   40
-#define XX2_HEIGHT_CH  10
-#define XX2_SIZE       (XX2_WIDTH_CH * XX2_HEIGHT_CH)
-#define XX2_BSIZE      (XX2_SIZE * 8)
-
-
-static int fmtProbeFormatXX2(const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
-{
-    if (buf->len >= XX2_MIN_SIZE &&
-        buf->len <= XX2_MIN_SIZE + 8 &&
-        dmCompareAddr16(buf, 0, fmt->addr))
-        return DM_PROBE_SCORE_MAYBE;
-
-    return DM_PROBE_SCORE_FALSE;
-}
-
-
-static int fmtDecodeFormatXX2(DMC64Image *img, const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
-{
-    int res;
-    DMGrowBuf tmp;
-
-    // If there is only data for less than XX2_MIN_SIZE bytes,
-    // allocate a buffer of that size and copy data there.
-    // Otherwise allocate len bytes.
-    if (dmGrowBufCopy(&tmp, buf, buf->len < XX2_MIN_SIZE ? XX2_MIN_SIZE - buf->len : 0) == NULL)
-        return DMERR_MALLOC;
-
-    tmp.len = tmp.size;
-    res = dmC64DecodeGenericBMP(img, &tmp, fmt);
-    dmGrowBufFree(&tmp);
-    return res;
-}
-
-
 static int fmtProbeCosmosDesignsHiresManager(const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
 {
     if (buf->len > 32 && dmCompareAddr16(buf, 0, fmt->addr))