diff tools/mod2wav.c @ 958:985225a93aeb

Add error code parameter to dmError() and dmErrorVA().
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 27 Feb 2015 03:58:25 +0200
parents daebbf28953d
children a79edf59d5d8
line wrap: on
line diff
--- a/tools/mod2wav.c	Fri Feb 27 02:21:57 2015 +0200
+++ b/tools/mod2wav.c	Fri Feb 27 03:58:25 2015 +0200
@@ -98,7 +98,7 @@
             break;
 
         default:
-            dmError("Unknown argument '%s'.\n", currArg);
+            dmErrorMsg("Unknown argument '%s'.\n", currArg);
             return FALSE;
     }
     
@@ -115,7 +115,7 @@
         optOutFilename = currArg;
     else
     {
-        dmError("Too many filename arguments (only source and dest needed) '%s'\n", currArg);
+        dmErrorMsg("Too many filename arguments (only source and dest needed) '%s'\n", currArg);
         return FALSE;
     }
     
@@ -145,7 +145,7 @@
     // Check arguments
     if (optInFilename == NULL || optOutFilename == NULL)
     {
-        dmError("Input or output file not specified. Try --help.\n");
+        dmErrorMsg("Input or output file not specified. Try --help.\n");
         return 1;
     }
     
@@ -155,7 +155,7 @@
     // Open the source file
     if ((result = dmf_create_stdio(optInFilename, "rb", &inFile)) != DMERR_OK)
     {
-        dmError("Error opening input file '%s', %d: %s\n",
+        dmErrorMsg("Error opening input file '%s', %d: %s\n",
             optInFilename, result, dmErrorStr(result));
         return 1;
     }
@@ -177,7 +177,7 @@
     dmf_close(inFile);
     if (result != DMERR_OK)
     {
-        dmError("Error loading module file, %d: %s\n",
+        dmErrorMsg("Error loading module file, %d: %s\n",
             result, dmErrorStr(result));
         return 3;
     }
@@ -185,7 +185,7 @@
     // Try to convert it
     if ((result = jssConvertModuleForPlaying(mod)) != DMERR_OK)
     {
-        dmError("Could not convert module for playing, %d: %s\n",
+        dmErrorMsg("Could not convert module for playing, %d: %s\n",
             result, dmErrorStr(result));
         return 3;
     }
@@ -194,14 +194,14 @@
     dev = jvmInit(optOutFormat, optOutChannels, optOutFreq, JMIX_AUTO);
     if (dev == NULL)
     {
-        dmError("jvmInit() returned NULL\n");
+        dmErrorMsg("jvmInit() returned NULL\n");
         return 4;
     }
 
     sampSize = jvmGetSampleSize(dev);
     if ((mb = dmMalloc(bufLen * sampSize)) == NULL)
     {
-        dmError("Could not allocate mixing buffer\n");
+        dmErrorMsg("Could not allocate mixing buffer\n");
         return 5;
     }
     
@@ -212,7 +212,7 @@
     // Initialize player
     if ((plr = jmpInit(dev)) == NULL)
     {
-        dmError("jmpInit() returned NULL.\n");
+        dmErrorMsg("jmpInit() returned NULL.\n");
         return 6;
     }
     
@@ -241,7 +241,7 @@
     // Open output file
     if ((outFile = fopen(optOutFilename, "wb")) == NULL)
     {
-        dmError("Error opening output file '%s'. (%s)\n",
+        dmErrorMsg("Error opening output file '%s'. (%s)\n",
             optInFilename, strerror(errno));
         return 7;
     }
@@ -273,7 +273,7 @@
             dataWritten = fwrite(mb, sampSize, writeLen, outFile);
             if (dataWritten < writeLen)
             {
-                dmError("Error writing data!\n");
+                dmErrorMsg("Error writing data!\n");
                 fclose(outFile);
                 return 8;
             }
@@ -287,7 +287,7 @@
     // Write the correct header
     if (fseek(outFile, 0L, SEEK_SET) != 0)
     {
-        dmError("Error rewinding to header position!\n");
+        dmErrorMsg("Error rewinding to header position!\n");
         return 9;
     }