Skip to content

Commit

Permalink
Add version/build info to global string table
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dcommander committed Mar 16, 2016
1 parent a572622 commit 6f241d4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
6 changes: 6 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ with the -yuv option.
[4] Fixed an issue whereby a malformed motion-JPEG frame could cause the "fast
path" of libjpeg-turbo's Huffman decoder to read from uninitialized memory.

[5] Added libjpeg-turbo version and build information to the global string
table of the libjpeg and TurboJPEG API libraries. 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.


1.4.2
=====
Expand Down
15 changes: 14 additions & 1 deletion jcmaster.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -18,6 +18,7 @@
#include "jinclude.h"
#include "jpeglib.h"
#include "jpegcomp.h"
#include "jconfigint.h"


/* Private state */
Expand All @@ -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;
Expand Down Expand Up @@ -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 ")";
}

0 comments on commit 6f241d4

Please sign in to comment.