Skip to content

Commit 6f241d4

Browse files
committed
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 flutter#66
1 parent a572622 commit 6f241d4

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

ChangeLog.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ with the -yuv option.
2525
[4] Fixed an issue whereby a malformed motion-JPEG frame could cause the "fast
2626
path" of libjpeg-turbo's Huffman decoder to read from uninitialized memory.
2727

28+
[5] Added libjpeg-turbo version and build information to the global string
29+
table of the libjpeg and TurboJPEG API libraries. This is a common practice in
30+
other infrastructure libraries, such as OpenSSL and libpng, because it makes it
31+
easy to examine an application binary and determine which version of the
32+
library the application was linked against.
33+
2834

2935
1.4.2
3036
=====

jcmaster.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright (C) 1991-1997, Thomas G. Lane.
66
* Modified 2003-2010 by Guido Vollbeding.
77
* libjpeg-turbo Modifications:
8-
* Copyright (C) 2010, D. R. Commander.
8+
* Copyright (C) 2010, 2016, D. R. Commander.
99
* For conditions of distribution and use, see the accompanying README file.
1010
*
1111
* This file contains master control logic for the JPEG compressor.
@@ -18,6 +18,7 @@
1818
#include "jinclude.h"
1919
#include "jpeglib.h"
2020
#include "jpegcomp.h"
21+
#include "jconfigint.h"
2122

2223

2324
/* Private state */
@@ -37,6 +38,16 @@ typedef struct {
3738
int total_passes; /* total # of passes needed */
3839

3940
int scan_number; /* current index in scan_info[] */
41+
42+
/*
43+
* This is here so we can add libjpeg-turbo version/build information to the
44+
* global string table without introducing a new global symbol. Adding this
45+
* information to the global string table allows one to examine a binary
46+
* object and determine which version of libjpeg-turbo it was built from or
47+
* linked against.
48+
*/
49+
const char *jpeg_version;
50+
4051
} my_comp_master;
4152

4253
typedef my_comp_master * my_master_ptr;
@@ -622,4 +633,6 @@ jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only)
622633
master->total_passes = cinfo->num_scans * 2;
623634
else
624635
master->total_passes = cinfo->num_scans;
636+
637+
master->jpeg_version = PACKAGE_NAME " version " VERSION " (build " BUILD ")";
625638
}

0 commit comments

Comments
 (0)