Skip to content

Commit

Permalink
Fix cases where GIF_LIB_VERSION is not defined
Browse files Browse the repository at this point in the history
Versions up to 4.1.6 of GIFLIB defined a GIF_LIB_VERSION macro that was string-valued.
Versions after 4.1.6 define integer-valued GIFLIB_MAJOR, GIFLIB_MINOR, and GIFLIB_RELEASE macros for the three components of the version.

Check for GIF_LIB_VERSION, otherwise use the new macros.
  • Loading branch information
lpinca committed Aug 14, 2012
1 parent 19bcf35 commit 25234db
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/init.cc
Expand Up @@ -51,9 +51,16 @@ init (Handle<Object> target) {
}
target->Set(String::New("jpegVersion"), String::New(jpeg_version));
#endif

#ifdef HAVE_GIF
#ifndef GIF_LIB_VERSION
char gif_version[10];
snprintf(gif_version, 10, "%d.%d.%d", GIFLIB_MAJOR, GIFLIB_MINOR, GIFLIB_RELEASE);
target->Set(String::New("gifVersion"), String::New(gif_version));
#else
target->Set(String::New("gifVersion"), String::New(GIF_LIB_VERSION));
#endif
#endif
}

NODE_MODULE(canvas,init);

0 comments on commit 25234db

Please sign in to comment.