diff gfxconv.c @ 488:49f0ce2cc347

Error printing cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 12 Nov 2012 22:02:47 +0200
parents b89598501cec
children fca3c240ccac
line wrap: on
line diff
--- a/gfxconv.c	Mon Nov 12 17:21:33 2012 +0200
+++ b/gfxconv.c	Mon Nov 12 22:02:47 2012 +0200
@@ -5,7 +5,6 @@
  *
  * Please read file 'COPYING' for information on license and distribution.
  */
-#include <errno.h>
 #include "dmlib.h"
 #include "dmargs.h"
 #include "dmfile.h"
@@ -1062,9 +1061,9 @@
         else
         if ((outFile = fopen(optOutFilename, "w")) == NULL)
         {
-            int res = errno;
-            dmError("Error opening output file '%s'. (%s)\n",
-                  optOutFilename, strerror(res));
+            int res = dmGetErrno();
+            dmError("Error opening output file '%s', %d: %s\n",
+                  optOutFilename, res, dmErrorStr(res));
             goto error;
         }
 
@@ -1248,9 +1247,9 @@
     else
     if ((inFile = fopen(optInFilename, "rb")) == NULL)
     {
-        int res = errno;
-        dmError("Error opening input file '%s'. (%s)\n",
-              optInFilename, strerror(res));
+        int res = dmGetErrno();
+        dmError("Error opening input file '%s', %d: %s\n",
+              optInFilename, res, dmErrorStr(res));
         goto error;
     }
 
@@ -1303,9 +1302,9 @@
     // Skip, if needed
     if (fseek(inFile, optInSkip, SEEK_SET) != 0)
     {
-        int res = errno;
+        int res = dmGetErrno();
         dmError("Could not seek to file position %d (0x%x): %s\n",
-            optInSkip, optInSkip, strerror(res));
+            optInSkip, optInSkip, dmErrorStr(res));
         goto error;
     }