diff options
author | Sven Willner <sven.willner@gmail.com> | 2018-09-13 15:47:18 +0200 |
---|---|---|
committer | Sven Willner <sven.willner@gmail.com> | 2018-09-13 15:47:18 +0200 |
commit | 4ca5b177bbaf656611dd253d7c8e37317b5b186f (patch) | |
tree | 5f66934df56dfcbe11364bda57899d078511c3c8 /src/feh_png.c | |
parent | 3671b53046afbeced26162fc413fcfb7971116b9 (diff) | |
parent | 9241e8faa78cc02c08537ed0bd7b236d172c3ed7 (diff) |
Merge branch 'master' of github.com:derf/feh
Diffstat (limited to 'src/feh_png.c')
-rw-r--r-- | src/feh_png.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/feh_png.c b/src/feh_png.c index ff73f56..d0c1c8a 100644 --- a/src/feh_png.c +++ b/src/feh_png.c @@ -23,20 +23,18 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "feh_png.h" - #include <png.h> #include <stdio.h> #include <stdarg.h> +#include "feh_png.h" + #define FEH_PNG_COMPRESSION 3 #define FEH_PNG_NUM_COMMENTS 4 gib_hash *feh_png_read_comments(char *file) { - gib_hash *hash = NULL; - FILE *fp; int i, sig_bytes, comments = 0; @@ -45,31 +43,31 @@ gib_hash *feh_png_read_comments(char *file) png_textp text_ptr; if (!(fp = fopen(file, "rb"))) - return hash; + return NULL; if (!(sig_bytes = feh_png_file_is_png(fp))) { fclose(fp); - return hash; + return NULL; } /* initialize data structures */ png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (!png_ptr) { fclose(fp); - return hash; + return NULL; } info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { png_destroy_read_struct(&png_ptr, (png_infopp) NULL, (png_infopp) NULL); fclose(fp); - return hash; + return NULL; } if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_read_struct(&png_ptr, &info_ptr, NULL); fclose(fp); - return hash; + return NULL; } /* initialize reading */ @@ -78,6 +76,8 @@ gib_hash *feh_png_read_comments(char *file) png_read_info(png_ptr, info_ptr); + gib_hash *hash = NULL; + #ifdef PNG_TEXT_SUPPORTED png_get_text(png_ptr, info_ptr, &text_ptr, &comments); if (comments > 0) { |