URI: 
       tMake image loading fail early - croptool - Image cropping tool
  HTML git clone git://lumidify.org/croptool.git
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 39049e695e28d31d895cdcde2f816bf5195cfdc6
   DIR parent 4246933e6434c7710e7954d5f616dc774006db64
  HTML Author: lumidify <nobody@lumidify.org>
       Date:   Wed,  6 Jan 2021 21:07:24 +0100
       
       Make image loading fail early
       
       Diffstat:
         M TODO                                |       6 +++++-
         M croptool.1                          |       2 +-
         M croptool.c                          |       4 ++--
         M croptool_crop.c                     |       1 +
       
       4 files changed, 9 insertions(+), 4 deletions(-)
       ---
   DIR diff --git a/TODO b/TODO
       t@@ -1 +1,5 @@
       -Proper path handling (allow paths including "'", etc.)
       +* Proper path handling (allow paths including "'", etc.)
       +* Double-buffering
       +* Draw pixmap on exposure events instead of doing the
       +  expensive image resizing each time (goes hand-in-hand
       +  with double-buffering)
   DIR diff --git a/croptool.1 b/croptool.1
       t@@ -88,7 +88,7 @@ Switch the color of the cropping rectangle between the primary and secondary col
        .It DELETE
        Delete the cropping rectangle of the current image.
        .It SPACE
       -Redraw the window. This is useful when automatic resizing is disabled with
       +Redraw the window. This is useful when automatic redrawing is disabled with
        .Fl m .
        .El
        .Sh MOUSE ACTIONS
   DIR diff --git a/croptool.c b/croptool.c
       t@@ -805,7 +805,7 @@ next_picture(int copy_box) {
                /* loop until we find a loadable file */
                while (!tmp_image && tmp_cur_selection + 1 < state.num_files) {
                        tmp_cur_selection++;
       -                tmp_image = imlib_load_image(state.filenames[tmp_cur_selection]);
       +                tmp_image = imlib_load_image_immediately(state.filenames[tmp_cur_selection]);
                        if (!tmp_image) {
                                fprintf(stderr, "Warning: Unable to load image '%s'.\n",
                                    state.filenames[tmp_cur_selection]);
       t@@ -831,7 +831,7 @@ last_picture(void) {
                /* loop until we find a loadable file */
                while (!tmp_image && tmp_cur_selection > 0) {
                        tmp_cur_selection--;
       -                tmp_image = imlib_load_image(state.filenames[tmp_cur_selection]);
       +                tmp_image = imlib_load_image_immediately(state.filenames[tmp_cur_selection]);
                        if (!tmp_image) {
                                fprintf(stderr, "Warning: Unable to load image '%s'.\n",
                                    state.filenames[tmp_cur_selection]);
   DIR diff --git a/croptool_crop.c b/croptool_crop.c
       t@@ -31,6 +31,7 @@ main(int argc, char *argv[]) {
                        fprintf(stderr, "USAGE: croptool_crop WIDTHxHEIGHT+X+Y FILENAME\n");
                        exit(1);
                }
       +        /* FIXME: proper error checking for this (don't use sscanf) */
                if (sscanf(argv[1], "%dx%d+%d+%d", &w, &h, &x, &y) < 4) {
                        fprintf(stderr, "Invalid cropping rectangle specified.\n");
                        exit(1);