From 2d27a01e6de4ca89b1ffb321f0157f30aadb1174 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 17 Apr 2014 00:47:18 +0000 Subject: [PATCH 1/2] Fix warnings about unused variables when building with GCC 4.8.x git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.3.x@1242 632fc199-4ca6-4c93-a231-07263d6284db --- tjbench.c | 16 ++++++++-------- turbojpeg.c | 20 +++++++++++++++----- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/tjbench.c b/tjbench.c index f135da46..ebad24ea 100644 --- a/tjbench.c +++ b/tjbench.c @@ -217,7 +217,7 @@ int decomptest(unsigned char *srcbuf, unsigned char **jpegbuf, dstbuf[bindex]=abs(dstbuf[bindex]-y); } } - } + } else { for(row=0; rowcinfo; dinfo=&this->dinfo; +#define getcinstance(handle) tjinstance *this=(tjinstance *)handle; \ + j_compress_ptr cinfo=NULL; \ + if(!this) {snprintf(errStr, JMSG_LENGTH_MAX, "Invalid handle"); \ + return -1;} \ + cinfo=&this->cinfo; +#define getdinstance(handle) tjinstance *this=(tjinstance *)handle; \ + j_decompress_ptr dinfo=NULL; \ + if(!this) {snprintf(errStr, JMSG_LENGTH_MAX, "Invalid handle"); \ + return -1;} \ + dinfo=&this->dinfo; static int getPixelFormat(int pixelSize, int flags) { @@ -580,7 +590,7 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf, unsigned char *rgbBuf=NULL; #endif - getinstance(handle) + getcinstance(handle) if((this->init&COMPRESS)==0) _throw("tjCompress2(): Instance has not been initialized for compression"); @@ -685,7 +695,7 @@ DLLEXPORT int DLLCALL tjEncodeYUV2(tjhandle handle, unsigned char *srcBuf, unsigned char *rgbBuf=NULL; #endif - getinstance(handle); + getcinstance(handle); for(i=0; iinit&DECOMPRESS)==0) _throw("tjDecompressHeader2(): Instance has not been initialized for decompression"); @@ -947,7 +957,7 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, unsigned char *jpegBuf, unsigned char *_dstBuf=NULL; int _pitch=0; #endif - getinstance(handle); + getdinstance(handle); if((this->init&DECOMPRESS)==0) _throw("tjDecompress2(): Instance has not been initialized for decompression"); @@ -1058,7 +1068,7 @@ DLLEXPORT int DLLCALL tjDecompressToYUV(tjhandle handle, tmpbufsize=0, usetmpbuf=0, th[MAX_COMPONENTS]; JSAMPLE *_tmpbuf=NULL, *ptr=dstBuf; JSAMPROW *tmpbuf[MAX_COMPONENTS]; - getinstance(handle); + getdinstance(handle); for(i=0; i Date: Fri, 18 Apr 2014 02:46:59 +0000 Subject: [PATCH 2/2] Update Windows build instructions git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.3.x@1246 632fc199-4ca6-4c93-a231-07263d6284db --- BUILDING.txt | 45 +++++++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/BUILDING.txt b/BUILDING.txt index 9dcc07fe..ba35b278 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -409,7 +409,7 @@ infer tagged configuration." Build Requirements ================== --- CMake (http://www.cmake.org) v2.6 or later +-- CMake (http://www.cmake.org) v2.8.8 or later -- Microsoft Visual C++ 2005 or later @@ -421,8 +421,9 @@ Build Requirements The Windows SDK includes both 32-bit and 64-bit Visual C++ compilers and everything necessary to build libjpeg-turbo. - * For 32-bit builds, you can also use Microsoft Visual C++ Express - Edition. Visual C++ Express Edition is a free download. + * You can also use Microsoft Visual Studio Express Edition, which is a free + download. (NOTE: versions prior to 2012 can only be used to build 32-bit + code.) * If you intend to build libjpeg-turbo from the command line, then add the appropriate compiler and SDK directories to the INCLUDE, LIB, and PATH environment variables. This is generally accomplished by executing @@ -436,7 +437,11 @@ Build Requirements -- MinGW - GCC v4.1 or later recommended for best performance + MinGW-builds (http://sourceforge.net/projects/mingwbuilds/) or + tdm-gcc (http://tdm-gcc.tdragon.net/) recommended if building on a Windows + machine. Both distributions install a Start Menu link that can be used to + launch a command prompt with the appropriate compiler paths automatically + set. -- NASM (http://www.nasm.us/) 0.98 or later (NASM 2.05 or later is required for a 64-bit build) @@ -501,7 +506,7 @@ Choose the appropriate CMake generator option for your version of Visual Studio instance: cd {build_directory} - cmake -G "Visual Studio 9 2008" {source_directory} + cmake -G "Visual Studio 10" {source_directory} You can then open ALL_BUILD.vcproj in Visual Studio and build one of the configurations in that project ("Debug", "Release", etc.) to generate a full @@ -530,9 +535,12 @@ depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled. MinGW ----- +NOTE: This assumes that you are building on a Windows machine. If you are +cross-compiling on a Linux/Unix machine, then see "Build Recipes" below. + cd {build_directory} - cmake -G "MSYS Makefiles" {source_directory} - make + cmake -G "MinGW Makefiles" {source_directory} + mingw32-make This will generate the following files under {build_directory} @@ -641,8 +649,8 @@ Build Recipes cd {build_directory} CC=/usr/bin/x86_64-w64-mingw32-gcc \ cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \ - -DCMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar \ - -DCMAKE_RANLIB=/usr/bin/x86_64-w64-mingw32-ranlib {source_directory} + -DCMAKE_RC_COMPILER=/usr/bin/x86_64-w64-mingw32-windres.exe \ + {source_directory} make This produces a 64-bit build of libjpeg-turbo that does not depend on @@ -656,8 +664,8 @@ mingw64-x86_64-gcc-g++ packages (and their dependencies) must be installed. cd {build_directory} CC=/usr/bin/i686-w64-mingw32-gcc \ cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \ - -DDCMAKE_AR=/usr/bin/i686-w64-mingw32-ar \ - -DCMAKE_RANLIB=/usr/bin/i686-w64-mingw32-ranlib {source_directory} + -DCMAKE_RC_COMPILER=/usr/bin/i686-w64-mingw32-windres.exe \ + {source_directory} make This produces a 32-bit build of libjpeg-turbo that does not depend on @@ -665,21 +673,6 @@ cygwin1.dll or other Cygwin DLL's. The mingw64-i686-gcc-core and mingw64-i686-gcc-g++ packages (and their dependencies) must be installed. -MinGW-w64 Build on Windows --------------------------- - -This produces a 64-bit build of libjpeg-turbo using the "native" MinGW-w64 -toolchain (which is faster than the Cygwin version): - - cd {build_directory} - CC={mingw-w64_binary_path}/x86_64-w64-mingw32-gcc \ - cmake -G "MSYS Makefiles" \ - -DCMAKE_AR={mingw-w64_binary_path}/x86_64-w64-mingw32-ar \ - -DCMAKE_RANLIB={mingw-w64_binary_path}/x86_64-w64-mingw32-ranlib \ - {source_directory} - make - - MinGW Build on Linux --------------------