diff tools/gfxconv.c @ 799:5ec451795ab2

Add some error checking.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 30 Oct 2013 02:25:40 +0200
parents d9888292f971
children 1e4d88fbce19
line wrap: on
line diff
--- a/tools/gfxconv.c	Fri Oct 18 20:59:46 2013 +0300
+++ b/tools/gfxconv.c	Wed Oct 30 02:25:40 2013 +0200
@@ -1413,6 +1413,8 @@
 
             if (optSequential)
             {
+                int eres;
+
                 outFilename = dm_strdup_printf("%s%04d.%s", optOutFilename, itemCount, convFormatList[optOutFormat].fext);
                 if (outFilename == NULL)
                 {
@@ -1420,7 +1422,13 @@
                     goto error;
                 }
                 
-                dmWriteImage(optOutFilename, outImage, &optSpec, optOutSubFormat, TRUE);
+                eres = dmWriteImage(optOutFilename, outImage, &optSpec, optOutSubFormat, TRUE);
+                if (eres != DMERR_OK)
+                {
+                    dmError("Error writing output image, %s.\n",
+                        dmErrorStr(eres));
+                }
+
                 dmFree(outFilename);
             }
             else
@@ -1437,7 +1445,12 @@
 
         if (!optSequential)
         {
-            dmWriteImage(optOutFilename, outImage, &optSpec, optOutSubFormat, TRUE);
+            int eres = dmWriteImage(optOutFilename, outImage, &optSpec, optOutSubFormat, TRUE);
+            if (eres != DMERR_OK)
+            {
+                dmError("Error writing output image, %s.\n",
+                    dmErrorStr(eres));
+            }
         }
         
         dmImageFree(outImage);