Skip to content

Commit

Permalink
Bug fix #44: giflib-5.1.0 compatibility
Browse files Browse the repository at this point in the history
Fix giflib-5.1.0 compatibility. Thanks to devsnd for patch. (#44)
  • Loading branch information
richardgv committed Jun 18, 2014
1 parent d68546b commit 998e0e7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/img-gif.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
#define SGIF_THREADSAFE
#endif

// More thread-safe error flag on >=giflib-5.1
#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5 && defined(GIFLIB_MINOR) && GIFLIB_MINOR >= 1
#define SGIF_THREADSAFE_510
#endif

pictw_t *
sgif_read(session_t *ps, const char *path) {
assert(path);
Expand Down Expand Up @@ -145,8 +150,14 @@ sgif_read(session_t *ps, const char *path) {
sgif_read_end:
if (data)
free(data);
if (likely(f))
if (likely(f)) {
#ifdef SGIF_THREADSAFE_510
int error_code = 0;
DGifCloseFile(f, &error_code);
#else
DGifCloseFile(f);
#endif
}

return pictw;
}

0 comments on commit 998e0e7

Please sign in to comment.