diff tools/lib64fmts.c @ 2329:0085ce04788b

Add return value (error code) to dmGenericRLEAnalyze() and pass it through where used.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 16 Sep 2019 10:24:49 +0300
parents 87533af8db64
children 6dc64deb6718
line wrap: on
line diff
--- a/tools/lib64fmts.c	Mon Sep 16 10:14:57 2019 +0300
+++ b/tools/lib64fmts.c	Mon Sep 16 10:24:49 2019 +0300
@@ -404,7 +404,8 @@
     cfg.rleMinCountB = 4;
     cfg.rleMaxCountB = 255;
 
-    dmGenericRLEAnalyze(&tmp, &cfg);
+    if ((res = dmGenericRLEAnalyze(&tmp, &cfg)) != DMERR_OK)
+        goto out;
 
     // Add the header bits
     if (!dmGrowBufPut(buf, (Uint8 *) magicID, strlen(magicID)) ||
@@ -530,7 +531,8 @@
     cfg.rleMinCountW = 256;
     cfg.rleMaxCountW = 1024;
 
-    dmGenericRLEAnalyze(&mem, &cfg);
+    if ((res = dmGenericRLEAnalyze(&mem, &cfg)) != DMERR_OK)
+        goto out;
 
     // Add the header bits
     if (!dmGrowBufPut(buf, (Uint8 *) fmtBDP5_MagicID, strlen(fmtBDP5_MagicID)) ||
@@ -747,7 +749,8 @@
     cfg.rleMinCountB = 4;
     cfg.rleMaxCountB = 256; // this format allows 256 byte runs with ZERO_COUNT_MAX
 
-    dmGenericRLEAnalyze(&tmp1, &cfg);
+    if ((res = dmGenericRLEAnalyze(&tmp1, &cfg)) != DMERR_OK)
+        goto out;
 
     if ((res = dmEncodeGenericRLEAlloc(&tmp2, &tmp1, &cfg)) != DMERR_OK)
         goto out;
@@ -1249,7 +1252,8 @@
     cfg.rleMinCountB = 4;
     cfg.rleMaxCountB = 255;
 
-    dmGenericRLEAnalyze(&mem, &cfg);
+    if ((res = dmGenericRLEAnalyze(&mem, &cfg)) != DMERR_OK)
+        goto out;
 
     // Add the header bits
     if (!dmGrowBufPut(buf, (Uint8 *) fmtFunPaint2_MagicID, strlen(fmtFunPaint2_MagicID)) ||