changeset 1810:c9197a038e8e

Various cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 21 Jun 2018 13:00:24 +0300
parents a20655e40e6c
children 4f141426eb31
files tools/libgfx.c
diffstat 1 files changed, 9 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/tools/libgfx.c	Thu Jun 21 11:14:26 2018 +0300
+++ b/tools/libgfx.c	Thu Jun 21 13:00:24 2018 +0300
@@ -1480,12 +1480,11 @@
 
 typedef struct
 {
-    DMIFFChunk chBMHD, chCMAP, chBODY;
+    DMIFFChunk chFORM, chBMHD, chCMAP, chBODY;
     DMIFFBMHD bmhd;
-    Uint32 camg, idILBM;
+    Uint32 camg;
     int ncolors;
     DMColor *pal;
-    BOOL planar;
 } DMIFF;
 
 
@@ -1743,8 +1742,8 @@
 {
     DMIFFChunk chunk;
     DMIFF iff;
-    Uint32 read;
-    BOOL parsed = FALSE;
+    Uint32 read, idsig;
+    BOOL parsed = FALSE, planar;
     int res = DMERR_OK;
 
     dmMemset(&iff, 0, sizeof(iff));
@@ -1761,14 +1760,14 @@
     }
 
     // Check IFF ILBM signature
-    if (!dmf_read_be32(fp, &iff.idILBM) ||
-        (iff.idILBM != IFF_ID_ILBM && iff.idILBM != IFF_ID_PBM))
+    if (!dmf_read_be32(fp, &idsig) ||
+        (idsig != IFF_ID_ILBM && idsig != IFF_ID_PBM))
     {
         return dmError(DMERR_INVALID_DATA,
             "ILBM: Not a ILBM file.\n");
     }
 
-    iff.planar = (iff.idILBM == IFF_ID_ILBM);
+    planar = (idsig == IFF_ID_ILBM);
 
     while (!parsed && !dmfeof(fp))
     {
@@ -1891,7 +1890,7 @@
                     (*pimg)->aspect = (float) iff.bmhd.yasp / (float) iff.bmhd.xasp;
 
                 // Decode the body
-                if (iff.planar)
+                if (planar)
                 {
                     if ((res = dmDecodeILBMBody(fp, &iff, *pimg, &read)) != DMERR_OK)
                         return res;
@@ -1955,7 +1954,7 @@
         if (iff.camg & IFF_CAMG_HALFBRITE)
         {
             void *ptmp;
-            if (!iff.planar)
+            if (!planar)
             {
                 dmErrorMsg("ILBM: Non-planar PBM file with Halfbrite enabled! This might not work.\n");
             }