diff lib64gfx.c @ 508:1ed5025c2538

Return DMLIB error values instead of arbitrary 0/negatives.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 19 Nov 2012 13:50:10 +0200
parents 272e64259fde
children 43ea59887c69
line wrap: on
line diff
--- a/lib64gfx.c	Mon Nov 19 13:49:44 2012 +0200
+++ b/lib64gfx.c	Mon Nov 19 13:50:10 2012 +0200
@@ -441,14 +441,14 @@
         {
             dmError("Invalid bank %d definition in generic decode operator %d @ #%d.\n",
                 op->bank, op->type, i);
-            return -1;
+            return DMERR_INTERNAL;
         }
         
         if (op->type < 0 || op->type >= DT_LAST)
         {
             dmError("Invalid decode operator type %d @ #%d.\n",
                 op->type, i);
-            return -1;
+            return DMERR_INTERNAL;
         }
         
         size = (op->size == 0) ? dmC64DefaultSizes[op->type] : op->size;
@@ -457,7 +457,7 @@
         {
             dmError("Decode out of bounds, op #%d type=%d, offs=%d ($%04x), bank=%d, size=%d ($%04x) @ %d ($%04x\n",
                 i, op->type, op->offs, op->offs, op->bank, size, size, len, len);
-            return -2;
+            return DMERR_INVALID_DATA;
         }
         
         src = buf + op->offs;
@@ -474,19 +474,19 @@
                 {
                     dmError("Decode op is a function, but function ptr is NULL: op #%d, offs=%d ($%04x), bank=%d, size=%d ($%04x) @ %d ($%04x\n",
                         i, op->offs, op->offs, op->bank, size, size, len, len);
-                    return -6;
+                    return DMERR_INTERNAL;
                 }
                 if (!op->function(img, op, buf, len))
                 {
                     dmError("Decode op custom function failed: op #%d, offs=%d ($%04x), bank=%d, size=%d ($%04x) @ %d ($%04x\n",
                         i, op->offs, op->offs, op->bank, size, size, len, len);
-                    return -5;
+                    return DMERR_INTERNAL;
                 }
                 break;
         }
     }
     
-    return 0;
+    return DMERR_OK;
 }
 
 
@@ -522,7 +522,7 @@
         dp += screen->pitch;
     }
 
-    return 0;
+    return DMERR_OK;
 }
 
 
@@ -562,7 +562,7 @@
         dp += screen->pitch;
     }
 
-    return 0;
+    return DMERR_OK;
 }
 
 
@@ -612,7 +612,7 @@
         dp += screen->pitch;
     }
 
-    return 0;
+    return DMERR_OK;
 }