changeset 1550:ba09aa661c72

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 13 May 2018 01:19:21 +0300
parents 87af4e63a392
children 31010318ea8c
files tools/gfxconv.c
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/tools/gfxconv.c	Sat May 12 23:08:16 2018 +0300
+++ b/tools/gfxconv.c	Sun May 13 01:19:21 2018 +0300
@@ -990,14 +990,15 @@
 }
 
 
-int dmConvertC64Bitmap(DMC64Image **pdst, const DMC64Image *src, const DMC64ImageFormat *fmt)
+int dmConvertC64Bitmap(DMC64Image **pdst, const DMC64Image *src,
+    const DMC64ImageFormat *dstFmt, const DMC64ImageFormat *srcFmt)
 {
     DMC64Image *dst;
 
-    if (pdst == NULL || fmt == NULL || src == NULL)
+    if (pdst == NULL || dstFmt == NULL || src == NULL || srcFmt == NULL)
         return DMERR_NULLPTR;
 
-    if ((dst = *pdst = dmC64ImageAlloc(fmt)) == NULL)
+    if ((dst = *pdst = dmC64ImageAlloc(dstFmt)) == NULL)
         return DMERR_MALLOC;
 
     if (src->type == dst->type)
@@ -1026,7 +1027,7 @@
 
             for (int i = 0; i < D64_MAX_ENCDEC_OPS; i++)
             {
-                const DMC64EncDecOp *op = &fmt->encdecOps[i];
+                const DMC64EncDecOp *op = &dstFmt->encdecOps[i];
                 size_t size;
 
                 // Check for last operator
@@ -1034,7 +1035,7 @@
                     break;
 
                 // Check size
-                if (!dmC64GetOpSize(op, fmt, &size))
+                if (!dmC64GetOpSize(op, dstFmt, &size))
                     return DMERR_INVALID_DATA;
 
                 // Perform operation
@@ -1065,8 +1066,7 @@
 
     // And output the file
     dmMsg(1, "Writing output file '%s'\n", filename);
-    if ((res = dmWriteDataFile(NULL, filename, buf.data, buf.len)) != DMERR_OK)
-        goto error;
+    res = dmWriteDataFile(NULL, filename, buf.data, buf.len);
 
 error:
     dmGrowBufFree(&buf);
@@ -1751,7 +1751,7 @@
                         break;
 
                     case FFMT_BITMAP:
-                        if ((res = dmConvertC64Bitmap(&outC64Image, inC64Image, &dmC64ImageFormats[optOutSubFormat])) != DMERR_OK)
+                        if ((res = dmConvertC64Bitmap(&outC64Image, inC64Image, &dmC64ImageFormats[optOutSubFormat], inC64Fmt)) != DMERR_OK)
                         {
                             dmErrorMsg("Error in bitmap format conversion.\n");
                             goto error;