From 9b4341e12c6be32b654478cdf3a4e8a631c4e31f Mon Sep 17 00:00:00 2001 From: Niclas Zeising Date: Mon, 25 Sep 2017 18:54:24 +0200 Subject: Remove unused variable --- src/imlib.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/imlib.c b/src/imlib.c index 71b0a81..290ec8f 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -207,10 +207,6 @@ int feh_load_image(Imlib_Image * im, feh_file * file) char *tmpname = NULL; char *real_filename = NULL; -#ifdef HAVE_LIBEXIF - ExifEntry *entry; -#endif - D(("filename is %s, image is %p\n", file->filename, im)); if (!file || !file->filename) -- cgit v1.2.3 From f49f0879e651d8c92468f232febe143db2cbcd36 Mon Sep 17 00:00:00 2001 From: Niclas Zeising Date: Tue, 26 Sep 2017 21:34:56 +0200 Subject: Fix dead code The check if buffer == NULL is always false, since buffer is an autoamtic variable allocated when entering the function. What we instead want to do is to check if the string is empty after the call to exif_get_info(), since that means we could not read any exif information. When the code once more is enabled, I discovered that we need to copy the information string into info_buf as well as into buffer, since it is the former that is used to print the exif information on top of the picture. Without this change, imlib warns about trying to write NULL strings. --- src/imlib.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/imlib.c b/src/imlib.c index 290ec8f..dfb79aa 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -679,11 +679,12 @@ void feh_draw_exif(winwidget w) fn = feh_load_font(w); - if (buffer == NULL) + if (buffer[0] == '\0') { snprintf(buffer, EXIF_MAX_DATA, "%s", estrdup("Failed to run exif command")); - gib_imlib_get_text_size(fn, &buffer[0], NULL, &width, &height, IMLIB_TEXT_TO_RIGHT); - no_lines = 1; + gib_imlib_get_text_size(fn, buffer, NULL, &width, &height, IMLIB_TEXT_TO_RIGHT); + info_buf[no_lines] = estrdup(buffer); + no_lines++; } else { -- cgit v1.2.3