Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

init: fix cases where JPEG_LIB_VERSION_MAJOR/MINOR are not defined

First fall back to trying to use JPEG_LIB_VERSION.
Then if that's not available, then set them both to 0.

Fixes #202.
  • Loading branch information...
commit 718e868682bdde47179fcd0b6dc819409eaec8cb 1 parent a7615ce
@TooTallNate TooTallNate authored
Showing with 16 additions and 3 deletions.
  1. +16 −3 src/init.cc
View
19 src/init.cc
@@ -28,14 +28,27 @@ init (Handle<Object> target) {
#ifdef HAVE_JPEG
#ifndef JPEG_LIB_VERSION_MAJOR
-#define JPEG_LIB_VERSION_MAJOR 8
+#ifdef JPEG_LIB_VERSION
+#define JPEG_LIB_VERSION_MAJOR (JPEG_LIB_VERSION / 10)
+#else
+#define JPEG_LIB_VERSION_MAJOR 0
#endif
+#endif
+
#ifndef JPEG_LIB_VERSION_MINOR
-#define JPEG_LIB_VERSION_MINOR 4
+#ifdef JPEG_LIB_VERSION
+#define JPEG_LIB_VERSION_MINOR (JPEG_LIB_VERSION % 10)
+#else
+#define JPEG_LIB_VERSION_MINOR 0
+#endif
#endif
char jpeg_version[10];
- snprintf(jpeg_version, 10, "%d%c", JPEG_LIB_VERSION_MAJOR, JPEG_LIB_VERSION_MINOR + 'a' - 1);
+ if (JPEG_LIB_VERSION_MINOR > 0) {
+ snprintf(jpeg_version, 10, "%d%c", JPEG_LIB_VERSION_MAJOR, JPEG_LIB_VERSION_MINOR + 'a' - 1);
+ } else {
+ snprintf(jpeg_version, 10, "%d", JPEG_LIB_VERSION_MAJOR);
+ }
target->Set(String::New("jpegVersion"), String::New(jpeg_version));
#endif
#ifdef HAVE_GIF
Please sign in to comment.
Something went wrong with that request. Please try again.