diff tools/auval.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 56e12109b936
children 848a88ce7a57
line wrap: on
line diff
--- a/tools/auval.c	Fri Feb 27 02:21:57 2015 +0200
+++ b/tools/auval.c	Fri Feb 27 03:58:25 2015 +0200
@@ -99,7 +99,7 @@
             {
                 if (w < 320 || h < 200 || w > 3200 || h > 3200)
                 {
-                    dmError("Invalid width or height: %d x %d\n", w, h);
+                    dmErrorMsg("Invalid width or height: %d x %d\n", w, h);
                     return FALSE;
                 }
                 optScrWidth = w;
@@ -107,13 +107,13 @@
             }
             else 
             {
-                dmError("Invalid size argument '%s'.\n", optArg);
+                dmErrorMsg("Invalid size argument '%s'.\n", optArg);
                 return FALSE;
             }
         }
         else
         {
-            dmError("Dimensions option %s requires an argument.\n", currArg);
+            dmErrorMsg("Dimensions option %s requires an argument.\n", currArg);
         }
         break;
 
@@ -126,7 +126,7 @@
             int tmp = atoi(optArg);
             if (tmp < 4000 || tmp > 96000)
             {
-                dmError("Invalid audio frequency '%s'.\n", optArg);
+                dmErrorMsg("Invalid audio frequency '%s'.\n", optArg);
                 return FALSE;
             }
             optAudioFreq = tmp;
@@ -138,7 +138,7 @@
             int tmp = atoi(optArg);
             if (tmp < 32 || tmp > 512)
             {
-                dmError("Invalid bitmap size '%s'.\n", optArg);
+                dmErrorMsg("Invalid bitmap size '%s'.\n", optArg);
                 return FALSE;
             }
             optBMPSize = tmp;
@@ -154,7 +154,7 @@
         break;
 
     default:
-        dmError("Unknown option '%s'.\n", currArg);
+        dmErrorMsg("Unknown option '%s'.\n", currArg);
         return FALSE;
     }
     
@@ -318,7 +318,7 @@
     *screen = SDL_SetVideoMode(optScrWidth, optScrHeight, optScrDepth, optVFlags | SDL_RESIZABLE);
     if (*screen == NULL)
     {
-        dmError("Can't SDL_SetVideoMode(): %s\n", SDL_GetError());
+        dmErrorMsg("Can't SDL_SetVideoMode(): %s\n", SDL_GetError());
         return FALSE;
     }
 
@@ -485,7 +485,7 @@
     FILE *f = fopen(filename, "r");
     if (f == NULL)
     {
-        dmError("Could not open input file '%s'.\n", filename);
+        dmErrorMsg("Could not open input file '%s'.\n", filename);
         return -1;
     }
 
@@ -522,7 +522,7 @@
     FILE *f = fopen(filename, "w");
     if (f == NULL)
     {
-        dmError("Could not create output file '%s'.\n", filename);
+        dmErrorMsg("Could not create output file '%s'.\n", filename);
         return -1;
     }
 
@@ -629,7 +629,7 @@
     histBuf = dmCalloc(sizeof(histBuf[0]), optHistoryLen + 2);
     if (histBuf == NULL)
     {
-        dmError("Could not allocate memory for edit history buffer!\n");
+        dmErrorMsg("Could not allocate memory for edit history buffer!\n");
         goto error_exit;
     }
 
@@ -651,14 +651,14 @@
     /* Initialize SDL */
     if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO) != 0)
     {
-        dmError("Could not initialize SDL: %s\n", SDL_GetError());
+        dmErrorMsg("Could not initialize SDL: %s\n", SDL_GetError());
         goto error_exit;
     }
     initSDL = TRUE;
 
     if (TTF_Init() < 0)
     {
-        dmError("Could not initialize FreeType/TTF: %s\n", SDL_GetError());
+        dmErrorMsg("Could not initialize FreeType/TTF: %s\n", SDL_GetError());
         goto error_exit;
     }
     initTTF = TRUE;
@@ -666,7 +666,7 @@
     font = TTF_OpenFont(optFontFile, optFontSize);
     if (font == NULL)
     {
-        dmError("Could not load TTF font '%s' (%d): %s\n",
+        dmErrorMsg("Could not load TTF font '%s' (%d): %s\n",
             optFontFile, optFontSize, SDL_GetError());
         goto error_exit;
     }
@@ -691,7 +691,7 @@
 
     if (SDL_OpenAudio(&fmt, NULL) < 0)
     {
-        dmError("Could not initialize SDL audio.\n");
+        dmErrorMsg("Could not initialize SDL audio.\n");
         goto error_exit;
     }
 
@@ -1030,7 +1030,7 @@
         {
             if (SDL_MUSTLOCK(screen) != 0 && SDL_LockSurface(screen) != 0)
             {
-                dmError("Can't lock surface");
+                dmErrorMsg("Can't lock surface");
                 goto error_exit;
             }