summaryrefslogtreecommitdiff
path: root/jcmaster.c
diff options
context:
space:
mode:
authorDRC <information@libjpeg-turbo.org>2016-03-16 07:10:35 -0500
committerDRC <information@libjpeg-turbo.org>2016-03-16 07:14:19 -0500
commit6f241d4d425296badbf6b4f9477fbc3cace5a8fc (patch)
tree0b0173cf448ad81d391aec89d265cc4e1608f3a5 /jcmaster.c
parenta572622dd654305c86585724c2a1ea34e22c2103 (diff)
Add version/build info to global string table
This is a common practice in other infrastructure libraries, such as OpenSSL and libpng, because it makes it easy to examine an application binary and determine which version of the library the application was linked against. Closes #66
Diffstat (limited to 'jcmaster.c')
-rw-r--r--jcmaster.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/jcmaster.c b/jcmaster.c
index ea13d0d..dca02d2 100644
--- a/jcmaster.c
+++ b/jcmaster.c
@@ -5,7 +5,7 @@
* Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2003-2010 by Guido Vollbeding.
* libjpeg-turbo Modifications:
- * Copyright (C) 2010, D. R. Commander.
+ * Copyright (C) 2010, 2016, D. R. Commander.
* For conditions of distribution and use, see the accompanying README file.
*
* This file contains master control logic for the JPEG compressor.
@@ -18,6 +18,7 @@
#include "jinclude.h"
#include "jpeglib.h"
#include "jpegcomp.h"
+#include "jconfigint.h"
/* Private state */
@@ -37,6 +38,16 @@ typedef struct {
int total_passes; /* total # of passes needed */
int scan_number; /* current index in scan_info[] */
+
+ /*
+ * This is here so we can add libjpeg-turbo version/build information to the
+ * global string table without introducing a new global symbol. Adding this
+ * information to the global string table allows one to examine a binary
+ * object and determine which version of libjpeg-turbo it was built from or
+ * linked against.
+ */
+ const char *jpeg_version;
+
} my_comp_master;
typedef my_comp_master * my_master_ptr;
@@ -622,4 +633,6 @@ jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only)
master->total_passes = cinfo->num_scans * 2;
else
master->total_passes = cinfo->num_scans;
+
+ master->jpeg_version = PACKAGE_NAME " version " VERSION " (build " BUILD ")";
}