This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository legacy-imlib2.

View the commit online.

commit 472c823aafe060e6e2296fce595c75ecb299dfef
Author: Kim Woelders <[email protected]>
AuthorDate: Wed Dec 7 16:53:53 2022 +0100

    imlib2_view: Don't load bad images twice if first or last in argument list
---
 src/bin/imlib2_view.c | 34 +++++++++++++++++++---------------
 1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/src/bin/imlib2_view.c b/src/bin/imlib2_view.c
index 62bf4ce..e28df00 100644
--- a/src/bin/imlib2_view.c
+++ b/src/bin/imlib2_view.c
@@ -5,6 +5,7 @@
 #include <X11/keysym.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <errno.h>
 #include <stdbool.h>
 #include <unistd.h>
@@ -569,6 +570,7 @@ load_image(int no, const char *name)
           }
         animloop = 0;
 
+        memset(&finfo, 0, sizeof(finfo));
         im = load_image_frame(nbuf, frame, 0);
 
         animate = animate && animated;
@@ -783,31 +785,33 @@ main(int argc, char **argv)
                   inc = -1;
                   goto show_next_prev;
                 show_next_prev:
-                  for (no2 = no;;)
+                  no2 = no + inc;
+                  if (no2 >= argc)
+                     break;
+                  if (no2 < 0)
+                     break;
+                  for (;;)
                     {
+                       err = load_image(no2, argv[no2]);
+                       if (err == 0)
+                         {
+                            zoom = 1.0;
+                            zoom_mode = 0;
+                            no = no2;
+                            break;
+                         }
+                       Vprintf("*** Error loading image: %s\n", argv[no2]);
                        no2 += inc;
                        if (no2 >= argc)
                          {
+                            no2 = argc - 2;
                             inc = -1;
-                            continue;
                          }
                        else if (no2 < 0)
                          {
+                            no2 = 1;
                             inc = 1;
-                            continue;
                          }
-                       if (no2 == no && inc != 0)
-                          break;
-                       err = load_image(no2, argv[no2]);
-                       if (err)
-                         {
-                            Vprintf("*** Error loading image: %s\n", argv[no2]);
-                            continue;
-                         }
-                       zoom = 1.0;
-                       zoom_mode = 0;
-                       no = no2;
-                       break;
                     }
                   break;
                 show_next_frame:

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to