changeset 1630:00e0d345e7f1

Improve autoprobing error handling a bit.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 24 May 2018 22:25:23 +0300
parents f31b77416a83
children ed5ccf00b959
files tools/gfxconv.c
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/tools/gfxconv.c	Thu May 24 22:19:35 2018 +0300
+++ b/tools/gfxconv.c	Thu May 24 22:25:23 2018 +0300
@@ -1700,16 +1700,15 @@
         }
 
         res = dmC64DecodeBMP(&inC64Image, dataBuf, dataSize, optInSkip, optInSkip + 2, &inC64Fmt, forced);
-        if (forced == NULL && inC64Fmt != NULL)
+        if (forced == NULL && inC64Fmt != NULL && res == DMERR_OK)
         {
             dmMsg(1, "Probed '%s' format image, type %d, %s\n",
                 inC64Fmt->name, inC64Fmt->type, inC64Fmt->fext);
+
+            optInFormat = FFMT_BITMAP;
         }
-
-        if (res == DMERR_OK)
-            optInFormat = FFMT_BITMAP;
         else
-        if (optInFormat == FFMT_BITMAP)
+        if (res != DMERR_OK && (forced != NULL || optInFormat == FFMT_BITMAP))
         {
             dmErrorMsg("Could not decode input image: %s.\n", dmErrorStr(res));
             goto error;