summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-09-29 16:34:37 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-09-29 16:34:37 +0200
commit7281c129a9bf11594179a768aa34213fe69e98ed (patch)
treea67bf0e25018c8a79096f499246e279fcc07dd19
parent88c1d182b11c442cf8c0930e682b7ad571e9212d (diff)
feh_printf: Check feh_file_info_load return status
-rw-r--r--src/filelist.c9
-rw-r--r--src/slideshow.c20
2 files changed, 9 insertions, 20 deletions
diff --git a/src/filelist.c b/src/filelist.c
index 215f371..23239f9 100644
--- a/src/filelist.c
+++ b/src/filelist.c
@@ -321,11 +321,10 @@ int feh_file_info_load(feh_file * file, Imlib_Image im)
if (im)
im1 = im;
- else if (!feh_load_image(&im1, file))
- return(1);
-
- if (!im1)
+ else if (!feh_load_image(&im1, file) || !im1) {
+ weprintf("couldn't load %s", file->filename);
return(1);
+ }
file->info = feh_file_info_new();
@@ -340,7 +339,7 @@ int feh_file_info_load(feh_file * file, Imlib_Image im)
file->info->size = st.st_size;
- if (need_free && im1)
+ if (need_free)
gib_imlib_free_image_and_decache(im1);
return(0);
}
diff --git a/src/slideshow.c b/src/slideshow.c
index e6ffb56..52ef4b3 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -402,41 +402,31 @@ char *feh_printf(char *str, feh_file * file)
strcat(ret, file->name);
break;
case 'w':
- if (file) {
- if (!file->info)
- feh_file_info_load(file, NULL);
+ if (file && (file->info || !feh_file_info_load(file, NULL))) {
snprintf(buf, sizeof(buf), "%d", file->info->width);
strcat(ret, buf);
}
break;
case 'h':
- if (file) {
- if (!file->info)
- feh_file_info_load(file, NULL);
+ if (file && (file->info || !feh_file_info_load(file, NULL))) {
snprintf(buf, sizeof(buf), "%d", file->info->height);
strcat(ret, buf);
}
break;
case 's':
- if (file) {
- if (!file->info)
- feh_file_info_load(file, NULL);
+ if (file && (file->info || !feh_file_info_load(file, NULL))) {
snprintf(buf, sizeof(buf), "%d", file->info->size);
strcat(ret, buf);
}
break;
case 'p':
- if (file) {
- if (!file->info)
- feh_file_info_load(file, NULL);
+ if (file && (file->info || !feh_file_info_load(file, NULL))) {
snprintf(buf, sizeof(buf), "%d", file->info->pixels);
strcat(ret, buf);
}
break;
case 't':
- if (file) {
- if (!file->info)
- feh_file_info_load(file, NULL);
+ if (file && (file->info || !feh_file_info_load(file, NULL))) {
strcat(ret, file->info->format);
}
break;