changeset 2286:f5a8b948efe6

Use THERR_* error codes in mapReadFile().
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 25 Apr 2020 10:11:48 +0300
parents aabfbbbf35bb
children 508a2b94e358
files mapsearch.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mapsearch.c	Sat Apr 18 09:02:34 2020 +0300
+++ b/mapsearch.c	Sat Apr 25 10:11:48 2020 +0300
@@ -1566,11 +1566,11 @@
 {
     size_t readSize, dataSize, dataPos;
     FILE *fh = NULL;
-    int res = 0;
+    int res = THERR_OK;
 
     if ((fh = fopen(filename, "rb")) == NULL)
     {
-        res = -5;
+        res = THERR_FOPEN;
         goto out;
     }
 
@@ -1578,7 +1578,7 @@
     readSize = dataSize = bufInit;
     if ((*pbuf = th_malloc(dataSize)) == NULL)
     {
-        res = -1;
+        res = THERR_MALLOC;
         goto out;
     }
 
@@ -1596,7 +1596,7 @@
             dataSize += bufGrow;
             if ((*pbuf = th_realloc(*pbuf, dataSize)) == NULL)
             {
-                res = -2;
+                res = THERR_MALLOC;
                 goto out;
             }
         }
@@ -1779,7 +1779,7 @@
         uint8_t *buf = NULL;
         size_t bufSize;
 
-        if (mapReadFile(optTest, &buf, &bufSize, 512, 512) == 0)
+        if (mapReadFile(optTest, &buf, &bufSize, 512, 512) == THERR_OK)
         {
             char *verr = NULL;
             if (optBenchmark > 0)