changeset 1420:9b7915193683

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 06 Nov 2017 01:09:13 +0200
parents 56f643d647b7
children c3bda6e63b00
files tools/view64.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/tools/view64.c	Sun Nov 05 23:27:53 2017 +0200
+++ b/tools/view64.c	Mon Nov 06 01:09:13 2017 +0200
@@ -230,11 +230,11 @@
     DMImage bmap;
     int ret;
 
-    bmap.size = surf->pitch * cimage->height;
+    bmap.size = surf->pitch * surf->h;
     bmap.data = surf->pixels;
     bmap.pitch = surf->pitch;
-    bmap.width = cimage->width;
-    bmap.height = cimage->height;
+    bmap.width = surf->w;
+    bmap.height = surf->h;
     bmap.constpal = TRUE;
 
     if (fmt->convertFrom != NULL)
@@ -347,6 +347,7 @@
                 switch (event.key.keysym.sym)
                 {
                     case SDLK_ESCAPE:
+                    case SDLK_q:
                         exitFlag = TRUE;
                         break;
 
@@ -381,7 +382,7 @@
                 break;
 
             case SDL_QUIT:
-                exit(0);
+                goto exit;
         }
 
         if (currIndex != prevIndex)
@@ -403,7 +404,7 @@
                 goto fail;
             }
 
-            if (fmt == NULL)
+            if (fmt == NULL || cimage == NULL)
             {
                 dmErrorMsg("Probing could not find any matching image format. Perhaps try forcing a format via -f.\n");
                 goto fail;