diff lib64gfx.c @ 517:e2a76bb59888

Return better error values, using DMERR_* enums.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 19 Nov 2012 17:24:41 +0200
parents 6f141f760c54
children 63849f85db57
line wrap: on
line diff
--- a/lib64gfx.c	Mon Nov 19 17:24:08 2012 +0200
+++ b/lib64gfx.c	Mon Nov 19 17:24:41 2012 +0200
@@ -70,12 +70,12 @@
     Uint8 *dp;
 
     if (img == NULL)
-        return -1;
-    if (xoffs < 0 || yoffs < 0)
-        return -2;
-    if (xoffs > img->width - widthpx ||
+        return DMERR_NULLPTR;
+
+    if (xoffs < 0 || yoffs < 0 ||
+        xoffs > img->width - widthpx ||
         yoffs > img->height - height)
-        return -3;
+        return DMERR_INVALID_ARGS;
 
     dp = img->data + (yoffs * img->pitch) + xoffs;
 
@@ -121,7 +121,7 @@
         }
     }
     
-    return 0;
+    return DMERR_OK;
 }
 
 
@@ -634,7 +634,7 @@
             return dmC64ConvertLaceMultiColorBMP(dst, src);
 
         default:
-            return -1;
+            return DMERR_NOT_SUPPORTED;
     }
 }