File unbundle.patch of Package freeimage
---
Makefile.fip | 20 ++---
Makefile.gnu | 16 +---
Source/FreeImage.h | 21 ++++-
Source/FreeImage/J2KHelper.cpp | 2
Source/FreeImage/PSDParser.cpp | 18 ++--
Source/FreeImage/Plugin.cpp | 2
Source/FreeImage/PluginEXR.cpp | 20 ++---
Source/FreeImage/PluginJ2K.cpp | 2
Source/FreeImage/PluginJP2.cpp | 2
Source/FreeImage/PluginJPEG.cpp | 116 ------------------------------
Source/FreeImage/PluginJXR.cpp | 3
Source/FreeImage/PluginPNG.cpp | 4 -
Source/FreeImage/PluginRAW.cpp | 2
Source/FreeImage/PluginWebP.cpp | 6 -
Source/FreeImage/ZLibInterface.cpp | 5 -
Source/FreeImageToolkit/JPEGTransform.cpp | 8 +-
Source/Metadata/TagConversion.cpp | 5 +
Source/Utilities.h | 4 -
genfipsrclist.sh | 3
gensrclist.sh | 2
20 files changed, 83 insertions(+), 178 deletions(-)
Index: freeimage-3.18.0.1909/Makefile.fip
===================================================================
--- freeimage-3.18.0.1909.orig/Makefile.fip
+++ freeimage-3.18.0.1909/Makefile.fip
@@ -19,22 +19,24 @@ MODULES := $(MODULES:.cpp=.o)
# C flags
CFLAGS ?= -std=c99 -O3 -fPIC -fexceptions -fvisibility=hidden
# OpenJPEG
-CFLAGS += -DOPJ_STATIC
+override CFLAGS += -DOPJ_STATIC
# LibRaw
-CFLAGS += -DNO_LCMS
+override CFLAGS += -DNO_LCMS
# LibJXR
-CFLAGS += -DDISABLE_PERF_MEASUREMENT -D__ANSI__
-CFLAGS += $(INCLUDE)
+override CFLAGS += -DDISABLE_PERF_MEASUREMENT -D__ANSI__
+override CFLAGS += $(INCLUDE)
# C++ flags
CXXFLAGS ?= -std=c++0x -O3 -fPIC -fexceptions -fvisibility=hidden -Wno-ctor-dtor-privacy
# LibJXR
-CXXFLAGS += -D__ANSI__
-CXXFLAGS += $(INCLUDE)
+override CXXFLAGS += -D__ANSI__
+override CXXFLAGS += $(INCLUDE)
+LDFLAGS ?=
+override LDFLAGS += -LDist -lfreeimage-$(VER_MAJOR).$(VER_MINOR)
ifeq ($(shell sh -c 'uname -m 2>/dev/null || echo not'),x86_64)
- CFLAGS += -fPIC
- CXXFLAGS += -fPIC
+ override CFLAGS += -fPIC
+ override CXXFLAGS += -fPIC
endif
TARGET = freeimageplus
@@ -72,7 +74,7 @@ $(STATICLIB): $(MODULES)
$(AR) r $@ $(MODULES)
$(SHAREDLIB): $(MODULES)
- $(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
+ $(CC) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
install:
install -d $(INCDIR) $(INSTALLDIR)
Index: freeimage-3.18.0.1909/Makefile.gnu
===================================================================
--- freeimage-3.18.0.1909.orig/Makefile.gnu
+++ freeimage-3.18.0.1909/Makefile.gnu
@@ -18,13 +18,8 @@ MODULES := $(MODULES:.cpp=.o)
# C flags
CFLAGS ?= -std=c99 -O3 -fPIC -fexceptions -fvisibility=hidden
-# OpenJPEG
-CFLAGS += -DOPJ_STATIC
-# LibRaw
-CFLAGS += -DNO_LCMS
-# LibJXR
-CFLAGS += -DDISABLE_PERF_MEASUREMENT -D__ANSI__
-CFLAGS += $(INCLUDE)
+override CFLAGS += $(INCLUDE) -D__ANSI__ -I/usr/include/jxrlib $(shell pkg-config --cflags OpenEXR libopenjp2 libraw libpng libtiff-4 libwebp libwebpmux zlib)
+override LDFLAGS += -ljpeg -ljpegxr -ljxrglue $(shell pkg-config --libs OpenEXR libopenjp2 libraw libpng libtiff-4 libwebp libwebpmux zlib)
# C++ flags
CXXFLAGS ?= -std=c++0x -O3 -fPIC -fexceptions -fvisibility=hidden -Wno-ctor-dtor-privacy
@@ -33,8 +28,7 @@ CXXFLAGS += -D__ANSI__
CXXFLAGS += $(INCLUDE)
ifeq ($(shell sh -c 'uname -m 2>/dev/null || echo not'),x86_64)
- CFLAGS += -fPIC
- CXXFLAGS += -fPIC
+ override CFLAGS += -fPIC
endif
TARGET = freeimage
@@ -65,13 +59,13 @@ FreeImage: $(STATICLIB) $(SHAREDLIB)
$(CC) $(CFLAGS) -c $< -o $@
.cpp.o:
- $(CXX) $(CXXFLAGS) -c $< -o $@
+ $(CXX) $(CFLAGS) -c $< -o $@
$(STATICLIB): $(MODULES)
$(AR) r $@ $(MODULES)
$(SHAREDLIB): $(MODULES)
- $(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
+ $(CC) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
install:
install -d $(INCDIR) $(INSTALLDIR)
Index: freeimage-3.18.0.1909/Source/FreeImage.h
===================================================================
--- freeimage-3.18.0.1909.orig/Source/FreeImage.h
+++ freeimage-3.18.0.1909/Source/FreeImage.h
@@ -155,8 +155,11 @@ typedef uint8_t BYTE;
typedef uint16_t WORD;
typedef uint32_t DWORD;
typedef int32_t LONG;
+// Disable these, they conflict with the (wrong) ones of libraw
+#if 0
typedef int64_t INT64;
typedef uint64_t UINT64;
+#endif
#else
// MS is not C99 ISO compliant
typedef long BOOL;
@@ -410,7 +413,12 @@ FI_ENUM(FREE_IMAGE_FORMAT) {
FIF_DDS = 24,
FIF_GIF = 25,
FIF_HDR = 26,
- FIF_FAXG3 = 27,
+/* The G3 fax format plugin is deliberately disabled in the Fedora build of
+ FreeImage as it requires that FreeImage uses a private copy of libtiff
+ which is a no no because of security reasons. */
+#if 0
+ FIF_FAXG3 = 27,
+#endif
FIF_SGI = 28,
FIF_EXR = 29,
FIF_J2K = 30,
@@ -473,6 +481,10 @@ FI_ENUM(FREE_IMAGE_DITHER) {
FID_BAYER16x16 = 6 //! Bayer ordered dispersed dot dithering (order 4 dithering matrix)
};
+/* The FreeImage_JPEGTransform functions are deliberately disabled in the
+ Fedora build of FreeImage as they require that FreeImage uses a private copy
+ of libjpeg which is a no no because of security reasons. */
+#if 0
/** Lossless JPEG transformations
Constants used in FreeImage_JPEGTransform
*/
@@ -486,6 +498,7 @@ FI_ENUM(FREE_IMAGE_JPEG_OPERATION) {
FIJPEG_OP_ROTATE_180 = 6, //! 180-degree rotation
FIJPEG_OP_ROTATE_270 = 7 //! 270-degree clockwise (or 90 ccw)
};
+#endif
/** Tone mapping operators.
Constants used in FreeImage_ToneMapping.
@@ -1088,7 +1101,10 @@ DLL_API const char* DLL_CALLCONV FreeIma
// --------------------------------------------------------------------------
// JPEG lossless transformation routines
// --------------------------------------------------------------------------
-
+/* The FreeImage_JPEGTransform functions are deliberately disabled in the
++ Fedora build of FreeImage as they require that FreeImage uses a private copy
++ of libjpeg which is a no no because of security reasons. */
+#if 0
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransform(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(TRUE));
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(TRUE));
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCrop(const char *src_file, const char *dst_file, int left, int top, int right, int bottom);
@@ -1097,6 +1113,7 @@ DLL_API BOOL DLL_CALLCONV FreeImage_JPEG
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombined(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombinedU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombinedFromMemory(FIMEMORY* src_stream, FIMEMORY* dst_stream, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
+#endif
// --------------------------------------------------------------------------
Index: freeimage-3.18.0.1909/Source/FreeImage/J2KHelper.cpp
===================================================================
--- freeimage-3.18.0.1909.orig/Source/FreeImage/J2KHelper.cpp
+++ freeimage-3.18.0.1909/Source/FreeImage/J2KHelper.cpp
@@ -21,7 +21,7 @@
#include "FreeImage.h"
#include "Utilities.h"
-#include "../LibOpenJPEG/openjpeg.h"
+#include <openjpeg.h>
#include "J2KHelper.h"
// --------------------------------------------------------------------------
Index: freeimage-3.18.0.1909/Source/FreeImage/PSDParser.cpp
===================================================================
--- freeimage-3.18.0.1909.orig/Source/FreeImage/PSDParser.cpp
+++ freeimage-3.18.0.1909/Source/FreeImage/PSDParser.cpp
@@ -133,8 +133,8 @@ public:
template <>
class PSDGetValue<8> {
public:
- static inline UINT64 get(const BYTE * iprBuffer) {
- UINT64 v = ((const UINT64*)iprBuffer)[0];
+ static inline uint64_t get(const BYTE * iprBuffer) {
+ uint64_t v = ((const uint64_t*)iprBuffer)[0];
#ifndef FREEIMAGE_BIGENDIAN
SwapInt64(&v);
#endif
@@ -147,7 +147,7 @@ public:
// --------------------------------------------------------------------------
-static UINT64
+static uint64_t
psdReadSize(FreeImageIO *io, fi_handle handle, const psdHeaderInfo& header) {
if(header._Version == 1) {
BYTE Length[4];
@@ -199,11 +199,11 @@ public:
template <>
class PSDSetValue<8> {
public:
- static inline void set(const BYTE * iprBuffer, UINT64 v) {
+ static inline void set(const BYTE * iprBuffer, uint64_t v) {
#ifndef FREEIMAGE_BIGENDIAN
SwapInt64(&v);
#endif
- ((UINT64*)iprBuffer)[0] = v;
+ ((uint64_t*)iprBuffer)[0] = v;
}
};
@@ -213,7 +213,7 @@ public:
// --------------------------------------------------------------------------
static inline bool
-psdWriteSize(FreeImageIO *io, fi_handle handle, const psdHeaderInfo& header, UINT64 v) {
+psdWriteSize(FreeImageIO *io, fi_handle handle, const psdHeaderInfo& header, uint64_t v) {
if(header._Version == 1) {
BYTE Length[4];
psdSetLongValue(Length, sizeof(Length), (DWORD)v);
@@ -1063,10 +1063,10 @@ unsigned psdParser::GetChannelOffset(FIB
bool psdParser::ReadLayerAndMaskInfoSection(FreeImageIO *io, fi_handle handle) {
bool bSuccess = true;
- UINT64 nTotalBytes = psdReadSize(io, handle, _headerInfo);
+ uint64_t nTotalBytes = psdReadSize(io, handle, _headerInfo);
// Hack to handle large PSB files without using fseeko().
- if (sizeof(long) < sizeof(UINT64)) {
+ if (sizeof(long) < sizeof(uint64_t)) {
const long offset = 0x10000000;
while (nTotalBytes > offset) {
if (io->seek_proc(handle, offset, SEEK_CUR) != 0) {
@@ -1672,7 +1672,7 @@ bool psdParser::WriteLayerAndMaskInfoSec
// Short section with no layers.
BYTE IntValue[4];
- UINT64 size;
+ uint64_t size;
if(_headerInfo._Version == 1) {
size = 8;
} else {
Index: freeimage-3.18.0.1909/Source/FreeImage/Plugin.cpp
===================================================================
--- freeimage-3.18.0.1909.orig/Source/FreeImage/Plugin.cpp
+++ freeimage-3.18.0.1909/Source/FreeImage/Plugin.cpp
@@ -255,7 +255,6 @@ FreeImage_Initialise(BOOL load_local_plu
s_plugins->AddNode(InitPNM, NULL, "PPMRAW", "Portable Pixelmap (RAW)", "ppm", "^P6");
s_plugins->AddNode(InitRAS);
s_plugins->AddNode(InitTARGA);
- s_plugins->AddNode(InitTIFF);
s_plugins->AddNode(InitWBMP);
s_plugins->AddNode(InitPSD);
s_plugins->AddNode(InitCUT);
@@ -264,7 +263,6 @@ FreeImage_Initialise(BOOL load_local_plu
s_plugins->AddNode(InitDDS);
s_plugins->AddNode(InitGIF);
s_plugins->AddNode(InitHDR);
- s_plugins->AddNode(InitG3);
s_plugins->AddNode(InitSGI);
s_plugins->AddNode(InitEXR);
s_plugins->AddNode(InitJ2K);
Index: freeimage-3.18.0.1909/Source/FreeImage/PluginEXR.cpp
===================================================================
--- freeimage-3.18.0.1909.orig/Source/FreeImage/PluginEXR.cpp
+++ freeimage-3.18.0.1909/Source/FreeImage/PluginEXR.cpp
@@ -28,16 +28,16 @@
#pragma warning (disable : 4800) // ImfVersion.h - 'const int' : forcing value to bool 'true' or 'false' (performance warning)
#endif
-#include "../OpenEXR/IlmImf/ImfIO.h"
-#include "../OpenEXR/Iex/Iex.h"
-#include "../OpenEXR/IlmImf/ImfOutputFile.h"
-#include "../OpenEXR/IlmImf/ImfInputFile.h"
-#include "../OpenEXR/IlmImf/ImfRgbaFile.h"
-#include "../OpenEXR/IlmImf/ImfChannelList.h"
-#include "../OpenEXR/IlmImf/ImfRgba.h"
-#include "../OpenEXR/IlmImf/ImfArray.h"
-#include "../OpenEXR/IlmImf/ImfPreviewImage.h"
-#include "../OpenEXR/Half/half.h"
+#include <OpenEXR/ImfIO.h>
+#include <OpenEXR/Iex.h>
+#include <OpenEXR/ImfOutputFile.h>
+#include <OpenEXR/ImfInputFile.h>
+#include <OpenEXR/ImfRgbaFile.h>
+#include <OpenEXR/ImfChannelList.h>
+#include <OpenEXR/ImfRgba.h>
+#include <OpenEXR/ImfArray.h>
+#include <OpenEXR/ImfPreviewImage.h>
+#include <OpenEXR/half.h>
// ==========================================================
Index: freeimage-3.18.0.1909/Source/FreeImage/PluginJ2K.cpp
===================================================================
--- freeimage-3.18.0.1909.orig/Source/FreeImage/PluginJ2K.cpp
+++ freeimage-3.18.0.1909/Source/FreeImage/PluginJ2K.cpp
@@ -21,7 +21,7 @@
#include "FreeImage.h"
#include "Utilities.h"
-#include "../LibOpenJPEG/openjpeg.h"
+#include <openjpeg.h>
#include "J2KHelper.h"
// ==========================================================
Index: freeimage-3.18.0.1909/Source/FreeImage/PluginJP2.cpp
===================================================================
--- freeimage-3.18.0.1909.orig/Source/FreeImage/PluginJP2.cpp
+++ freeimage-3.18.0.1909/Source/FreeImage/PluginJP2.cpp
@@ -21,7 +21,7 @@
#include "FreeImage.h"
#include "Utilities.h"
-#include "../LibOpenJPEG/openjpeg.h"
+#include <openjpeg.h>
#include "J2KHelper.h"
// ==========================================================
Index: freeimage-3.18.0.1909/Source/FreeImage/PluginJPEG.cpp
===================================================================
--- freeimage-3.18.0.1909.orig/Source/FreeImage/PluginJPEG.cpp
+++ freeimage-3.18.0.1909/Source/FreeImage/PluginJPEG.cpp
@@ -35,9 +35,9 @@ extern "C" {
#undef FAR
#include <setjmp.h>
-#include "../LibJPEG/jinclude.h"
-#include "../LibJPEG/jpeglib.h"
-#include "../LibJPEG/jerror.h"
+#include <stdio.h>
+#include <jpeglib.h>
+#include <jerror.h>
}
#include "FreeImage.h"
@@ -485,116 +485,6 @@ marker_is_icc(jpeg_saved_marker_ptr mark
}
/**
- See if there was an ICC profile in the JPEG file being read;
- if so, reassemble and return the profile data.
-
- TRUE is returned if an ICC profile was found, FALSE if not.
- If TRUE is returned, *icc_data_ptr is set to point to the
- returned data, and *icc_data_len is set to its length.
-
- IMPORTANT: the data at **icc_data_ptr has been allocated with malloc()
- and must be freed by the caller with free() when the caller no longer
- needs it. (Alternatively, we could write this routine to use the
- IJG library's memory allocator, so that the data would be freed implicitly
- at jpeg_finish_decompress() time. But it seems likely that many apps
- will prefer to have the data stick around after decompression finishes.)
-
- NOTE: if the file contains invalid ICC APP2 markers, we just silently
- return FALSE. You might want to issue an error message instead.
-*/
-static BOOL
-jpeg_read_icc_profile(j_decompress_ptr cinfo, JOCTET **icc_data_ptr, unsigned *icc_data_len) {
- jpeg_saved_marker_ptr marker;
- int num_markers = 0;
- int seq_no;
- JOCTET *icc_data;
- unsigned total_length;
-
- const int MAX_SEQ_NO = 255; // sufficient since marker numbers are bytes
- BYTE marker_present[MAX_SEQ_NO+1]; // 1 if marker found
- unsigned data_length[MAX_SEQ_NO+1]; // size of profile data in marker
- unsigned data_offset[MAX_SEQ_NO+1]; // offset for data in marker
-
- *icc_data_ptr = NULL; // avoid confusion if FALSE return
- *icc_data_len = 0;
-
- /**
- this first pass over the saved markers discovers whether there are
- any ICC markers and verifies the consistency of the marker numbering.
- */
-
- memset(marker_present, 0, (MAX_SEQ_NO + 1));
-
- for(marker = cinfo->marker_list; marker != NULL; marker = marker->next) {
- if (marker_is_icc(marker)) {
- if (num_markers == 0) {
- // number of markers
- num_markers = GETJOCTET(marker->data[13]);
- }
- else if (num_markers != GETJOCTET(marker->data[13])) {
- return FALSE; // inconsistent num_markers fields
- }
- // sequence number
- seq_no = GETJOCTET(marker->data[12]);
- if (seq_no <= 0 || seq_no > num_markers) {
- return FALSE; // bogus sequence number
- }
- if (marker_present[seq_no]) {
- return FALSE; // duplicate sequence numbers
- }
- marker_present[seq_no] = 1;
- data_length[seq_no] = marker->data_length - ICC_HEADER_SIZE;
- }
- }
-
- if (num_markers == 0)
- return FALSE;
-
- /**
- check for missing markers, count total space needed,
- compute offset of each marker's part of the data.
- */
-
- total_length = 0;
- for(seq_no = 1; seq_no <= num_markers; seq_no++) {
- if (marker_present[seq_no] == 0) {
- return FALSE; // missing sequence number
- }
- data_offset[seq_no] = total_length;
- total_length += data_length[seq_no];
- }
-
- if (total_length <= 0)
- return FALSE; // found only empty markers ?
-
- // allocate space for assembled data
- icc_data = (JOCTET *) malloc(total_length * sizeof(JOCTET));
- if (icc_data == NULL)
- return FALSE; // out of memory
-
- // and fill it in
- for (marker = cinfo->marker_list; marker != NULL; marker = marker->next) {
- if (marker_is_icc(marker)) {
- JOCTET FAR *src_ptr;
- JOCTET *dst_ptr;
- unsigned length;
- seq_no = GETJOCTET(marker->data[12]);
- dst_ptr = icc_data + data_offset[seq_no];
- src_ptr = marker->data + ICC_HEADER_SIZE;
- length = data_length[seq_no];
- while (length--) {
- *dst_ptr++ = *src_ptr++;
- }
- }
- }
-
- *icc_data_ptr = icc_data;
- *icc_data_len = total_length;
-
- return TRUE;
-}
-
-/**
Read JPEG_APPD marker (IPTC or Adobe Photoshop profile)
*/
static BOOL
Index: freeimage-3.18.0.1909/Source/FreeImage/PluginJXR.cpp
===================================================================
--- freeimage-3.18.0.1909.orig/Source/FreeImage/PluginJXR.cpp
+++ freeimage-3.18.0.1909/Source/FreeImage/PluginJXR.cpp
@@ -22,8 +22,7 @@
#include "FreeImage.h"
#include "Utilities.h"
#include "../Metadata/FreeImageTag.h"
-
-#include "../LibJXR/jxrgluelib/JXRGlue.h"
+#include <JXRGlue.h>
// ==========================================================
// Plugin Interface
Index: freeimage-3.18.0.1909/Source/FreeImage/PluginPNG.cpp
===================================================================
--- freeimage-3.18.0.1909.orig/Source/FreeImage/PluginPNG.cpp
+++ freeimage-3.18.0.1909/Source/FreeImage/PluginPNG.cpp
@@ -40,8 +40,8 @@
// ----------------------------------------------------------
-#include "../ZLib/zlib.h"
-#include "../LibPNG/png.h"
+#include <zlib.h>
+#include <png.h>
// ----------------------------------------------------------
Index: freeimage-3.18.0.1909/Source/FreeImage/PluginRAW.cpp
===================================================================
--- freeimage-3.18.0.1909.orig/Source/FreeImage/PluginRAW.cpp
+++ freeimage-3.18.0.1909/Source/FreeImage/PluginRAW.cpp
@@ -19,7 +19,7 @@
// Use at your own risk!
// ==========================================================
-#include "../LibRawLite/libraw/libraw.h"
+#include <libraw/libraw.h>
#include "FreeImage.h"
#include "Utilities.h"
Index: freeimage-3.18.0.1909/Source/FreeImage/PluginWebP.cpp
===================================================================
--- freeimage-3.18.0.1909.orig/Source/FreeImage/PluginWebP.cpp
+++ freeimage-3.18.0.1909/Source/FreeImage/PluginWebP.cpp
@@ -24,9 +24,9 @@
#include "../Metadata/FreeImageTag.h"
-#include "../LibWebP/src/webp/decode.h"
-#include "../LibWebP/src/webp/encode.h"
-#include "../LibWebP/src/webp/mux.h"
+#include <webp/decode.h>
+#include <webp/encode.h>
+#include <webp/mux.h>
// ==========================================================
// Plugin Interface
Index: freeimage-3.18.0.1909/Source/FreeImage/ZLibInterface.cpp
===================================================================
--- freeimage-3.18.0.1909.orig/Source/FreeImage/ZLibInterface.cpp
+++ freeimage-3.18.0.1909/Source/FreeImage/ZLibInterface.cpp
@@ -19,10 +19,9 @@
// Use at your own risk!
// ==========================================================
-#include "../ZLib/zlib.h"
+#include <zlib.h>
#include "FreeImage.h"
#include "Utilities.h"
-#include "../ZLib/zutil.h" /* must be the last header because of error C3163 in VS2008 (_vsnprintf defined in stdio.h) */
/**
Compresses a source buffer into a target buffer, using the ZLib library.
@@ -115,7 +114,7 @@ FreeImage_ZLibGZip(BYTE *target, DWORD t
return 0;
case Z_OK: {
// patch header, setup crc and length (stolen from mod_trace_output)
- BYTE *p = target + 8; *p++ = 2; *p = OS_CODE; // xflags, os_code
+ BYTE *p = target + 8; *p++ = 2; *p = 0x03; // xflags, os_code (unix)
crc = crc32(crc, source, source_size);
memcpy(target + 4 + dest_len, &crc, 4);
memcpy(target + 8 + dest_len, &source_size, 4);
Index: freeimage-3.18.0.1909/Source/FreeImageToolkit/JPEGTransform.cpp
===================================================================
--- freeimage-3.18.0.1909.orig/Source/FreeImageToolkit/JPEGTransform.cpp
+++ freeimage-3.18.0.1909/Source/FreeImageToolkit/JPEGTransform.cpp
@@ -26,10 +26,10 @@ extern "C" {
#undef FAR
#include <setjmp.h>
-#include "../LibJPEG/jinclude.h"
-#include "../LibJPEG/jpeglib.h"
-#include "../LibJPEG/jerror.h"
-#include "../LibJPEG/transupp.h"
+#include <jinclude.h>
+#include <jpeglib.h>
+#include <jerror.h>
+#include <transupp.h>
}
#include "FreeImage.h"
Index: freeimage-3.18.0.1909/Source/Metadata/TagConversion.cpp
===================================================================
--- freeimage-3.18.0.1909.orig/Source/Metadata/TagConversion.cpp
+++ freeimage-3.18.0.1909/Source/Metadata/TagConversion.cpp
@@ -31,6 +31,11 @@
#define MAX_TEXT_EXTENT 512
+// These were in FreeImage.h, but are moved here to avoid conflicts (see note in FreeImage.h)
+typedef int64_t INT64;
+typedef uint64_t UINT64;
+
+
/**
Convert a tag to a C string
*/
Index: freeimage-3.18.0.1909/Source/Utilities.h
===================================================================
--- freeimage-3.18.0.1909.orig/Source/Utilities.h
+++ freeimage-3.18.0.1909/Source/Utilities.h
@@ -446,12 +446,12 @@ SwapLong(DWORD *lp) {
}
inline void
-SwapInt64(UINT64 *arg) {
+SwapInt64(uint64_t *arg) {
#if defined(_MSC_VER) && _MSC_VER >= 1310
*arg = _byteswap_uint64(*arg);
#else
union Swap {
- UINT64 sv;
+ uint64_t sv;
DWORD ul[2];
} tmp, result;
tmp.sv = *arg;
Index: freeimage-3.18.0.1909/genfipsrclist.sh
===================================================================
--- freeimage-3.18.0.1909.orig/genfipsrclist.sh
+++ freeimage-3.18.0.1909/genfipsrclist.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-DIRLIST=". Source Source/Metadata Source/FreeImageToolkit Source/LibJPEG Source/LibPNG Source/LibTIFF4 Source/ZLib Source/LibOpenJPEG Source/OpenEXR Source/OpenEXR/Half Source/OpenEXR/Iex Source/OpenEXR/IlmImf Source/OpenEXR/IlmThread Source/OpenEXR/Imath Source/OpenEXR/IexMath Source/LibRawLite Source/LibRawLite/dcraw Source/LibRawLite/internal Source/LibRawLite/libraw Source/LibRawLite/src Source/LibWebP Source/LibJXR Source/LibJXR/common/include Source/LibJXR/image/sys Source/LibJXR/jxrgluelib Wrapper/FreeImagePlus"
+DIRLIST="Wrapper/FreeImagePlus"
echo "VER_MAJOR = 3" > fipMakefile.srcs
@@ -19,5 +19,6 @@ echo -n "INCLUDE =" >> fipMakefile.srcs
for DIR in $DIRLIST; do
echo -n " -I$DIR" >> fipMakefile.srcs
done
+echo -n " -IDist" >> fipMakefile.srcs
echo >> fipMakefile.srcs
Index: freeimage-3.18.0.1909/gensrclist.sh
===================================================================
--- freeimage-3.18.0.1909.orig/gensrclist.sh
+++ freeimage-3.18.0.1909/gensrclist.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-DIRLIST=". Source Source/Metadata Source/FreeImageToolkit Source/LibJPEG Source/LibPNG Source/LibTIFF4 Source/ZLib Source/LibOpenJPEG Source/OpenEXR Source/OpenEXR/Half Source/OpenEXR/Iex Source/OpenEXR/IlmImf Source/OpenEXR/IlmThread Source/OpenEXR/Imath Source/OpenEXR/IexMath Source/LibRawLite Source/LibRawLite/dcraw Source/LibRawLite/internal Source/LibRawLite/libraw Source/LibRawLite/src Source/LibWebP Source/LibJXR Source/LibJXR/common/include Source/LibJXR/image/sys Source/LibJXR/jxrgluelib"
+DIRLIST=". Source Source/Metadata Source/FreeImageToolkit"
echo "VER_MAJOR = 3" > Makefile.srcs
echo "VER_MINOR = 19.0" >> Makefile.srcs