community/freeimage to 3.18.0-2

This commit is contained in:
Kevin Mihelich 2018-10-18 02:44:42 +00:00
parent 17eb9f97c2
commit b601d5e7dd
4 changed files with 283 additions and 324 deletions

View file

@ -1,216 +0,0 @@
diff -rupN FreeImage/Source/FreeImage/PluginPCX.cpp FreeImage-new/Source/FreeImage/PluginPCX.cpp
--- FreeImage/Source/FreeImage/PluginPCX.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginPCX.cpp 2015-09-05 02:44:55.429436425 +0200
@@ -30,7 +30,7 @@
// Constants + headers
// ----------------------------------------------------------
-#define IO_BUF_SIZE 2048
+#define PCX_IO_BUF_SIZE 2048
// ----------------------------------------------------------
@@ -120,17 +120,17 @@ readline(FreeImageIO &io, fi_handle hand
while (length--) {
if (count == 0) {
- if (*ReadPos >= IO_BUF_SIZE - 1 ) {
- if (*ReadPos == IO_BUF_SIZE - 1) {
+ if (*ReadPos >= PCX_IO_BUF_SIZE - 1 ) {
+ if (*ReadPos == PCX_IO_BUF_SIZE - 1) {
// we still have one BYTE, copy it to the start pos
- *ReadBuf = ReadBuf[IO_BUF_SIZE - 1];
+ *ReadBuf = ReadBuf[PCX_IO_BUF_SIZE - 1];
- io.read_proc(ReadBuf + 1, 1, IO_BUF_SIZE - 1, handle);
+ io.read_proc(ReadBuf + 1, 1, PCX_IO_BUF_SIZE - 1, handle);
} else {
// read the complete buffer
- io.read_proc(ReadBuf, 1, IO_BUF_SIZE, handle);
+ io.read_proc(ReadBuf, 1, PCX_IO_BUF_SIZE, handle);
}
*ReadPos = 0;
@@ -346,19 +346,9 @@ Load(FreeImageIO *io, fi_handle handle,
BOOL header_only = (flags & FIF_LOAD_NOPIXELS) == FIF_LOAD_NOPIXELS;
try {
- // check PCX identifier
-
- long start_pos = io->tell_proc(handle);
- BOOL validated = pcx_validate(io, handle);
- io->seek_proc(handle, start_pos, SEEK_SET);
- if(!validated) {
- throw FI_MSG_ERROR_MAGIC_NUMBER;
- }
-
- // process the header
-
PCXHEADER header;
+ // process the header
if(io->read_proc(&header, sizeof(PCXHEADER), 1, handle) != 1) {
throw FI_MSG_ERROR_PARSING;
}
@@ -366,20 +356,38 @@ Load(FreeImageIO *io, fi_handle handle,
SwapHeader(&header);
#endif
- // allocate a new DIB
+ // process the window
+ const WORD *window = header.window; // left, upper, right,lower pixel coord.
+ const int left = window[0];
+ const int top = window[1];
+ const int right = window[2];
+ const int bottom = window[3];
- unsigned width = header.window[2] - header.window[0] + 1;
- unsigned height = header.window[3] - header.window[1] + 1;
- unsigned bitcount = header.bpp * header.planes;
-
- if (bitcount == 24) {
- dib = FreeImage_AllocateHeader(header_only, width, height, bitcount, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
- } else {
- dib = FreeImage_AllocateHeader(header_only, width, height, bitcount);
+ // check image size
+ if((left >= right) || (top >= bottom)) {
+ throw FI_MSG_ERROR_PARSING;
}
- // if the dib couldn't be allocated, throw an error
+ const unsigned width = right - left + 1;
+ const unsigned height = bottom - top + 1;
+ const unsigned bitcount = header.bpp * header.planes;
+ // allocate a new dib
+ switch(bitcount) {
+ case 1:
+ case 4:
+ case 8:
+ dib = FreeImage_AllocateHeader(header_only, width, height, bitcount);
+ break;
+ case 24:
+ dib = FreeImage_AllocateHeader(header_only, width, height, bitcount, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
+ break;
+ default:
+ throw FI_MSG_ERROR_DIB_MEMORY;
+ break;
+ }
+
+ // if the dib couldn't be allocated, throw an error
if (!dib) {
throw FI_MSG_ERROR_DIB_MEMORY;
}
@@ -426,19 +434,23 @@ Load(FreeImageIO *io, fi_handle handle,
if (palette_id == 0x0C) {
BYTE *cmap = (BYTE*)malloc(768 * sizeof(BYTE));
- io->read_proc(cmap, 768, 1, handle);
- pal = FreeImage_GetPalette(dib);
- BYTE *pColormap = &cmap[0];
+ if(cmap) {
+ io->read_proc(cmap, 768, 1, handle);
- for(int i = 0; i < 256; i++) {
- pal[i].rgbRed = pColormap[0];
- pal[i].rgbGreen = pColormap[1];
- pal[i].rgbBlue = pColormap[2];
- pColormap += 3;
+ pal = FreeImage_GetPalette(dib);
+ BYTE *pColormap = &cmap[0];
+
+ for(int i = 0; i < 256; i++) {
+ pal[i].rgbRed = pColormap[0];
+ pal[i].rgbGreen = pColormap[1];
+ pal[i].rgbBlue = pColormap[2];
+ pColormap += 3;
+ }
+
+ free(cmap);
}
- free(cmap);
}
// wrong palette ID, perhaps a gray scale is needed ?
@@ -463,12 +475,12 @@ Load(FreeImageIO *io, fi_handle handle,
return dib;
}
- // calculate the line length for the PCX and the DIB
+ // calculate the line length for the PCX and the dib
// length of raster line in bytes
- unsigned linelength = header.bytes_per_line * header.planes;
- // length of DIB line (rounded to DWORD) in bytes
- unsigned pitch = FreeImage_GetPitch(dib);
+ const unsigned linelength = header.bytes_per_line * header.planes;
+ // length of dib line (rounded to DWORD) in bytes
+ const unsigned pitch = FreeImage_GetPitch(dib);
// run-length encoding ?
@@ -478,14 +490,18 @@ Load(FreeImageIO *io, fi_handle handle,
// ---------------
line = (BYTE*)malloc(linelength * sizeof(BYTE));
- if(!line) throw FI_MSG_ERROR_MEMORY;
+ if(!line) {
+ throw FI_MSG_ERROR_MEMORY;
+ }
- ReadBuf = (BYTE*)malloc(IO_BUF_SIZE * sizeof(BYTE));
- if(!ReadBuf) throw FI_MSG_ERROR_MEMORY;
+ ReadBuf = (BYTE*)malloc(PCX_IO_BUF_SIZE * sizeof(BYTE));
+ if(!ReadBuf) {
+ throw FI_MSG_ERROR_MEMORY;
+ }
bits = FreeImage_GetScanLine(dib, height - 1);
- int ReadPos = IO_BUF_SIZE;
+ int ReadPos = PCX_IO_BUF_SIZE;
if ((header.planes == 1) && ((header.bpp == 1) || (header.bpp == 8))) {
BYTE skip;
@@ -497,7 +513,7 @@ Load(FreeImageIO *io, fi_handle handle,
// skip trailing garbage at the end of the scanline
for (unsigned count = written; count < linelength; count++) {
- if (ReadPos < IO_BUF_SIZE) {
+ if (ReadPos < PCX_IO_BUF_SIZE) {
ReadPos++;
} else {
io->read_proc(&skip, sizeof(BYTE), 1, handle);
@@ -513,7 +529,9 @@ Load(FreeImageIO *io, fi_handle handle,
unsigned x, y, written;
buffer = (BYTE*)malloc(width * sizeof(BYTE));
- if(!buffer) throw FI_MSG_ERROR_MEMORY;
+ if(!buffer) {
+ throw FI_MSG_ERROR_MEMORY;
+ }
for (y = 0; y < height; y++) {
written = readline(*io, handle, line, linelength, bIsRLE, ReadBuf, &ReadPos);
@@ -532,7 +550,7 @@ Load(FreeImageIO *io, fi_handle handle,
}
}
- // then write the DIB row
+ // then write the dib row
for (x = 0; x < width / 2; x++) {
bits[x] = (buffer[2*x] << 4) | buffer[2*x+1];
@@ -541,7 +559,7 @@ Load(FreeImageIO *io, fi_handle handle,
// skip trailing garbage at the end of the scanline
for (unsigned count = written; count < linelength; count++) {
- if (ReadPos < IO_BUF_SIZE) {
+ if (ReadPos < PCX_IO_BUF_SIZE) {
ReadPos++;
} else {
io->read_proc(&skip, sizeof(BYTE), 1, handle);

View file

@ -1,24 +0,0 @@
diff -rupN FreeImage/Source/FreeImage/PluginXPM.cpp FreeImage-new/Source/FreeImage/PluginXPM.cpp
--- FreeImage/Source/FreeImage/PluginXPM.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginXPM.cpp 2016-10-04 16:40:11.975271194 +0200
@@ -181,6 +181,11 @@ Load(FreeImageIO *io, fi_handle handle,
}
free(str);
+ // check info string
+ if((width <= 0) || (height <= 0) || (colors <= 0) || (cpp <= 0)) {
+ throw "Improperly formed info string";
+ }
+
if (colors > 256) {
dib = FreeImage_AllocateHeader(header_only, width, height, 24, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
} else {
@@ -193,7 +198,7 @@ Load(FreeImageIO *io, fi_handle handle,
FILE_RGBA rgba;
str = ReadString(io, handle);
- if(!str)
+ if(!str || (strlen(str) < (size_t)cpp))
throw "Error reading color strings";
std::string chrs(str,cpp); //create a string for the color chars using the first cpp chars

View file

@ -8,8 +8,8 @@
# - build AArch64 with -fPIC
pkgname=freeimage
pkgver=3.17.0
pkgrel=8
pkgver=3.18.0
pkgrel=2
pkgdesc="Library project for developers who would like to support popular graphics image formats"
arch=('x86_64')
license=('GPL' 'custom:FIPL')
@ -17,20 +17,17 @@ url="http://freeimage.sourceforge.net/"
depends=('libjpeg-turbo' 'openexr' 'openjpeg2' 'libwebp' 'libraw' 'jxrlib')
makedepends=('mesa' 'glu')
source=("https://downloads.sourceforge.net/project/freeimage/Source%20Distribution/${pkgver}/FreeImage${pkgver//./}.zip"
freeimage-unbundle.patch CVE-2015-0852.patch CVE-2016-5684.patch)
md5sums=('459e15f0ec75d6efa3c7bd63277ead86'
'c336ba01a7fab92bff97f78140f190e9'
'b21385e2da5dcdf4aa4e98d11150115d'
'2efbe4123d832930778b7c146d4f60f1')
freeimage-unbundle.patch)
sha512sums=('9d9cc7e2d57552c3115e277aeb036e0455204d389026b17a3f513da5be1fd595421655488bb1ec2f76faebed66049119ca55e26e2a6d37024b3fb7ef36ad4818'
'605fd28aaaf3b0ad225d04dd7de5e34d825bb7aa4b1f3a3b4219657c51b2f1507512916e95ba1a731ca5fc8b704f03b83371ab9ad066d74fd49feee735cf13b5')
prepare() {
cd FreeImage
patch -p1 -i ../CVE-2016-5684.patch
patch -p1 -i ../CVE-2015-0852.patch
# TODO: This will only compile against libjpeg-turbo 2 but we will wait for that :D
patch -p1 -i ../freeimage-unbundle.patch # Unbundle libraries (Fedora)
rm -r Source/Lib* Source/ZLib Source/OpenEXR
# can't be built due to private headers
# can't be built due to private headers
> Source/FreeImage/PluginG3.cpp
> Source/FreeImageToolkit/JPEGTransform.cpp
}

View file

@ -1,6 +1,6 @@
diff -rupN FreeImage/genfipsrclist.sh FreeImage-new/genfipsrclist.sh
--- FreeImage/genfipsrclist.sh 2015-02-20 10:52:16.000000000 +0100
+++ FreeImage-new/genfipsrclist.sh 2015-09-05 02:13:52.041353305 +0200
--- FreeImage/genfipsrclist.sh 2018-07-28 18:53:18.000000000 +0200
+++ FreeImage-new/genfipsrclist.sh 2018-07-31 23:37:58.552953202 +0200
@@ -1,6 +1,6 @@
#!/bin/sh
@ -17,8 +17,8 @@ diff -rupN FreeImage/genfipsrclist.sh FreeImage-new/genfipsrclist.sh
echo >> fipMakefile.srcs
diff -rupN FreeImage/gensrclist.sh FreeImage-new/gensrclist.sh
--- FreeImage/gensrclist.sh 2015-02-20 10:51:50.000000000 +0100
+++ FreeImage-new/gensrclist.sh 2015-09-05 02:13:52.041353305 +0200
--- FreeImage/gensrclist.sh 2018-07-28 18:52:50.000000000 +0200
+++ FreeImage-new/gensrclist.sh 2018-07-31 23:37:58.555953202 +0200
@@ -1,6 +1,6 @@
#!/bin/sh
@ -26,10 +26,10 @@ diff -rupN FreeImage/gensrclist.sh FreeImage-new/gensrclist.sh
+DIRLIST=". Source Source/Metadata Source/FreeImageToolkit"
echo "VER_MAJOR = 3" > Makefile.srcs
echo "VER_MINOR = 17.0" >> Makefile.srcs
echo "VER_MINOR = 18.0" >> Makefile.srcs
diff -rupN FreeImage/Makefile.fip FreeImage-new/Makefile.fip
--- FreeImage/Makefile.fip 2015-03-08 18:03:56.000000000 +0100
+++ FreeImage-new/Makefile.fip 2015-09-05 02:14:09.212684028 +0200
--- FreeImage/Makefile.fip 2015-03-10 08:03:56.000000000 +0100
+++ FreeImage-new/Makefile.fip 2018-07-31 23:37:58.556953201 +0200
@@ -17,20 +17,22 @@ MODULES = $(SRCS:.c=.o)
MODULES := $(MODULES:.cpp=.o)
CFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden
@ -71,8 +71,8 @@ diff -rupN FreeImage/Makefile.fip FreeImage-new/Makefile.fip
install:
install -d $(INCDIR) $(INSTALLDIR)
diff -rupN FreeImage/Makefile.gnu FreeImage-new/Makefile.gnu
--- FreeImage/Makefile.gnu 2015-03-08 18:04:00.000000000 +0100
+++ FreeImage-new/Makefile.gnu 2015-09-05 02:14:04.810599259 +0200
--- FreeImage/Makefile.gnu 2015-03-10 08:04:00.000000000 +0100
+++ FreeImage-new/Makefile.gnu 2018-07-31 23:37:58.556953201 +0200
@@ -16,21 +16,11 @@ LIBRARIES = -lstdc++
MODULES = $(SRCS:.c=.o)
MODULES := $(MODULES:.cpp=.o)
@ -115,8 +115,8 @@ diff -rupN FreeImage/Makefile.gnu FreeImage-new/Makefile.gnu
install:
install -d $(INCDIR) $(INSTALLDIR)
diff -rupN FreeImage/Source/FreeImage/J2KHelper.cpp FreeImage-new/Source/FreeImage/J2KHelper.cpp
--- FreeImage/Source/FreeImage/J2KHelper.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/J2KHelper.cpp 2015-09-05 02:13:52.042353324 +0200
--- FreeImage/Source/FreeImage/J2KHelper.cpp 2015-03-03 23:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/J2KHelper.cpp 2018-07-31 23:37:58.557953201 +0200
@@ -21,7 +21,7 @@
#include "FreeImage.h"
@ -127,8 +127,8 @@ diff -rupN FreeImage/Source/FreeImage/J2KHelper.cpp FreeImage-new/Source/FreeIma
// --------------------------------------------------------------------------
diff -rupN FreeImage/Source/FreeImage/Plugin.cpp FreeImage-new/Source/FreeImage/Plugin.cpp
--- FreeImage/Source/FreeImage/Plugin.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/Plugin.cpp 2015-09-05 02:13:52.042353324 +0200
--- FreeImage/Source/FreeImage/Plugin.cpp 2017-02-18 14:09:28.000000000 +0100
+++ FreeImage-new/Source/FreeImage/Plugin.cpp 2018-07-31 23:37:58.558953201 +0200
@@ -263,7 +263,12 @@ FreeImage_Initialise(BOOL load_local_plu
s_plugins->AddNode(InitDDS);
s_plugins->AddNode(InitGIF);
@ -144,8 +144,8 @@ diff -rupN FreeImage/Source/FreeImage/Plugin.cpp FreeImage-new/Source/FreeImage/
s_plugins->AddNode(InitEXR);
s_plugins->AddNode(InitJ2K);
diff -rupN FreeImage/Source/FreeImage/PluginEXR.cpp FreeImage-new/Source/FreeImage/PluginEXR.cpp
--- FreeImage/Source/FreeImage/PluginEXR.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginEXR.cpp 2015-09-05 02:13:52.042353324 +0200
--- FreeImage/Source/FreeImage/PluginEXR.cpp 2015-03-03 23:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginEXR.cpp 2018-07-31 23:37:58.559953201 +0200
@@ -28,16 +28,16 @@
#pragma warning (disable : 4800) // ImfVersion.h - 'const int' : forcing value to bool 'true' or 'false' (performance warning)
#endif
@ -174,8 +174,8 @@ diff -rupN FreeImage/Source/FreeImage/PluginEXR.cpp FreeImage-new/Source/FreeIma
// ==========================================================
diff -rupN FreeImage/Source/FreeImage/PluginJ2K.cpp FreeImage-new/Source/FreeImage/PluginJ2K.cpp
--- FreeImage/Source/FreeImage/PluginJ2K.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginJ2K.cpp 2015-09-05 02:13:52.043353343 +0200
--- FreeImage/Source/FreeImage/PluginJ2K.cpp 2015-03-03 23:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginJ2K.cpp 2018-07-31 23:37:58.559953201 +0200
@@ -21,7 +21,7 @@
#include "FreeImage.h"
@ -186,8 +186,8 @@ diff -rupN FreeImage/Source/FreeImage/PluginJ2K.cpp FreeImage-new/Source/FreeIma
// ==========================================================
diff -rupN FreeImage/Source/FreeImage/PluginJP2.cpp FreeImage-new/Source/FreeImage/PluginJP2.cpp
--- FreeImage/Source/FreeImage/PluginJP2.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginJP2.cpp 2015-09-05 02:13:52.043353343 +0200
--- FreeImage/Source/FreeImage/PluginJP2.cpp 2015-03-03 23:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginJP2.cpp 2018-07-31 23:37:58.560953201 +0200
@@ -21,7 +21,7 @@
#include "FreeImage.h"
@ -198,8 +198,8 @@ diff -rupN FreeImage/Source/FreeImage/PluginJP2.cpp FreeImage-new/Source/FreeIma
// ==========================================================
diff -rupN FreeImage/Source/FreeImage/PluginJPEG.cpp FreeImage-new/Source/FreeImage/PluginJPEG.cpp
--- FreeImage/Source/FreeImage/PluginJPEG.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginJPEG.cpp 2015-09-05 02:13:52.043353343 +0200
--- FreeImage/Source/FreeImage/PluginJPEG.cpp 2018-07-28 19:22:22.000000000 +0200
+++ FreeImage-new/Source/FreeImage/PluginJPEG.cpp 2018-07-31 23:37:58.561953201 +0200
@@ -35,9 +35,9 @@ extern "C" {
#undef FAR
#include <setjmp.h>
@ -213,9 +213,126 @@ diff -rupN FreeImage/Source/FreeImage/PluginJPEG.cpp FreeImage-new/Source/FreeIm
}
#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
diff -rupN FreeImage/Source/FreeImage/PluginJXR.cpp FreeImage-new/Source/FreeImage/PluginJXR.cpp
--- FreeImage/Source/FreeImage/PluginJXR.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginJXR.cpp 2015-09-05 02:13:52.043353343 +0200
--- FreeImage/Source/FreeImage/PluginJXR.cpp 2015-03-03 23:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginJXR.cpp 2018-07-31 23:37:58.561953201 +0200
@@ -23,7 +23,7 @@
#include "Utilities.h"
#include "../Metadata/FreeImageTag.h"
@ -226,8 +343,8 @@ diff -rupN FreeImage/Source/FreeImage/PluginJXR.cpp FreeImage-new/Source/FreeIma
// ==========================================================
// Plugin Interface
diff -rupN FreeImage/Source/FreeImage/PluginPNG.cpp FreeImage-new/Source/FreeImage/PluginPNG.cpp
--- FreeImage/Source/FreeImage/PluginPNG.cpp 2015-03-10 20:16:12.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginPNG.cpp 2015-09-05 02:13:52.044353363 +0200
--- FreeImage/Source/FreeImage/PluginPNG.cpp 2018-07-28 20:15:24.000000000 +0200
+++ FreeImage-new/Source/FreeImage/PluginPNG.cpp 2018-07-31 23:37:58.561953201 +0200
@@ -40,8 +40,8 @@
// ----------------------------------------------------------
@ -240,8 +357,8 @@ diff -rupN FreeImage/Source/FreeImage/PluginPNG.cpp FreeImage-new/Source/FreeIma
// ----------------------------------------------------------
diff -rupN FreeImage/Source/FreeImage/PluginRAW.cpp FreeImage-new/Source/FreeImage/PluginRAW.cpp
--- FreeImage/Source/FreeImage/PluginRAW.cpp 2015-03-08 20:12:04.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginRAW.cpp 2015-09-05 02:13:52.044353363 +0200
--- FreeImage/Source/FreeImage/PluginRAW.cpp 2015-03-10 10:12:04.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginRAW.cpp 2018-07-31 23:37:58.561953201 +0200
@@ -19,7 +19,7 @@
// Use at your own risk!
// ==========================================================
@ -252,8 +369,8 @@ diff -rupN FreeImage/Source/FreeImage/PluginRAW.cpp FreeImage-new/Source/FreeIma
#include "FreeImage.h"
#include "Utilities.h"
diff -rupN FreeImage/Source/FreeImage/PluginTIFF.cpp FreeImage-new/Source/FreeImage/PluginTIFF.cpp
--- FreeImage/Source/FreeImage/PluginTIFF.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginTIFF.cpp 2015-09-05 02:13:52.044353363 +0200
--- FreeImage/Source/FreeImage/PluginTIFF.cpp 2018-07-29 00:24:43.000000000 +0200
+++ FreeImage-new/Source/FreeImage/PluginTIFF.cpp 2018-07-31 23:52:38.774904514 +0200
@@ -37,9 +37,9 @@
#include "FreeImage.h"
@ -266,10 +383,11 @@ diff -rupN FreeImage/Source/FreeImage/PluginTIFF.cpp FreeImage-new/Source/FreeIm
#include "FreeImageIO.h"
#include "PSDParser.h"
@@ -194,16 +194,6 @@ TIFFFdOpen(thandle_t handle, const char
@@ -193,17 +193,6 @@ TIFFFdOpen(thandle_t handle, const char
return tif;
}
-
-/**
-Open a TIFF file for reading or writing
-@param name
@ -284,26 +402,92 @@ diff -rupN FreeImage/Source/FreeImage/PluginTIFF.cpp FreeImage-new/Source/FreeIm
// TIFF library FreeImage-specific routines.
// ----------------------------------------------------------
diff -rupN FreeImage/Source/FreeImage/PluginWebP.cpp FreeImage-new/Source/FreeImage/PluginWebP.cpp
--- FreeImage/Source/FreeImage/PluginWebP.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginWebP.cpp 2015-09-05 02:13:52.044353363 +0200
@@ -24,10 +24,10 @@
--- FreeImage/Source/FreeImage/PluginWebP.cpp 2016-06-15 15:48:12.000000000 +0200
+++ FreeImage-new/Source/FreeImage/PluginWebP.cpp 2018-07-31 23:38:40.531950880 +0200
@@ -24,9 +24,9 @@
#include "../Metadata/FreeImageTag.h"
-#include "../LibWebP/src/webp/decode.h"
-#include "../LibWebP/src/webp/encode.h"
-#include "../LibWebP/src/enc/vp8enci.h"
-#include "../LibWebP/src/webp/mux.h"
+#include <webp/decode.h>
+#include <webp/encode.h>
+// #include "../LibWebP/src/enc/vp8enci.h"
+#include <webp/mux.h>
// ==========================================================
// Plugin Interface
diff -rupN FreeImage/Source/FreeImage/PSDParser.cpp FreeImage-new/Source/FreeImage/PSDParser.cpp
--- FreeImage/Source/FreeImage/PSDParser.cpp 2016-02-11 03:18:02.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PSDParser.cpp 2018-08-01 00:17:18.323822675 +0200
@@ -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 {
diff -rupN FreeImage/Source/FreeImage/ZLibInterface.cpp FreeImage-new/Source/FreeImage/ZLibInterface.cpp
--- FreeImage/Source/FreeImage/ZLibInterface.cpp 2015-03-02 02:07:10.000000000 +0100
+++ FreeImage-new/Source/FreeImage/ZLibInterface.cpp 2015-09-05 02:13:52.044353363 +0200
--- FreeImage/Source/FreeImage/ZLibInterface.cpp 2015-03-03 23:07:10.000000000 +0100
+++ FreeImage-new/Source/FreeImage/ZLibInterface.cpp 2018-07-31 23:37:58.563953201 +0200
@@ -19,10 +19,9 @@
// Use at your own risk!
// ==========================================================
@ -326,8 +510,8 @@ diff -rupN FreeImage/Source/FreeImage/ZLibInterface.cpp FreeImage-new/Source/Fre
memcpy(target + 4 + dest_len, &crc, 4);
memcpy(target + 8 + dest_len, &source_size, 4);
diff -rupN FreeImage/Source/FreeImage.h FreeImage-new/Source/FreeImage.h
--- FreeImage/Source/FreeImage.h 2015-03-04 02:17:54.000000000 +0100
+++ FreeImage-new/Source/FreeImage.h 2015-09-05 02:13:52.045353382 +0200
--- FreeImage/Source/FreeImage.h 2018-03-25 18:42:20.000000000 +0200
+++ FreeImage-new/Source/FreeImage.h 2018-08-01 00:16:34.704825088 +0200
@@ -155,8 +155,11 @@ typedef uint8_t BYTE;
typedef uint16_t WORD;
typedef uint32_t DWORD;
@ -373,7 +557,7 @@ diff -rupN FreeImage/Source/FreeImage.h FreeImage-new/Source/FreeImage.h
/** Tone mapping operators.
Constants used in FreeImage_ToneMapping.
@@ -1076,7 +1089,10 @@ DLL_API const char* DLL_CALLCONV FreeIma
@@ -1088,7 +1101,10 @@ DLL_API const char* DLL_CALLCONV FreeIma
// --------------------------------------------------------------------------
// JPEG lossless transformation routines
// --------------------------------------------------------------------------
@ -385,7 +569,7 @@ diff -rupN FreeImage/Source/FreeImage.h FreeImage-new/Source/FreeImage.h
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);
@@ -1085,6 +1101,7 @@ DLL_API BOOL DLL_CALLCONV FreeImage_JPEG
@@ -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));
@ -394,8 +578,8 @@ diff -rupN FreeImage/Source/FreeImage.h FreeImage-new/Source/FreeImage.h
// --------------------------------------------------------------------------
diff -rupN FreeImage/Source/FreeImageToolkit/JPEGTransform.cpp FreeImage-new/Source/FreeImageToolkit/JPEGTransform.cpp
--- FreeImage/Source/FreeImageToolkit/JPEGTransform.cpp 2015-03-02 02:07:10.000000000 +0100
+++ FreeImage-new/Source/FreeImageToolkit/JPEGTransform.cpp 2015-09-05 02:13:52.045353382 +0200
--- FreeImage/Source/FreeImageToolkit/JPEGTransform.cpp 2015-03-03 23:07:10.000000000 +0100
+++ FreeImage-new/Source/FreeImageToolkit/JPEGTransform.cpp 2018-07-31 23:37:58.563953201 +0200
@@ -26,10 +26,10 @@ extern "C" {
#undef FAR
#include <setjmp.h>
@ -412,8 +596,8 @@ diff -rupN FreeImage/Source/FreeImageToolkit/JPEGTransform.cpp FreeImage-new/Sou
#include "FreeImage.h"
diff -rupN FreeImage/Source/Metadata/TagConversion.cpp FreeImage-new/Source/Metadata/TagConversion.cpp
--- FreeImage/Source/Metadata/TagConversion.cpp 2015-03-02 02:07:10.000000000 +0100
+++ FreeImage-new/Source/Metadata/TagConversion.cpp 2015-09-05 02:13:52.045353382 +0200
--- FreeImage/Source/Metadata/TagConversion.cpp 2018-03-25 12:30:54.000000000 +0200
+++ FreeImage-new/Source/Metadata/TagConversion.cpp 2018-07-31 23:37:58.564953201 +0200
@@ -30,6 +30,11 @@
#define MAX_TEXT_EXTENT 512
@ -427,8 +611,8 @@ diff -rupN FreeImage/Source/Metadata/TagConversion.cpp FreeImage-new/Source/Meta
Convert a tag to a C string
*/
diff -rupN FreeImage/Source/Metadata/XTIFF.cpp FreeImage-new/Source/Metadata/XTIFF.cpp
--- FreeImage/Source/Metadata/XTIFF.cpp 2015-03-02 02:07:10.000000000 +0100
+++ FreeImage-new/Source/Metadata/XTIFF.cpp 2015-09-05 02:13:52.045353382 +0200
--- FreeImage/Source/Metadata/XTIFF.cpp 2015-03-03 23:07:10.000000000 +0100
+++ FreeImage-new/Source/Metadata/XTIFF.cpp 2018-07-31 23:37:58.564953201 +0200
@@ -29,13 +29,18 @@
#pragma warning (disable : 4786) // identifier was truncated to 'number' characters
#endif
@ -546,3 +730,21 @@ diff -rupN FreeImage/Source/Metadata/XTIFF.cpp FreeImage-new/Source/Metadata/XTI
if(skip_write_field(tif, tag_id)) {
// skip tags that are already handled by the LibTIFF writing process
diff -rupN FreeImage/Source/Utilities.h FreeImage-new/Source/Utilities.h
--- FreeImage/Source/Utilities.h 2016-04-11 15:15:32.000000000 +0200
+++ FreeImage-new/Source/Utilities.h 2018-08-01 00:16:29.826825358 +0200
@@ -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;