diff tools/ppl.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 96e0798f602b
line wrap: on
line diff
--- a/tools/ppl.c	Fri Feb 27 02:21:57 2015 +0200
+++ b/tools/ppl.c	Fri Feb 27 03:58:25 2015 +0200
@@ -105,7 +105,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;
                     }
                     engine.optScrWidth = w;
@@ -113,7 +113,7 @@
                 }
                 else 
                 {
-                    dmError("Invalid size argument '%s'.\n", optArg);
+                    dmErrorMsg("Invalid size argument '%s'.\n", optArg);
                     return FALSE;
                 }
             }
@@ -153,7 +153,7 @@
             break;
 
         default:
-            dmError("Unknown option '%s'.\n", currArg);
+            dmErrorMsg("Unknown option '%s'.\n", currArg);
             return FALSE;
     }
     
@@ -167,7 +167,7 @@
         optFilename = currArg;
     else
     {
-        dmError("Too many filename arguments '%s'\n", currArg);
+        dmErrorMsg("Too many filename arguments '%s'\n", currArg);
         return FALSE;
     }
     
@@ -239,7 +239,7 @@
 
     if (engine.screen == NULL)
     {
-        dmError("Can't SDL_SetVideoMode(): %s\n", SDL_GetError());
+        dmErrorMsg("Can't SDL_SetVideoMode(): %s\n", SDL_GetError());
         return FALSE;
     }
 
@@ -577,13 +577,13 @@
     // Open the files
     if (optFilename == NULL)
     {
-        dmError("No filename specified.\n");
+        dmErrorMsg("No filename specified.\n");
         return 1;
     }
     
     if ((result = dmf_create_stdio(optFilename, "rb", &file)) != DMERR_OK)
     {
-        dmError("Error opening file '%s', %d: (%s)\n",
+        dmErrorMsg("Error opening file '%s', %d: (%s)\n",
             optFilename, result, dmErrorStr(result));
         return 1;
     }
@@ -609,7 +609,7 @@
 
     if (result != DMERR_OK)
     {
-        dmError("Error loading module file, %d: %s\n",
+        dmErrorMsg("Error loading module file, %d: %s\n",
             result, dmErrorStr(result));
         goto error_exit;
     }
@@ -617,7 +617,7 @@
     // Try to convert it
     if ((result = jssConvertModuleForPlaying(engine.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));
         goto error_exit;
     }
@@ -626,7 +626,7 @@
     result = dmf_create_memio(NULL, "pplfont.fnt", engineSetupFont, sizeof(engineSetupFont), &file);
     if (result != DMERR_OK)
     {
-        dmError("Error opening font file 'pplfont.fnt', #%d: %s\n",
+        dmErrorMsg("Error opening font file 'pplfont.fnt', #%d: %s\n",
             result, dmErrorStr(result));
         goto error_exit;
     }
@@ -634,7 +634,7 @@
     dmf_close(file);
     if (result != DMERR_OK)
     {
-        dmError("Could not load font from file, %d: %s\n",
+        dmErrorMsg("Could not load font from file, %d: %s\n",
             result, dmErrorStr(result));
         goto error_exit;
     }
@@ -642,7 +642,7 @@
     // Initialize SDL components
     if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER) != 0)
     {
-        dmError("Could not initialize SDL: %s\n", SDL_GetError());
+        dmErrorMsg("Could not initialize SDL: %s\n", SDL_GetError());
         goto error_exit;
     }
     initSDL = TRUE;
@@ -655,7 +655,7 @@
     engine.dev = jvmInit(optOutFormat, optOutChannels, optOutFreq, JMIX_AUTO);
     if (engine.dev == NULL)
     {
-        dmError("jvmInit() returned NULL\n");
+        dmErrorMsg("jvmInit() returned NULL\n");
         goto error_exit;
     }
     
@@ -666,7 +666,7 @@
         case JSS_AUDIO_S8:  engine.afmt.format = AUDIO_S8; break;
         case JSS_AUDIO_U8:  engine.afmt.format = AUDIO_U8; break;
         default:
-            dmError("Unsupported audio format %d (could not set matching SDL format)\n",
+            dmErrorMsg("Unsupported audio format %d (could not set matching SDL format)\n",
                 optOutFormat);
             goto error_exit;
     }
@@ -680,7 +680,7 @@
     // Open the audio device
     if (SDL_OpenAudio(&engine.afmt, NULL) < 0)
     {
-        dmError("Couldn't open SDL audio: %s\n",
+        dmErrorMsg("Couldn't open SDL audio: %s\n",
             SDL_GetError());
         goto error_exit;
     }
@@ -689,7 +689,7 @@
     // Initialize player
     if ((engine.plr = jmpInit(engine.dev)) == NULL)
     {
-        dmError("jmpInit() returned NULL\n");
+        dmErrorMsg("jmpInit() returned NULL\n");
         goto error_exit;
     }
     
@@ -841,7 +841,7 @@
         // Draw frame
         if (SDL_MUSTLOCK(engine.screen) != 0 && SDL_LockSurface(engine.screen) != 0)
         {
-            dmError("Can't lock surface.\n");
+            dmErrorMsg("Can't lock surface.\n");
             goto error_exit;
         }