Index: Makefile =================================================================== --- Makefile (revision 438666) +++ Makefile (working copy) @@ -2,11 +2,7 @@ # $FreeBSD$ PORTNAME= freeimage -PORTVERSION= 3.16.0 -PORTREVISION= 2 -# Version 3.17.0 is available, but does not build on i386 (and probably -# other 32-bit arches) without some not-quite-trivial patching. If one -# decides to update the port, please make sure 32-bit builds are tested! +PORTVERSION= 3.17.0 CATEGORIES= graphics MASTER_SITES= SF/${PORTNAME}/Source%20Distribution/${PORTVERSION} DISTNAME= FreeImage${PORTVERSION:S/.//g} @@ -14,49 +10,51 @@ MAINTAINER= ports@FreeBSD.org COMMENT= Simple C/C++ bitmap graphics library -USES= dos2unix gmake zip -DOS2UNIX_FILES= Source/LibOpenJPEG/opj_malloc.h \ - Source/LibRawLite/dcraw/dcraw.c \ - Source/LibRawLite/internal/dcraw_common.cpp +LICENSE= FIPL +LICENSE_NAME= FreeImage Public License +LICENSE_FILE= ${WRKSRC}/license-fi.txt +LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept + +LIB_DEPENDS= libopenjp2.so:graphics/openjpeg \ + libpng16.so:graphics/png \ + libraw.so:graphics/libraw \ + libtiff.so:graphics/tiff \ + libwebp.so:graphics/webp \ + libHalf.so:graphics/ilmbase \ + libjxrglue.so:graphics/libjxr \ + libIlmImf.so:graphics/OpenEXR + +USES= dos2unix jpeg pkgconfig uidfix zip +DOS2UNIX_FILES= TestAPI/testJPEG.cpp TestAPI/MainTestSuite.cpp USE_LDCONFIG= yes WRKSRC= ${WRKDIR}/FreeImage -MAKE_ARGS= CC="${CC}" CPP="${CPP}" CXX="${CXX}" -CFLAGS+= -fexceptions -fvisibility=hidden -CFLAGS_aarch64= -fPIC -CFLAGS_amd64= -fPIC +# Do not even extract the the ancient versions of the +# various dependencies -- rely on their ports instead: +EXCLUDE= LibJPEG LibJXR LibOpenJPEG LibPNG LibRawLite LibTIFF4 \ + LibWebP OpenEXR ZLib +EXTRACT_AFTER_ARGS= -a \ + ${EXCLUDE:C,^(.*)$,-x FreeImage/Source/\1/* -x FreeImage/Source/\1,} \ + -x FreeImage/Wrapper/Delphi* \ + -x FreeImage/Wrapper/FreeImage.NET* \ + -x FreeImage/Wrapper/VB6* -PLIST_FILES= include/FreeImage.h \ - include/FreeImagePlus.h \ - lib/libfreeimage.a \ - lib/libfreeimage-${PORTVERSION}.so \ - lib/libfreeimage.so.3 \ - lib/libfreeimage.so \ - lib/libfreeimageplus.a \ - lib/libfreeimageplus-${PORTVERSION}.so \ - lib/libfreeimageplus.so.3 \ - lib/libfreeimageplus.so +MAKEFILE= ${FILESDIR}/BSDmakefile .include -.if ${ARCH} == amd64 || ${ARCH} == powerpc -USES+= compiler:c++0x -.endif +do-configure: + ${LN} -sf ${FILESDIR}/BSDmakefile.Source ${WRKSRC}/Source/BSDmakefile + ${LN} -sf ${FILESDIR}/BSDmakefile.FreeImagePlus ${WRKSRC}/Wrapper/FreeImagePlus/BSDmakefile + ${LN} -sf ${FILESDIR}/BSDmakefile.TestAPI ${WRKSRC}/TestAPI/BSDmakefile post-patch: - @${REINPLACE_CMD} -e 's|/usr|${PREFIX}| ; s|-o root -g root ||' \ - ${WRKSRC}/Makefile.gnu ${WRKSRC}/Makefile.fip + @${REINPLACE_CMD} -e 's|tiffiop.h|tiffio.h|' \ + -e 's|#include *"\.\./.*/\([^/]*\)" *$$|#include <\1>|' \ + ${WRKSRC}/Source/*/*.[ch]* -post-build: - ${SETENV} ${MAKE_ENV} ${MAKE_CMD} -f Makefile.fip ${_MAKE_JOBS} \ - ${MAKE_ARGS} -C ${BUILD_WRKSRC} +regression-test test check: build + # Complaints about "uknown tag" are considered Ok + cd ${WRKSRC}/TestAPI && ./testAPI -post-install: - ${SETENV} ${MAKE_ENV} ${MAKE_CMD} -f Makefile.fip ${MAKE_ARGS} \ - -C ${INSTALL_WRKSRC} ${INSTALL_TARGET} - ${LN} -sf libfreeimageplus.so.3 \ - ${STAGEDIR}${PREFIX}/lib/libfreeimageplus.so - ${LN} -sf libfreeimageplus-${PORTVERSION}.so \ - ${STAGEDIR}${PREFIX}/lib/libfreeimageplus.so.3 - .include Index: distinfo =================================================================== --- distinfo (revision 438666) +++ distinfo (working copy) @@ -1,2 +1,3 @@ -SHA256 (FreeImage3160.zip) = 03af32dd60140d07515ddfe7b4f467baa3b888a72ea78828811aded7adb42f60 -SIZE (FreeImage3160.zip) = 5669228 +TIMESTAMP = 1492192692 +SHA256 (FreeImage3170.zip) = fbfc65e39b3d4e2cb108c4ffa8c41fd02c07d4d436c594fff8dab1a6d5297f89 +SIZE (FreeImage3170.zip) = 7020636 Index: files/BSDmakefile =================================================================== --- files/BSDmakefile (nonexistent) +++ files/BSDmakefile (working copy) @@ -0,0 +1,5 @@ +SUBDIR= Source +SUBDIR+=Wrapper/FreeImagePlus +SUBDIR+=TestAPI + +.include Property changes on: files/BSDmakefile ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/BSDmakefile.FreeImagePlus =================================================================== --- files/BSDmakefile.FreeImagePlus (nonexistent) +++ files/BSDmakefile.FreeImagePlus (working copy) @@ -0,0 +1,18 @@ +LIB_CXX= freeimageplus +SHLIB_MAJOR= 3 +INCS= FreeImagePlus.h +NO_PROFILE= nope + +LIBDIR= ${PREFIX}/lib +INCLUDEDIR= ${PREFIX}/include + +SRCS= FreeImagePlus.cpp fipImage.cpp fipMemoryIO.cpp fipMetadataFind.cpp \ + fipMultiPage.cpp fipTag.cpp + +CXXFLAGS+=-I. -I${.CURDIR:H:H}/Source + +LDADD= -L${.CURDIR:H:H}/Source -lfreeimage + +.PATH: src + +.include Property changes on: files/BSDmakefile.FreeImagePlus ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/BSDmakefile.Source =================================================================== --- files/BSDmakefile.Source (nonexistent) +++ files/BSDmakefile.Source (working copy) @@ -0,0 +1,37 @@ +LIB_CXX= freeimage +SHLIB_MAJOR= ${VER_MAJOR} +INCS= FreeImage.h +NO_PROFILE= nope + +LIBDIR= ${PREFIX}/lib +INCLUDEDIR= ${PREFIX}/include + +.include "${.CURDIR:H}/Makefile.srcs" + +SRCS:= ${SRCS:M*/Source/FreeImage*/*:T} ${SRCS:M*/Source/Metadata/*:T} \ + ${SRCS:M*/Source/DeprecationManager} +# Disable the plugins, which require access to internal structures of +# the other libraries. Similar thing is also done by Debian and Fedora... +SRCS:= ${SRCS:N*PluginG3.cpp} # Requires TIFF internals +SRCS:= ${SRCS:N*JPEGTransform.cpp} # Requires JPEG internals + +OJPCFLAGS!= pkgconf libopenjp2 --cflags +OJPLIBS!= pkgconf libopenjp2 --libs +ILMLIBS!= pkgconf IlmBase --libs +CXXFLAGS+= -fexceptions -fvisibility=hidden +CXXFLAGS+= -IDeprecationManager -IMetadata -I. +CXXFLAGS+= -I${LOCALBASE}/include/OpenEXR +CXXFLAGS+= -I${LOCALBASE}/include/libraw +CXXFLAGS+= -I${LOCALBASE}/include/jxrlib +CXXFLAGS+= -I${LOCALBASE}/include/webp +CXXFLAGS+= ${OJPCFLAGS} +CXXFLAGS+= -I${LOCALBASE}/include -DOS_CODE=0x03 +CXXFLAGS+= -Wcast-qual -Wno-logical-op-parentheses -Wno-bitwise-op-parentheses -Wno-switch -Wno-unused-value -Werror +CFLAGS+= -I. -Werror + +.PATH: FreeImage FreeImageToolkit Metadata DeprecationMgr + +LDADD= -L${LOCALBASE}/lib +LDADD+= -lopenjp2 -ljxrglue -ljpeg -lpng16 -lraw -ltiff -lwebpmux -lIlmImf -lHalf -lz + +.include Property changes on: files/BSDmakefile.Source ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/BSDmakefile.TestAPI =================================================================== --- files/BSDmakefile.TestAPI (nonexistent) +++ files/BSDmakefile.TestAPI (working copy) @@ -0,0 +1,10 @@ +PROG_CXX= testAPI +NO_MAN= ha-ha +INTERNALPROG= do not install + +SRCS!= echo *.cpp + +CXXFLAGS+=-I${.CURDIR:H}/Source +LDADD= -L${.CURDIR:H}/Source -Wl,-rpath=${.CURDIR:H}/Source -lfreeimage + +.include Property changes on: files/BSDmakefile.TestAPI ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-CVE-2016-5684 =================================================================== --- files/patch-CVE-2016-5684 (nonexistent) +++ files/patch-CVE-2016-5684 (working copy) @@ -0,0 +1,31 @@ +From: Debian Science Maintainers +Date: Mon, 10 Oct 2016 08:22:44 +0100 +Subject: CVE-2016-5684 + +--- + Source/FreeImage/PluginXPM.cpp | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- Source/FreeImage/PluginXPM.cpp ++++ Source/FreeImage/PluginXPM.cpp +@@ -181,6 +181,11 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { + } + 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, int page, int flags, void *data) { + 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 Property changes on: files/patch-CVE-2016-5684 ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-Disable-testing-of-JPEG-transform =================================================================== --- files/patch-Disable-testing-of-JPEG-transform (nonexistent) +++ files/patch-Disable-testing-of-JPEG-transform (working copy) @@ -0,0 +1,44 @@ +Adapted from Debian: + +From: Ghislain Antony Vaillant +Date: Tue, 3 Nov 2015 18:15:18 +0000 +Subject: Disable testing of JPEG transform. + +Reason: the JPEG transform features are disabled from the Debian build as a +result of the stripping of the vendored dependencies. +--- + TestAPI/testJPEG.cpp | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/TestAPI/testJPEG.cpp b/TestAPI/testJPEG.cpp +index 798033d..94638b9 100644 +--- TestAPI/testJPEG.cpp ++++ TestAPI/testJPEG.cpp +@@ -25,6 +25,7 @@ + // Local test functions + // ---------------------------------------------------------- + ++#if 0 + void testJPEGTransform(const char *src_file) { + BOOL bResult; + BOOL perfect; +@@ -193,11 +194,13 @@ void testJPEGSameFile(const char *src_file) { + bResult = FreeImage_JPEGTransform("test.jpg", "test.jpg", FIJPEG_OP_ROTATE_270, perfect); + assert(bResult); + } ++#endif + + // Main test function + // ---------------------------------------------------------- + + void testJPEG() { ++#if 0 + const char *src_file = "exif.jpg"; + + printf("testJPEG (should throw exceptions) ...\n"); +@@ -213,4 +216,5 @@ void testJPEG() { + + // using the same file for src & dst is allowed + testJPEGSameFile(src_file); ++#endif + } Property changes on: files/patch-Disable-testing-of-JPEG-transform ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-Exif.cpp =================================================================== --- files/patch-Exif.cpp (nonexistent) +++ files/patch-Exif.cpp (working copy) @@ -0,0 +1,75 @@ +--- Source/Metadata/Exif.cpp 2015-03-02 02:07:10.000000000 -0500 ++++ Source/Metadata/Exif.cpp 2017-05-02 14:09:07.648939000 -0400 +@@ -400,5 +400,5 @@ + */ + static void +-processExifTag(FIBITMAP *dib, FITAG *tag, char *pval, BOOL msb_order, TagLib::MDMODEL md_model) { ++processExifTag(FIBITMAP *dib, FITAG *tag, const char *pval, BOOL msb_order, TagLib::MDMODEL md_model) { + char defaultKey[16]; + int n; +@@ -418,7 +418,7 @@ + case FIDT_SHORT: + { +- WORD *value = (WORD*)&exif_value[0]; ++ uint16_t *value = (uint16_t *)exif_value; + for(i = 0; i < FreeImage_GetTagCount(tag); i++) { +- value[i] = ReadUint16(msb_order, pval + i * sizeof(WORD)); ++ value[i] = ReadUint16(msb_order, pval + i * 2); + } + FreeImage_SetTagValue(tag, value); +@@ -427,7 +427,7 @@ + case FIDT_SSHORT: + { +- short *value = (short*)&exif_value[0]; ++ int16_t *value = (int16_t *)exif_value; + for(i = 0; i < FreeImage_GetTagCount(tag); i++) { +- value[i] = ReadInt16(msb_order, pval + i * sizeof(short)); ++ value[i] = ReadInt16(msb_order, pval + i * 2); + } + FreeImage_SetTagValue(tag, value); +@@ -436,7 +436,7 @@ + case FIDT_LONG: + { +- DWORD *value = (DWORD*)&exif_value[0]; ++ uint32_t *value = (uint32_t *)exif_value; + for(i = 0; i < FreeImage_GetTagCount(tag); i++) { +- value[i] = ReadUint32(msb_order, pval + i * sizeof(DWORD)); ++ value[i] = ReadUint32(msb_order, pval + i * 4); + } + FreeImage_SetTagValue(tag, value); +@@ -445,7 +445,7 @@ + case FIDT_SLONG: + { +- LONG *value = (LONG*)&exif_value[0]; ++ int32_t *value = (int32_t *)exif_value; + for(i = 0; i < FreeImage_GetTagCount(tag); i++) { +- value[i] = ReadInt32(msb_order, pval + i * sizeof(LONG)); ++ value[i] = ReadInt32(msb_order, pval + i * 4); + } + FreeImage_SetTagValue(tag, value); +@@ -454,10 +454,8 @@ + case FIDT_RATIONAL: + { +- n = sizeof(DWORD); +- +- DWORD *value = (DWORD*)&exif_value[0]; ++ uint32_t *value = (uint32_t *)exif_value; + for(i = 0; i < 2 * FreeImage_GetTagCount(tag); i++) { + // read a sequence of (numerator, denominator) +- value[i] = ReadUint32(msb_order, n*i + (char*)pval); ++ value[i] = ReadUint32(msb_order, pval + i * 4); + } + FreeImage_SetTagValue(tag, value); +@@ -466,10 +464,8 @@ + case FIDT_SRATIONAL: + { +- n = sizeof(LONG); +- +- LONG *value = (LONG*)&exif_value[0]; ++ int32_t *value = (int32_t *)exif_value; + for(i = 0; i < 2 * FreeImage_GetTagCount(tag); i++) { + // read a sequence of (numerator, denominator) +- value[i] = ReadInt32(msb_order, n*i + (char*)pval); ++ value[i] = ReadInt32(msb_order, pval + i * 4); + } + FreeImage_SetTagValue(tag, value); Property changes on: files/patch-Exif.cpp ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-FIRational.cpp =================================================================== --- files/patch-FIRational.cpp (nonexistent) +++ files/patch-FIRational.cpp (working copy) @@ -0,0 +1,30 @@ +--- Source/Metadata/FIRational.cpp 2015-03-02 02:07:10.000000000 -0500 ++++ Source/Metadata/FIRational.cpp 2017-05-02 15:18:10.749090000 -0400 +@@ -50,19 +50,22 @@ + /// Constructor with FITAG + FIRational::FIRational(const FITAG *tag) { ++ const void *pvalue = FreeImage_GetTagValue((FITAG*)tag); ++ LONG d, n; ++ + switch(FreeImage_GetTagType((FITAG*)tag)) { + case FIDT_RATIONAL: // 64-bit unsigned fraction + { +- DWORD *pvalue = (DWORD*)FreeImage_GetTagValue((FITAG*)tag); +- initialize((LONG)pvalue[0], (LONG)pvalue[1]); ++ n = ((uint32_t *)pvalue)[0]; ++ d = ((uint32_t *)pvalue)[1]; + break; + } +- + case FIDT_SRATIONAL: // 64-bit signed fraction + { +- LONG *pvalue = (LONG*)FreeImage_GetTagValue((FITAG*)tag); +- initialize((LONG)pvalue[0], (LONG)pvalue[1]); ++ n = ((int32_t *)pvalue)[0]; ++ d = ((int32_t *)pvalue)[1]; + break; + } + } ++ initialize(n, d); + } + Property changes on: files/patch-FIRational.cpp ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-FreeImage.h =================================================================== --- files/patch-FreeImage.h (nonexistent) +++ files/patch-FreeImage.h (working copy) @@ -0,0 +1,19 @@ +--- Source/FreeImage.h 2015-03-04 02:17:54.000000000 -0500 ++++ Source/FreeImage.h 2017-04-15 00:35:12.308397000 -0400 +@@ -130,5 +130,4 @@ + + #ifndef _WINDOWS_ +-#define _WINDOWS_ + + #ifndef FALSE +@@ -155,7 +154,9 @@ + typedef uint16_t WORD; + typedef uint32_t DWORD; +-typedef int32_t LONG; ++typedef long LONG; ++#ifndef _LIBRAW_TYPES_H /* libraw defines these on its own -- differently */ + typedef int64_t INT64; + typedef uint64_t UINT64; ++#endif + #else + // MS is not C99 ISO compliant Property changes on: files/patch-FreeImage.h ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-FreeImageTag.cpp =================================================================== --- files/patch-FreeImageTag.cpp (nonexistent) +++ files/patch-FreeImageTag.cpp (working copy) @@ -0,0 +1,9 @@ +--- Source/Metadata/FreeImageTag.cpp 2015-03-04 03:21:12.000000000 -0500 ++++ Source/Metadata/FreeImageTag.cpp 2017-04-16 14:30:23.045403000 -0400 +@@ -82,5 +82,5 @@ + FITAG * DLL_CALLCONV + FreeImage_CloneTag(FITAG *tag) { +- if(!tag) return NULL; ++ if (!tag || !tag->data) return NULL; + + // allocate a new tag Property changes on: files/patch-FreeImageTag.cpp ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-PluginDDS.cpp =================================================================== --- files/patch-PluginDDS.cpp (nonexistent) +++ files/patch-PluginDDS.cpp (working copy) @@ -0,0 +1,15 @@ +From https://sourceforge.net/p/freeimage/patches/121/ + +--- PluginDDS.cpp (1861) ++++ Source/FreeImage/PluginDDS.cpp (working copy) +@@ -399,8 +399,8 @@ + + static FIBITMAP * + LoadRGB (DDSURFACEDESC2 &desc, FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { +- int width = (int)desc.dwWidth & ~3; +- int height = (int)desc.dwHeight & ~3; ++ int width = (int)desc.dwWidth; ++ int height = (int)desc.dwHeight; + int bpp = (int)desc.ddpfPixelFormat.dwRGBBitCount; + + // allocate a new dib Property changes on: files/patch-PluginDDS.cpp ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-PluginTIFF.cpp =================================================================== --- files/patch-PluginTIFF.cpp (nonexistent) +++ files/patch-PluginTIFF.cpp (working copy) @@ -0,0 +1,236 @@ +Patch to bring up to the CVS-version + +--- Source/FreeImage/PluginTIFF.cpp 2015-03-02 02:07:08.000000000 -0500 ++++ Source/FreeImage/PluginTIFF.cpp 2017-04-16 15:10:18.458533000 -0400 +@@ -104,6 +104,6 @@ + static BOOL tiff_read_iptc_profile(TIFF *tiff, FIBITMAP *dib); + static BOOL tiff_read_xmp_profile(TIFF *tiff, FIBITMAP *dib); +-static BOOL tiff_read_exif_profile(TIFF *tiff, FIBITMAP *dib); +-static void ReadMetadata(TIFF *tiff, FIBITMAP *dib); ++static BOOL tiff_read_exif_profile(FreeImageIO *io, fi_handle handle, TIFF *tiff, FIBITMAP *dib); ++static void ReadMetadata(FreeImageIO *io, fi_handle handle, TIFF *tiff, FIBITMAP *dib); + + static BOOL tiff_write_iptc_profile(TIFF *tiff, FIBITMAP *dib); +@@ -214,4 +214,12 @@ + } + ++void* ++_TIFFcalloc(tmsize_t nmemb, tmsize_t siz) { ++ if (nmemb == 0 || siz == 0) { ++ return ((void *)NULL); ++ } ++ return calloc((size_t)nmemb, (size_t)siz); ++} ++ + void + _TIFFfree(void *p) { +@@ -810,7 +818,7 @@ + */ + static BOOL +-tiff_read_exif_profile(TIFF *tiff, FIBITMAP *dib) { ++tiff_read_exif_profile(FreeImageIO *io, fi_handle handle, TIFF *tiff, FIBITMAP *dib) { + BOOL bResult = FALSE; +- toff_t exif_offset = 0; ++ toff_t exif_offset = 0; + + // read EXIF-TIFF tags +@@ -820,11 +828,15 @@ + if(TIFFGetField(tiff, TIFFTAG_EXIFIFD, &exif_offset)) { + ++ const long tell_pos = io->tell_proc(handle); ++ const uint16 cur_dir = TIFFCurrentDirectory(tiff); ++ + // read EXIF tags +- if(!TIFFReadEXIFDirectory(tiff, exif_offset)) { +- return FALSE; ++ if (TIFFReadEXIFDirectory(tiff, exif_offset)) { ++ // read all known exif tags ++ bResult = tiff_read_exif_tags(tiff, TagLib::EXIF_EXIF, dib); + } + +- // read all known exif tags +- bResult = tiff_read_exif_tags(tiff, TagLib::EXIF_EXIF, dib); ++ io->seek_proc(handle, tell_pos, SEEK_SET); ++ TIFFSetDirectory(tiff, cur_dir); + } + +@@ -836,5 +848,5 @@ + */ + static void +-ReadMetadata(TIFF *tiff, FIBITMAP *dib) { ++ReadMetadata(FreeImageIO *io, fi_handle handle, TIFF *tiff, FIBITMAP *dib) { + + // IPTC/NAA +@@ -848,5 +860,5 @@ + + // Exif-TIFF +- tiff_read_exif_profile(tiff, dib); ++ tiff_read_exif_profile(io, handle, tiff, dib); + } + +@@ -1092,8 +1104,9 @@ + @param photometric TIFFTAG_PHOTOMETRIC tiff tag + @param bitspersample TIFFTAG_BITSPERSAMPLE tiff tag ++@param samplesperpixel TIFFTAG_SAMPLESPERPIXEL tiff tag + @return Returns FALSE if a uncommon bit-depth is encountered, returns TRUE otherwise + */ + static BOOL +-IsValidBitsPerSample(uint16 photometric, uint16 bitspersample) { ++IsValidBitsPerSample(uint16 photometric, uint16 bitspersample, uint16 samplesperpixel) { + + switch(bitspersample) { +@@ -1118,4 +1131,7 @@ + if((photometric == PHOTOMETRIC_MINISWHITE) || (photometric == PHOTOMETRIC_MINISBLACK) || (photometric == PHOTOMETRIC_LOGLUV)) { + return TRUE; ++ } else if((photometric == PHOTOMETRIC_RGB) && (samplesperpixel == 3) || (samplesperpixel == 4)) { ++ // RGB[A]F ++ return TRUE; + } else { + return FALSE; +@@ -1222,22 +1238,22 @@ + ReadThumbnail(FreeImageIO *io, fi_handle handle, void *data, TIFF *tiff, FIBITMAP *dib) { + FIBITMAP* thumbnail = NULL; +- ++ + // read exif thumbnail (IFD 1) ... +- +- uint32 exif_offset = 0; ++ ++ toff_t exif_offset = 0; + if(TIFFGetField(tiff, TIFFTAG_EXIFIFD, &exif_offset)) { +- +- if(TIFFLastDirectory(tiff) != 0) { ++ ++ if(!TIFFLastDirectory(tiff)) { + // save current position +- long tell_pos = io->tell_proc(handle); +- uint16 cur_dir = TIFFCurrentDirectory(tiff); +- ++ const long tell_pos = io->tell_proc(handle); ++ const uint16 cur_dir = TIFFCurrentDirectory(tiff); ++ + // load the thumbnail +- int page = 1; ++ int page = 1; + int flags = TIFF_DEFAULT; + thumbnail = Load(io, handle, page, flags, data); +- // store the thumbnail (remember to release it later ...) ++ // store the thumbnail (remember to release it before return) + FreeImage_SetThumbnail(dib, thumbnail); +- ++ + // restore current position + io->seek_proc(handle, tell_pos, SEEK_SET); +@@ -1245,17 +1261,20 @@ + } + } +- ++ + // ... or read the first subIFD +- ++ + if(!thumbnail) { + uint16 subIFD_count = 0; +- uint64* subIFD_offsets = NULL; +- // ### Theoretically this should also read the first subIFD from a Photoshop-created file with "pyramid". +- // It does not however - the tag is there (using Tag Viewer app) but libtiff refuses to read it ++ toff_t* subIFD_offsets = NULL; ++ ++ // This will also read the first (and only) subIFD from a Photoshop-created "pyramid" file. ++ // Subsequent, smaller images are 'nextIFD' in that subIFD. Currently we only load the first one. ++ + if(TIFFGetField(tiff, TIFFTAG_SUBIFD, &subIFD_count, &subIFD_offsets)) { + if(subIFD_count > 0) { + // save current position +- long tell_pos = io->tell_proc(handle); +- uint16 cur_dir = TIFFCurrentDirectory(tiff); ++ const long tell_pos = io->tell_proc(handle); ++ const uint16 cur_dir = TIFFCurrentDirectory(tiff); ++ + if(TIFFSetSubDirectory(tiff, subIFD_offsets[0])) { + // load the thumbnail +@@ -1263,7 +1282,8 @@ + int flags = TIFF_DEFAULT; + thumbnail = Load(io, handle, page, flags, data); +- // store the thumbnail (remember to release it later ...) ++ // store the thumbnail (remember to release it before return) + FreeImage_SetThumbnail(dib, thumbnail); + } ++ + // restore current position + io->seek_proc(handle, tell_pos, SEEK_SET); +@@ -1274,15 +1294,15 @@ + + // ... or read Photoshop thumbnail +- ++ + if(!thumbnail) { + uint32 ps_size = 0; + void *ps_data = NULL; +- ++ + if(TIFFGetField(tiff, TIFFTAG_PHOTOSHOP, &ps_size, &ps_data)) { + FIMEMORY *handle = FreeImage_OpenMemory((BYTE*)ps_data, ps_size); +- ++ + FreeImageIO io; + SetMemoryIO(&io); +- ++ + psdParser parser; + parser.ReadImageResources(&io, handle, ps_size); +@@ -1292,7 +1312,6 @@ + FreeImage_CloseMemory(handle); + } +- + } +- ++ + // release thumbnail + FreeImage_Unload(thumbnail); +@@ -1366,5 +1385,5 @@ + // --------------------------------------------------------------------------------- + +- if(IsValidBitsPerSample(photometric, bitspersample) == FALSE) { ++ if(IsValidBitsPerSample(photometric, bitspersample, samplesperpixel) == FALSE) { + FreeImage_OutputMessageProc(s_format_id, + "Unable to handle this format: bitspersample = %d, samplesperpixel = %d, photometric = %d", +@@ -2204,15 +2223,22 @@ + throw FI_MSG_ERROR_UNSUPPORTED_FORMAT; + } +- +- // copy ICC profile data (must be done after FreeImage_Allocate) +- +- FreeImage_CreateICCProfile(dib, iccBuf, iccSize); +- if (photometric == PHOTOMETRIC_SEPARATED && asCMYK) { +- FreeImage_GetICCProfile(dib)->flags |= FIICC_COLOR_IS_CMYK; +- } +- ++ + // copy TIFF metadata (must be done after FreeImage_Allocate) + +- ReadMetadata(tif, dib); ++ ReadMetadata(io, handle, tif, dib); ++ ++ // copy ICC profile data (must be done after FreeImage_Allocate) ++ ++ FreeImage_CreateICCProfile(dib, iccBuf, iccSize); ++ if (photometric == PHOTOMETRIC_SEPARATED) { ++ if (asCMYK) { ++ // set the ICC profile as CMYK ++ FreeImage_GetICCProfile(dib)->flags |= FIICC_COLOR_IS_CMYK; ++ } ++ else { ++ // if original image is CMYK but is converted to RGB, remove ICC profile from Exif-TIFF metadata ++ FreeImage_SetMetadata(FIMD_EXIF_MAIN, dib, "InterColorProfile", NULL); ++ } ++ } + + // copy TIFF thumbnail (must be done after FreeImage_Allocate) +@@ -2220,5 +2246,5 @@ + ReadThumbnail(io, handle, data, tif, dib); + +- return (FIBITMAP *)dib; ++ return dib; + + } catch (const char *message) { Property changes on: files/patch-PluginTIFF.cpp ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-Source-OpenEXR-IlmImf_ImfAutoArray.h =================================================================== --- files/patch-Source-OpenEXR-IlmImf_ImfAutoArray.h (revision 438666) +++ files/patch-Source-OpenEXR-IlmImf_ImfAutoArray.h (nonexistent) @@ -1,11 +0,0 @@ ---- Source/OpenEXR/IlmImf/ImfAutoArray.h.orig 2013-01-30 11:10:28.000000000 +0100 -+++ Source/OpenEXR/IlmImf/ImfAutoArray.h 2013-01-30 12:05:10.000000000 +0100 -@@ -46,6 +46,8 @@ - - #include "OpenEXRConfig.h" - -+#include -+ - namespace Imf { - - Property changes on: files/patch-Source-OpenEXR-IlmImf_ImfAutoArray.h ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: files/patch-bug119 =================================================================== --- files/patch-bug119 (nonexistent) +++ files/patch-bug119 (working copy) @@ -0,0 +1,13 @@ +See https://sourceforge.net/p/freeimage/patches/119/ + + -mi + +--- Source/FreeImage/BitmapAccess.cpp 2015-03-02 02:07:08.000000000 -0500 ++++ Source/FreeImage/BitmapAccess.cpp 2017-05-02 22:52:43.370618000 -0400 +@@ -576,4 +576,6 @@ + // copy the bitmap + internal pointers (remember to restore new_dib internal pointers later) + memcpy(new_dib->data, dib->data, dib_size); ++ ((FREEIMAGEHEADER *)new_dib->data)->external_bits = NULL; ++ ((FREEIMAGEHEADER *)new_dib->data)->external_pitch = 0; + + // reset ICC profile link for new_dib Property changes on: files/patch-bug119 ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-const =================================================================== --- files/patch-const (nonexistent) +++ files/patch-const (working copy) @@ -0,0 +1,471 @@ +See https://sourceforge.net/p/freeimage/patches/128/ + + -mi + +--- Source/Utilities.h 2015-03-02 01:50:58.000000000 -0500 ++++ Source/Utilities.h 2017-05-02 23:00:30.970669000 -0400 +@@ -120,5 +120,5 @@ + @see FreeImage_GetRGBMasks + */ +-DLL_API BOOL DLL_CALLCONV FreeImage_HasRGBMasks(FIBITMAP *dib); ++DLL_API BOOL DLL_CALLCONV FreeImage_HasRGBMasks(const FIBITMAP *dib); + + #if defined(__cplusplus) +--- Source/FreeImage.h 2015-03-04 02:17:54.000000000 -0500 ++++ Source/FreeImage.h 2017-05-02 22:57:04.270492000 -0400 +@@ -808,9 +818,9 @@ + DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Allocate(int width, int height, int bpp, unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0)); + DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateT(FREE_IMAGE_TYPE type, int width, int height, int bpp FI_DEFAULT(8), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0)); +-DLL_API FIBITMAP * DLL_CALLCONV FreeImage_Clone(FIBITMAP *dib); ++DLL_API FIBITMAP * DLL_CALLCONV FreeImage_Clone(const FIBITMAP *dib); + DLL_API void DLL_CALLCONV FreeImage_Unload(FIBITMAP *dib); + + // Header loading routines +-DLL_API BOOL DLL_CALLCONV FreeImage_HasPixels(FIBITMAP *dib); ++DLL_API BOOL DLL_CALLCONV FreeImage_HasPixels(const FIBITMAP *dib); + + // Load / Save routines ----------------------------------------------------- +@@ -885,5 +895,5 @@ + // Image type request routine ----------------------------------------------- + +-DLL_API FREE_IMAGE_TYPE DLL_CALLCONV FreeImage_GetImageType(FIBITMAP *dib); ++DLL_API FREE_IMAGE_TYPE DLL_CALLCONV FreeImage_GetImageType(const FIBITMAP *dib); + + // FreeImage helper routines ------------------------------------------------ +@@ -895,57 +905,57 @@ + // Pixel access routines ---------------------------------------------------- + +-DLL_API BYTE *DLL_CALLCONV FreeImage_GetBits(FIBITMAP *dib); +-DLL_API BYTE *DLL_CALLCONV FreeImage_GetScanLine(FIBITMAP *dib, int scanline); ++DLL_API BYTE *DLL_CALLCONV FreeImage_GetBits(const FIBITMAP *dib); ++DLL_API BYTE *DLL_CALLCONV FreeImage_GetScanLine(const FIBITMAP *dib, int scanline); + +-DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value); +-DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value); +-DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value); +-DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value); ++DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelIndex(const FIBITMAP *dib, unsigned x, unsigned y, BYTE *value); ++DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelColor(const FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value); ++DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, const BYTE *value); ++DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, const RGBQUAD *value); + + // DIB info routines -------------------------------------------------------- + +-DLL_API unsigned DLL_CALLCONV FreeImage_GetColorsUsed(FIBITMAP *dib); +-DLL_API unsigned DLL_CALLCONV FreeImage_GetBPP(FIBITMAP *dib); +-DLL_API unsigned DLL_CALLCONV FreeImage_GetWidth(FIBITMAP *dib); +-DLL_API unsigned DLL_CALLCONV FreeImage_GetHeight(FIBITMAP *dib); +-DLL_API unsigned DLL_CALLCONV FreeImage_GetLine(FIBITMAP *dib); +-DLL_API unsigned DLL_CALLCONV FreeImage_GetPitch(FIBITMAP *dib); +-DLL_API unsigned DLL_CALLCONV FreeImage_GetDIBSize(FIBITMAP *dib); +-DLL_API unsigned DLL_CALLCONV FreeImage_GetMemorySize(FIBITMAP *dib); +-DLL_API RGBQUAD *DLL_CALLCONV FreeImage_GetPalette(FIBITMAP *dib); ++DLL_API unsigned DLL_CALLCONV FreeImage_GetColorsUsed(const FIBITMAP *dib); ++DLL_API unsigned DLL_CALLCONV FreeImage_GetBPP(const FIBITMAP *dib); ++DLL_API unsigned DLL_CALLCONV FreeImage_GetWidth(const FIBITMAP *dib); ++DLL_API unsigned DLL_CALLCONV FreeImage_GetHeight(const FIBITMAP *dib); ++DLL_API unsigned DLL_CALLCONV FreeImage_GetLine(const FIBITMAP *dib); ++DLL_API unsigned DLL_CALLCONV FreeImage_GetPitch(const FIBITMAP *dib); ++DLL_API unsigned DLL_CALLCONV FreeImage_GetDIBSize(const FIBITMAP *dib); ++DLL_API unsigned DLL_CALLCONV FreeImage_GetMemorySize(const FIBITMAP *dib); ++DLL_API RGBQUAD *DLL_CALLCONV FreeImage_GetPalette(const FIBITMAP *dib); + +-DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterX(FIBITMAP *dib); +-DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterY(FIBITMAP *dib); ++DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterX(const FIBITMAP *dib); ++DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterY(const FIBITMAP *dib); + DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterX(FIBITMAP *dib, unsigned res); + DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterY(FIBITMAP *dib, unsigned res); + +-DLL_API BITMAPINFOHEADER *DLL_CALLCONV FreeImage_GetInfoHeader(FIBITMAP *dib); +-DLL_API BITMAPINFO *DLL_CALLCONV FreeImage_GetInfo(FIBITMAP *dib); +-DLL_API FREE_IMAGE_COLOR_TYPE DLL_CALLCONV FreeImage_GetColorType(FIBITMAP *dib); +- +-DLL_API unsigned DLL_CALLCONV FreeImage_GetRedMask(FIBITMAP *dib); +-DLL_API unsigned DLL_CALLCONV FreeImage_GetGreenMask(FIBITMAP *dib); +-DLL_API unsigned DLL_CALLCONV FreeImage_GetBlueMask(FIBITMAP *dib); ++DLL_API BITMAPINFOHEADER *DLL_CALLCONV FreeImage_GetInfoHeader(const FIBITMAP *dib); ++DLL_API BITMAPINFO *DLL_CALLCONV FreeImage_GetInfo(const FIBITMAP *dib); ++DLL_API FREE_IMAGE_COLOR_TYPE DLL_CALLCONV FreeImage_GetColorType(const FIBITMAP *dib); ++ ++DLL_API unsigned DLL_CALLCONV FreeImage_GetRedMask(const FIBITMAP *dib); ++DLL_API unsigned DLL_CALLCONV FreeImage_GetGreenMask(const FIBITMAP *dib); ++DLL_API unsigned DLL_CALLCONV FreeImage_GetBlueMask(const FIBITMAP *dib); + +-DLL_API unsigned DLL_CALLCONV FreeImage_GetTransparencyCount(FIBITMAP *dib); +-DLL_API BYTE * DLL_CALLCONV FreeImage_GetTransparencyTable(FIBITMAP *dib); ++DLL_API unsigned DLL_CALLCONV FreeImage_GetTransparencyCount(const FIBITMAP *dib); ++DLL_API BYTE * DLL_CALLCONV FreeImage_GetTransparencyTable(const FIBITMAP *dib); + DLL_API void DLL_CALLCONV FreeImage_SetTransparent(FIBITMAP *dib, BOOL enabled); +-DLL_API void DLL_CALLCONV FreeImage_SetTransparencyTable(FIBITMAP *dib, BYTE *table, int count); +-DLL_API BOOL DLL_CALLCONV FreeImage_IsTransparent(FIBITMAP *dib); ++DLL_API void DLL_CALLCONV FreeImage_SetTransparencyTable(FIBITMAP *dib, const BYTE *table, int count); ++DLL_API BOOL DLL_CALLCONV FreeImage_IsTransparent(const FIBITMAP *dib); + DLL_API void DLL_CALLCONV FreeImage_SetTransparentIndex(FIBITMAP *dib, int index); +-DLL_API int DLL_CALLCONV FreeImage_GetTransparentIndex(FIBITMAP *dib); ++DLL_API int DLL_CALLCONV FreeImage_GetTransparentIndex(const FIBITMAP *dib); + +-DLL_API BOOL DLL_CALLCONV FreeImage_HasBackgroundColor(FIBITMAP *dib); +-DLL_API BOOL DLL_CALLCONV FreeImage_GetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor); +-DLL_API BOOL DLL_CALLCONV FreeImage_SetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor); ++DLL_API BOOL DLL_CALLCONV FreeImage_HasBackgroundColor(const FIBITMAP *dib); ++DLL_API BOOL DLL_CALLCONV FreeImage_GetBackgroundColor(const FIBITMAP *dib, RGBQUAD *bkcolor); ++DLL_API BOOL DLL_CALLCONV FreeImage_SetBackgroundColor(FIBITMAP *dib, const RGBQUAD *bkcolor); + +-DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetThumbnail(FIBITMAP *dib); +-DLL_API BOOL DLL_CALLCONV FreeImage_SetThumbnail(FIBITMAP *dib, FIBITMAP *thumbnail); ++DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetThumbnail(const FIBITMAP *dib); ++DLL_API BOOL DLL_CALLCONV FreeImage_SetThumbnail(FIBITMAP *dib, const FIBITMAP *thumbnail); + + // ICC profile routines ----------------------------------------------------- + +-DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_GetICCProfile(FIBITMAP *dib); +-DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_CreateICCProfile(FIBITMAP *dib, void *data, long size); +-DLL_API void DLL_CALLCONV FreeImage_DestroyICCProfile(FIBITMAP *dib); ++DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_GetICCProfile(const FIBITMAP *dib); ++DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_CreateICCProfile(const FIBITMAP *dib, const void *data, long size); ++DLL_API void DLL_CALLCONV FreeImage_DestroyICCProfile(const FIBITMAP *dib); + + // Line conversion routines ------------------------------------------------- +@@ -1043,11 +1053,11 @@ + + // tag getters and setters +-DLL_API const char *DLL_CALLCONV FreeImage_GetTagKey(FITAG *tag); +-DLL_API const char *DLL_CALLCONV FreeImage_GetTagDescription(FITAG *tag); +-DLL_API WORD DLL_CALLCONV FreeImage_GetTagID(FITAG *tag); +-DLL_API FREE_IMAGE_MDTYPE DLL_CALLCONV FreeImage_GetTagType(FITAG *tag); +-DLL_API DWORD DLL_CALLCONV FreeImage_GetTagCount(FITAG *tag); +-DLL_API DWORD DLL_CALLCONV FreeImage_GetTagLength(FITAG *tag); +-DLL_API const void *DLL_CALLCONV FreeImage_GetTagValue(FITAG *tag); ++DLL_API const char *DLL_CALLCONV FreeImage_GetTagKey(const FITAG *tag); ++DLL_API const char *DLL_CALLCONV FreeImage_GetTagDescription(const FITAG *tag); ++DLL_API WORD DLL_CALLCONV FreeImage_GetTagID(const FITAG *tag); ++DLL_API FREE_IMAGE_MDTYPE DLL_CALLCONV FreeImage_GetTagType(const FITAG *tag); ++DLL_API DWORD DLL_CALLCONV FreeImage_GetTagCount(const FITAG *tag); ++DLL_API DWORD DLL_CALLCONV FreeImage_GetTagLength(const FITAG *tag); ++DLL_API const void *DLL_CALLCONV FreeImage_GetTagValue(const FITAG *tag); + + DLL_API BOOL DLL_CALLCONV FreeImage_SetTagKey(FITAG *tag, const char *key); +@@ -1066,9 +1076,9 @@ + // metadata setter and getter + DLL_API BOOL DLL_CALLCONV FreeImage_SetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG *tag); +-DLL_API BOOL DLL_CALLCONV FreeImage_GetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG **tag); ++DLL_API BOOL DLL_CALLCONV FreeImage_GetMetadata(FREE_IMAGE_MDMODEL model, const FIBITMAP *dib, const char *key, FITAG **tag); + DLL_API BOOL DLL_CALLCONV FreeImage_SetMetadataKeyValue(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, const char *value); + + // helpers +-DLL_API unsigned DLL_CALLCONV FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL model, FIBITMAP *dib); ++DLL_API unsigned DLL_CALLCONV FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL model, const FIBITMAP *dib); + DLL_API BOOL DLL_CALLCONV FreeImage_CloneMetadata(FIBITMAP *dst, FIBITMAP *src); + +--- Source/FreeImage/PixelAccess.cpp 2015-03-02 02:07:08.000000000 -0500 ++++ Source/FreeImage/PixelAccess.cpp 2017-05-02 22:59:30.165541000 -0400 +@@ -29,5 +29,5 @@ + + BYTE * DLL_CALLCONV +-FreeImage_GetScanLine(FIBITMAP *dib, int scanline) { ++FreeImage_GetScanLine(const FIBITMAP *dib, int scanline) { + if(!FreeImage_HasPixels(dib)) { + return NULL; +--- Source/FreeImage/BitmapAccess.cpp 2015-03-02 02:07:08.000000000 -0500 ++++ Source/FreeImage/BitmapAccess.cpp 2017-05-02 22:52:43.370618000 -0400 +@@ -265,5 +265,5 @@ + */ + static FREEIMAGERGBMASKS * +-FreeImage_GetRGBMasks(FIBITMAP *dib) { ++FreeImage_GetRGBMasks(const FIBITMAP *dib) { + return FreeImage_HasRGBMasks(dib) ? (FREEIMAGERGBMASKS *)(((BYTE *)FreeImage_GetInfoHeader(dib)) + sizeof(BITMAPINFOHEADER)) : NULL; + } +@@ -534,5 +534,5 @@ + + FIBITMAP * DLL_CALLCONV +-FreeImage_Clone(FIBITMAP *dib) { ++FreeImage_Clone(const FIBITMAP *dib) { + if(!dib) { + return NULL; +@@ -637,5 +639,5 @@ + + BYTE * DLL_CALLCONV +-FreeImage_GetBits(FIBITMAP *dib) { ++FreeImage_GetBits(const FIBITMAP *dib) { + if(!FreeImage_HasPixels(dib)) { + return NULL; +@@ -659,10 +661,10 @@ + + FIBITMAP* DLL_CALLCONV +-FreeImage_GetThumbnail(FIBITMAP *dib) { ++FreeImage_GetThumbnail(const FIBITMAP *dib) { + return (dib != NULL) ? ((FREEIMAGEHEADER *)dib->data)->thumbnail : NULL; + } + + BOOL DLL_CALLCONV +-FreeImage_SetThumbnail(FIBITMAP *dib, FIBITMAP *thumbnail) { ++FreeImage_SetThumbnail(FIBITMAP *dib, const FIBITMAP *thumbnail) { + if(dib == NULL) { + return FALSE; +@@ -682,5 +684,5 @@ + + FREE_IMAGE_COLOR_TYPE DLL_CALLCONV +-FreeImage_GetColorType(FIBITMAP *dib) { ++FreeImage_GetColorType(const FIBITMAP *dib) { + RGBQUAD *rgb; + +@@ -803,5 +805,5 @@ + + FREE_IMAGE_TYPE DLL_CALLCONV +-FreeImage_GetImageType(FIBITMAP *dib) { ++FreeImage_GetImageType(const FIBITMAP *dib) { + return (dib != NULL) ? ((FREEIMAGEHEADER *)dib->data)->type : FIT_UNKNOWN; + } +@@ -810,5 +812,5 @@ + + BOOL DLL_CALLCONV +-FreeImage_HasPixels(FIBITMAP *dib) { ++FreeImage_HasPixels(const FIBITMAP *dib) { + return (dib != NULL) ? ((FREEIMAGEHEADER *)dib->data)->has_pixels : FALSE; + } +@@ -817,10 +819,10 @@ + + BOOL DLL_CALLCONV +-FreeImage_HasRGBMasks(FIBITMAP *dib) { ++FreeImage_HasRGBMasks(const FIBITMAP *dib) { + return dib && FreeImage_GetInfoHeader(dib)->biCompression == BI_BITFIELDS; + } + + unsigned DLL_CALLCONV +-FreeImage_GetRedMask(FIBITMAP *dib) { ++FreeImage_GetRedMask(const FIBITMAP *dib) { + FREEIMAGERGBMASKS *masks = NULL; + FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(dib); +@@ -839,5 +841,5 @@ + + unsigned DLL_CALLCONV +-FreeImage_GetGreenMask(FIBITMAP *dib) { ++FreeImage_GetGreenMask(const FIBITMAP *dib) { + FREEIMAGERGBMASKS *masks = NULL; + FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(dib); +@@ -856,5 +858,5 @@ + + unsigned DLL_CALLCONV +-FreeImage_GetBlueMask(FIBITMAP *dib) { ++FreeImage_GetBlueMask(const FIBITMAP *dib) { + FREEIMAGERGBMASKS *masks = NULL; + FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(dib); +@@ -875,5 +877,5 @@ + + BOOL DLL_CALLCONV +-FreeImage_HasBackgroundColor(FIBITMAP *dib) { ++FreeImage_HasBackgroundColor(const FIBITMAP *dib) { + if(dib) { + RGBQUAD *bkgnd_color = &((FREEIMAGEHEADER *)dib->data)->bkgnd_color; +@@ -884,5 +886,5 @@ + + BOOL DLL_CALLCONV +-FreeImage_GetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor) { ++FreeImage_GetBackgroundColor(const FIBITMAP *dib, RGBQUAD *bkcolor) { + if(dib && bkcolor) { + if(FreeImage_HasBackgroundColor(dib)) { +@@ -915,5 +917,5 @@ + + BOOL DLL_CALLCONV +-FreeImage_SetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor) { ++FreeImage_SetBackgroundColor(FIBITMAP *dib, const RGBQUAD *bkcolor) { + if(dib) { + RGBQUAD *bkgnd_color = &((FREEIMAGEHEADER *)dib->data)->bkgnd_color; +@@ -936,5 +938,5 @@ + + BOOL DLL_CALLCONV +-FreeImage_IsTransparent(FIBITMAP *dib) { ++FreeImage_IsTransparent(const FIBITMAP *dib) { + if(dib) { + FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(dib); +@@ -960,5 +962,5 @@ + + BYTE * DLL_CALLCONV +-FreeImage_GetTransparencyTable(FIBITMAP *dib) { ++FreeImage_GetTransparencyTable(const FIBITMAP *dib) { + return dib ? ((FREEIMAGEHEADER *)dib->data)->transparent_table : NULL; + } +@@ -976,10 +978,10 @@ + + unsigned DLL_CALLCONV +-FreeImage_GetTransparencyCount(FIBITMAP *dib) { ++FreeImage_GetTransparencyCount(const FIBITMAP *dib) { + return dib ? ((FREEIMAGEHEADER *)dib->data)->transparency_count : 0; + } + + void DLL_CALLCONV +-FreeImage_SetTransparencyTable(FIBITMAP *dib, BYTE *table, int count) { ++FreeImage_SetTransparencyTable(FIBITMAP *dib, const BYTE *table, int count) { + if (dib) { + count = MAX(0, MIN(count, 256)); +@@ -1047,5 +1049,5 @@ + */ + int DLL_CALLCONV +-FreeImage_GetTransparentIndex(FIBITMAP *dib) { ++FreeImage_GetTransparentIndex(const FIBITMAP *dib) { + int count = FreeImage_GetTransparencyCount(dib); + BYTE *tt = FreeImage_GetTransparencyTable(dib); +@@ -1061,5 +1063,5 @@ + + FIICCPROFILE * DLL_CALLCONV +-FreeImage_GetICCProfile(FIBITMAP *dib) { ++FreeImage_GetICCProfile(const FIBITMAP *dib) { + FIICCPROFILE *profile = (dib) ? (FIICCPROFILE *)&((FREEIMAGEHEADER *)dib->data)->iccProfile : NULL; + return profile; +@@ -1067,5 +1069,5 @@ + + FIICCPROFILE * DLL_CALLCONV +-FreeImage_CreateICCProfile(FIBITMAP *dib, void *data, long size) { ++FreeImage_CreateICCProfile(const FIBITMAP *dib, const void *data, long size) { + // clear the profile but preserve profile->flags + FreeImage_DestroyICCProfile(dib); +@@ -1082,5 +1084,5 @@ + + void DLL_CALLCONV +-FreeImage_DestroyICCProfile(FIBITMAP *dib) { ++FreeImage_DestroyICCProfile(const FIBITMAP *dib) { + FIICCPROFILE *profile = FreeImage_GetICCProfile(dib); + if(profile) { +@@ -1097,25 +1099,25 @@ + + unsigned DLL_CALLCONV +-FreeImage_GetWidth(FIBITMAP *dib) { ++FreeImage_GetWidth(const FIBITMAP *dib) { + return dib ? FreeImage_GetInfoHeader(dib)->biWidth : 0; + } + + unsigned DLL_CALLCONV +-FreeImage_GetHeight(FIBITMAP *dib) { ++FreeImage_GetHeight(const FIBITMAP *dib) { + return (dib) ? FreeImage_GetInfoHeader(dib)->biHeight : 0; + } + + unsigned DLL_CALLCONV +-FreeImage_GetBPP(FIBITMAP *dib) { ++FreeImage_GetBPP(const FIBITMAP *dib) { + return dib ? FreeImage_GetInfoHeader(dib)->biBitCount : 0; + } + + unsigned DLL_CALLCONV +-FreeImage_GetLine(FIBITMAP *dib) { ++FreeImage_GetLine(const FIBITMAP *dib) { + return dib ? ((FreeImage_GetWidth(dib) * FreeImage_GetBPP(dib)) + 7) / 8 : 0; + } + + unsigned DLL_CALLCONV +-FreeImage_GetPitch(FIBITMAP *dib) { ++FreeImage_GetPitch(const FIBITMAP *dib) { + if(dib) { + FREEIMAGEHEADER *fih = (FREEIMAGEHEADER *)dib->data; +@@ -1126,25 +1128,25 @@ + + unsigned DLL_CALLCONV +-FreeImage_GetColorsUsed(FIBITMAP *dib) { ++FreeImage_GetColorsUsed(const FIBITMAP *dib) { + return dib ? FreeImage_GetInfoHeader(dib)->biClrUsed : 0; + } + + unsigned DLL_CALLCONV +-FreeImage_GetDIBSize(FIBITMAP *dib) { ++FreeImage_GetDIBSize(const FIBITMAP *dib) { + return (dib) ? sizeof(BITMAPINFOHEADER) + (FreeImage_GetColorsUsed(dib) * sizeof(RGBQUAD)) + (FreeImage_GetPitch(dib) * FreeImage_GetHeight(dib)) : 0; + } + + RGBQUAD * DLL_CALLCONV +-FreeImage_GetPalette(FIBITMAP *dib) { ++FreeImage_GetPalette(const FIBITMAP *dib) { + return (dib && FreeImage_GetBPP(dib) < 16) ? (RGBQUAD *)(((BYTE *)FreeImage_GetInfoHeader(dib)) + sizeof(BITMAPINFOHEADER)) : NULL; + } + + unsigned DLL_CALLCONV +-FreeImage_GetDotsPerMeterX(FIBITMAP *dib) { ++FreeImage_GetDotsPerMeterX(const FIBITMAP *dib) { + return (dib) ? FreeImage_GetInfoHeader(dib)->biXPelsPerMeter : 0; + } + + unsigned DLL_CALLCONV +-FreeImage_GetDotsPerMeterY(FIBITMAP *dib) { ++FreeImage_GetDotsPerMeterY(const FIBITMAP *dib) { + return (dib) ? FreeImage_GetInfoHeader(dib)->biYPelsPerMeter : 0; + } +@@ -1165,5 +1167,5 @@ + + BITMAPINFOHEADER * DLL_CALLCONV +-FreeImage_GetInfoHeader(FIBITMAP *dib) { ++FreeImage_GetInfoHeader(const FIBITMAP *dib) { + if(!dib) { + return NULL; +@@ -1176,5 +1178,5 @@ + + BITMAPINFO * DLL_CALLCONV +-FreeImage_GetInfo(FIBITMAP *dib) { ++FreeImage_GetInfo(const FIBITMAP *dib) { + return (BITMAPINFO *)FreeImage_GetInfoHeader(dib); + } +@@ -1415,5 +1417,5 @@ + + BOOL DLL_CALLCONV +-FreeImage_GetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG **tag) { ++FreeImage_GetMetadata(FREE_IMAGE_MDMODEL model, const FIBITMAP *dib, const char *key, FITAG **tag) { + if(!dib || !key || !tag) { + return FALSE; +@@ -1481,5 +1483,5 @@ + + unsigned DLL_CALLCONV +-FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL model, FIBITMAP *dib) { ++FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL model, const FIBITMAP *dib) { + if(!dib) { + return FALSE; +@@ -1505,5 +1507,5 @@ + + unsigned DLL_CALLCONV +-FreeImage_GetMemorySize(FIBITMAP *dib) { ++FreeImage_GetMemorySize(const FIBITMAP *dib) { + if (!dib) { + return 0; +--- Source/Metadata/FreeImageTag.cpp 2015-03-04 03:21:12.000000000 -0500 ++++ Source/Metadata/FreeImageTag.cpp 2017-05-02 23:21:09.818306000 -0400 +@@ -150,35 +150,35 @@ + + const char * DLL_CALLCONV +-FreeImage_GetTagKey(FITAG *tag) { ++FreeImage_GetTagKey(const FITAG *tag) { + return tag ? ((FITAGHEADER *)tag->data)->key : 0; + } + + const char * DLL_CALLCONV +-FreeImage_GetTagDescription(FITAG *tag) { ++FreeImage_GetTagDescription(const FITAG *tag) { + return tag ? ((FITAGHEADER *)tag->data)->description : 0; + } + + WORD DLL_CALLCONV +-FreeImage_GetTagID(FITAG *tag) { ++FreeImage_GetTagID(const FITAG *tag) { + return tag ? ((FITAGHEADER *)tag->data)->id : 0; + } + + FREE_IMAGE_MDTYPE DLL_CALLCONV +-FreeImage_GetTagType(FITAG *tag) { ++FreeImage_GetTagType(const FITAG *tag) { + return tag ? (FREE_IMAGE_MDTYPE)(((FITAGHEADER *)tag->data)->type) : FIDT_NOTYPE; + } + + DWORD DLL_CALLCONV +-FreeImage_GetTagCount(FITAG *tag) { ++FreeImage_GetTagCount(const FITAG *tag) { + return tag ? ((FITAGHEADER *)tag->data)->count : 0; + } + + DWORD DLL_CALLCONV +-FreeImage_GetTagLength(FITAG *tag) { ++FreeImage_GetTagLength(const FITAG *tag) { + return tag ? ((FITAGHEADER *)tag->data)->length : 0; + } + + const void *DLL_CALLCONV +-FreeImage_GetTagValue(FITAG *tag) { ++FreeImage_GetTagValue(const FITAG *tag) { + return tag ? ((FITAGHEADER *)tag->data)->value : 0; + } Property changes on: files/patch-const ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-errorcheck =================================================================== --- files/patch-errorcheck (nonexistent) +++ files/patch-errorcheck (working copy) @@ -0,0 +1,138 @@ +See https://sourceforge.net/p/freeimage/patches/129/ + + -mi + +--- Source/FreeImage/PluginICO.cpp 2015-03-02 02:07:08.000000000 -0500 ++++ Source/FreeImage/PluginICO.cpp 2017-05-02 21:06:46.209285000 -0400 +@@ -203,5 +203,8 @@ + ICONHEADER icon_header; + +- io->read_proc(&icon_header, sizeof(ICONHEADER), 1, handle); ++ if (io->read_proc(&icon_header, sizeof(ICONHEADER), 1, handle) == 0) ++ // XXX should we not report the error somehow? ++ return 0; ++ + #ifdef FREEIMAGE_BIGENDIAN + SwapIconHeader(&icon_header); +--- Source/FreeImage/PluginTARGA.cpp 2015-03-02 02:07:08.000000000 -0500 ++++ Source/FreeImage/PluginTARGA.cpp 2017-05-02 21:08:12.217655000 -0400 +@@ -28,4 +28,5 @@ + #include "FreeImage.h" + #include "Utilities.h" ++#include + + // ---------------------------------------------------------- +@@ -363,11 +364,21 @@ + BYTE tga_signature[sizeofSig] = { 84, 82, 85, 69, 86, 73, 83, 73, 79, 78, 45, 88, 70, 73, 76, 69, 46, 0 }; + // get the start offset +- const long start_offset = io->tell_proc(handle); ++ long start_offset = io->tell_proc(handle); ++ if (start_offset == -1) { ++ warn("%s", __func__); ++ return 0; ++ } + // get the end-of-file +- io->seek_proc(handle, 0, SEEK_END); ++ if (io->seek_proc(handle, 0, SEEK_END) == -1) ++ return 0; + const long eof = io->tell_proc(handle); + // read the signature +- io->seek_proc(handle, start_offset + eof - sizeofSig, SEEK_SET); +- io->read_proc(&signature, 1, sizeofSig, handle); ++ if (eof == -1) { ++ warn("%s", __func__); ++ return 0; ++ } ++ if (io->seek_proc(handle, start_offset + eof - sizeofSig, SEEK_SET) == -1 || ++ io->read_proc(&signature, 1, sizeofSig, handle) == 0) ++ return 0; + // rewind + io->seek_proc(handle, start_offset, SEEK_SET); +@@ -388,5 +399,6 @@ + // get the header + TGAHEADER header; +- io->read_proc(&header, sizeof(tagTGAHEADER), 1, handle); ++ if (io->read_proc(&header, sizeof(tagTGAHEADER), 1, handle) == 0) ++ return 0; + #ifdef FREEIMAGE_BIGENDIAN + SwapHeader(&header); +--- Source/FreeImage/PluginXBM.cpp 2015-03-02 02:07:08.000000000 -0500 ++++ Source/FreeImage/PluginXBM.cpp 2017-05-02 21:12:16.631388000 -0400 +@@ -56,8 +56,8 @@ + do { + count = io->read_proc(&c, 1, 1, handle); ++ if (count == 0) ++ return NULL; + str[i++] = c; + } while((c != '\n') && (i < n)); +- if(count <= 0) +- return NULL; + str[i] = '\0'; + return str; +--- Source/FreeImage/PluginRAW.cpp 2015-03-08 20:12:04.000000000 -0400 ++++ Source/FreeImage/PluginRAW.cpp 2017-05-02 22:13:23.679157000 -0400 +@@ -20,9 +20,10 @@ + // ========================================================== + +-#include "../LibRawLite/libraw/libraw.h" ++#include ++#include + + #include "FreeImage.h" + #include "Utilities.h" +-#include "../Metadata/FreeImageTag.h" ++#include + + // ========================================================== +@@ -48,10 +49,23 @@ + + public: +- LibRaw_freeimage_datastream(FreeImageIO *io, fi_handle handle) : _io(io), _handle(handle) { ++ LibRaw_freeimage_datastream(FreeImageIO *io, fi_handle handle) : _io(NULL), _handle(NULL) { + long start_pos = io->tell_proc(handle); +- io->seek_proc(handle, 0, SEEK_END); ++ if (start_pos == -1) { ++ warn("%s", __func__); ++ return; ++ } ++ if (io->seek_proc(handle, 0, SEEK_END) == -1) ++ return; // XXX What's there to say? + _eof = io->tell_proc(handle); ++ if (_eof == -1) { ++ warn("%s", __func__); ++ return; ++ } + _fsize = _eof - start_pos; +- io->seek_proc(handle, start_pos, SEEK_SET); ++ if (_fsize < 32 || ++ io->seek_proc(handle, start_pos, SEEK_SET) == -1) ++ return; ++ _handle = handle; ++ _io = io; + } + +@@ -617,8 +631,14 @@ + { + long tell = io->tell_proc(handle); ++ ++ if (tell == -1) { ++ warn("PluginRAW"); ++ return 0; ++ } ++ + if( HasMagicHeader(io, handle) ) { + return TRUE; +- } else { +- io->seek_proc(handle, tell, SEEK_SET); ++ } else if (io->seek_proc(handle, tell, SEEK_SET) == -1) { ++ return 0; + } + } +@@ -636,5 +656,6 @@ + + // open the datastream +- if(RawProcessor->open_datastream(&datastream) != LIBRAW_SUCCESS) { ++ if (!datastream.valid() || ++ RawProcessor->open_datastream(&datastream) != LIBRAW_SUCCESS) { + bSuccess = FALSE; // LibRaw : failed to open input stream (unknown format) + } Property changes on: files/patch-errorcheck ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-integer_overflow_ljpeg_start =================================================================== --- files/patch-integer_overflow_ljpeg_start (revision 438666) +++ files/patch-integer_overflow_ljpeg_start (nonexistent) @@ -1,34 +0,0 @@ -Description: Fix integer overflow in the ljpeg_start function in dcraw -Author: Alex Tutubalin -Bug-Debian: https://bugs.debian.org/786790 -Origin: https://github.com/LibRaw/LibRaw/commit/4606c28f494a750892c5c1ac7903e62dd1c6fdb5 - https://github.com/rawstudio/rawstudio/commit/983bda1f0fa5fa86884381208274198a620f006e -Bug: https://security-tracker.debian.org/tracker/CVE-2015-3885 -Bug: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-3885 -Reviewed-By: Anton Gladky -Last-Update: 2015-10-29 - ---- freeimage-3.15.4.orig/Source/LibRawLite/dcraw/dcraw.c -+++ Source/LibRawLite/dcraw/dcraw.c -@@ -768,7 +768,8 @@ struct jhead { - - int CLASS ljpeg_start (struct jhead *jh, int info_only) - { -- int c, tag, len; -+ int c, tag; -+ ushort len; - uchar data[0x10000]; - const uchar *dp; - ---- freeimage-3.15.4.orig/Source/LibRawLite/internal/dcraw_common.cpp -+++ Source/LibRawLite/internal/dcraw_common.cpp -@@ -630,7 +630,8 @@ void CLASS canon_compressed_load_raw() - - int CLASS ljpeg_start (struct jhead *jh, int info_only) - { -- int c, tag, len; -+ int c, tag; -+ ushort len; - uchar data[0x10000]; - const uchar *dp; - Property changes on: files/patch-integer_overflow_ljpeg_start ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: files/patch-jpeg =================================================================== --- files/patch-jpeg (nonexistent) +++ files/patch-jpeg (working copy) @@ -0,0 +1,13 @@ +--- Source/FreeImage/PluginJPEG.cpp 2015-03-02 02:07:08.000000000 -0500 ++++ Source/FreeImage/PluginJPEG.cpp 2017-04-14 17:48:13.304868000 -0400 +@@ -36,7 +36,7 @@ + #include + +-#include "../LibJPEG/jinclude.h" +-#include "../LibJPEG/jpeglib.h" +-#include "../LibJPEG/jerror.h" ++#include ++#include ++#include + } + Property changes on: files/patch-jpeg ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-jpeg-cmyk =================================================================== --- files/patch-jpeg-cmyk (nonexistent) +++ files/patch-jpeg-cmyk (working copy) @@ -0,0 +1,76 @@ +--- Source/FreeImage/PluginJPEG.cpp 2015-03-02 02:07:08.000000000 -0500 ++++ Source/FreeImage/PluginJPEG.cpp 2017-04-16 15:21:32.068749000 -0400 +@@ -1128,6 +1128,7 @@ + SupportsExportDepth(int depth) { + return ( +- (depth == 8) || +- (depth == 24) ++ (depth == 8) || ++ (depth == 24) || ++ (depth == 32) // only if 32-bit CMYK + ); + } +@@ -1317,4 +1318,8 @@ + } + } ++ ++ // if original image is CMYK but is converted to RGB, remove ICC profile from Exif-TIFF metadata ++ FreeImage_SetMetadata(FIMD_EXIF_MAIN, dib, "InterColorProfile", NULL); ++ + } else if((cinfo.out_color_space == JCS_CMYK) && ((flags & JPEG_CMYK) == JPEG_CMYK)) { + // convert from LibJPEG CMYK to standard CMYK +@@ -1402,10 +1407,10 @@ + // Check dib format + +- const char *sError = "only 24-bit highcolor or 8-bit greyscale/palette bitmaps can be saved as JPEG"; ++ const char *sError = "only 24-bit RGB, 8-bit greyscale/palette or 32-bit CMYK bitmaps can be saved as JPEG"; + + FREE_IMAGE_COLOR_TYPE color_type = FreeImage_GetColorType(dib); + WORD bpp = (WORD)FreeImage_GetBPP(dib); + +- if ((bpp != 24) && (bpp != 8)) { ++ if ((bpp != 24) && (bpp != 8) && !(bpp == 32 && (color_type == FIC_CMYK))) { + throw sError; + } +@@ -1456,5 +1461,8 @@ + cinfo.input_components = 1; + break; +- ++ case FIC_CMYK: ++ cinfo.in_color_space = JCS_CMYK; ++ cinfo.input_components = 4; ++ break; + default : + cinfo.in_color_space = JCS_RGB; +@@ -1600,4 +1608,31 @@ + free(target); + } ++ else if(color_type == FIC_CMYK) { ++ unsigned pitch = FreeImage_GetPitch(dib); ++ BYTE *target = (BYTE*)malloc(pitch * sizeof(BYTE)); ++ if (target == NULL) { ++ throw FI_MSG_ERROR_MEMORY; ++ } ++ ++ while (cinfo.next_scanline < cinfo.image_height) { ++ // get a copy of the scanline ++ memcpy(target, FreeImage_GetScanLine(dib, FreeImage_GetHeight(dib) - cinfo.next_scanline - 1), pitch); ++ ++ BYTE *target_p = target; ++ for(unsigned x = 0; x < cinfo.image_width; x++) { ++ // CMYK pixels are inverted ++ target_p[0] = ~target_p[0]; // C ++ target_p[1] = ~target_p[1]; // M ++ target_p[2] = ~target_p[2]; // Y ++ target_p[3] = ~target_p[3]; // K ++ ++ target_p += 4; ++ } ++ ++ // write the scanline ++ jpeg_write_scanlines(&cinfo, &target, 1); ++ } ++ free(target); ++ } + else if(color_type == FIC_MINISBLACK) { + // 8-bit standard greyscale images Property changes on: files/patch-jpeg-cmyk ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-jxr =================================================================== --- files/patch-jxr (nonexistent) +++ files/patch-jxr (working copy) @@ -0,0 +1,11 @@ +--- Source/FreeImage/PluginJXR.cpp 2015-03-02 02:07:08.000000000 -0500 ++++ Source/FreeImage/PluginJXR.cpp 2017-04-15 00:26:28.574254000 -0400 +@@ -23,5 +23,6 @@ + #include "Utilities.h" +-#include "../Metadata/FreeImageTag.h" ++#include + +-#include "../LibJXR/jxrgluelib/JXRGlue.h" ++#define __ANSI__ ++#include + Property changes on: files/patch-jxr ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-nog3 =================================================================== --- files/patch-nog3 (nonexistent) +++ files/patch-nog3 (working copy) @@ -0,0 +1,22 @@ +Building the G3 plugin is of questionable utility, but +requires access to data not officially exported by libtiff. + +Disable it... + + -mi +--- Source/FreeImage/Plugin.cpp 2015-03-02 02:07:08.000000000 -0500 ++++ Source/FreeImage/Plugin.cpp 2017-04-15 01:11:48.347512000 -0400 +@@ -39,5 +39,5 @@ + #include "Plugin.h" + +-#include "../Metadata/FreeImageTag.h" ++#include + + // ===================================================================== +@@ -264,5 +264,5 @@ + s_plugins->AddNode(InitGIF); + s_plugins->AddNode(InitHDR); +- s_plugins->AddNode(InitG3); ++// s_plugins->AddNode(InitG3); + s_plugins->AddNode(InitSGI); + s_plugins->AddNode(InitEXR); Property changes on: files/patch-nog3 ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-png =================================================================== --- files/patch-png (nonexistent) +++ files/patch-png (working copy) @@ -0,0 +1,109 @@ +Based on: + + From: Ghislain Antony Vaillant + Date: Tue, 3 Nov 2015 15:20:45 +0000 + Subject: Fix compatibility with system libpng. + + [Ghislain Antony Vaillant] + The PNG plugin of FreeImage makes use of optional features of libpng, which + are not enabled in Debian. This commit adds the necessary guards for FreeImage + to compile and run without these features. + + [Tobias Frost] + Fix FTBFS with libpng 1.6. + +--- Source/FreeImage/PluginPNG.cpp ++++ Source/FreeImage/PluginPNG.cpp +@@ -109,9 +109,11 @@ ReadMetadata(png_structp png_ptr, png_infop info_ptr, FIBITMAP *dib) { + // create a tag + tag = FreeImage_CreateTag(); + if(!tag) return FALSE; +- ++#ifdef PNG_iTXt_SUPPORTED + DWORD tag_length = (DWORD) MAX(text_ptr[i].text_length, text_ptr[i].itxt_length); +- ++#else ++ DWORD tag_length = text_ptr[i].text_length; ++#endif + FreeImage_SetTagLength(tag, tag_length); + FreeImage_SetTagCount(tag, tag_length); + FreeImage_SetTagType(tag, FIDT_ASCII); +@@ -179,14 +181,19 @@ WriteMetadata(png_structp png_ptr, png_infop info_ptr, FIBITMAP *dib) { + if(mdhandle) { + do { + memset(&text_metadata, 0, sizeof(png_text)); ++#ifdef PNG_iTXt_SUPPORTED + text_metadata.compression = 1; // iTXt, none ++#else ++ text_metadata.compression = -1; ++#endif + text_metadata.key = (char*)FreeImage_GetTagKey(tag); // keyword, 1-79 character description of "text" + text_metadata.text = (char*)FreeImage_GetTagValue(tag); // comment, may be an empty string (ie "") + text_metadata.text_length = FreeImage_GetTagLength(tag);// length of the text string ++#ifdef PNG_iTXt_SUPPORTED + text_metadata.itxt_length = FreeImage_GetTagLength(tag);// length of the itxt string + text_metadata.lang = 0; // language code, 0-79 characters or a NULL pointer + text_metadata.lang_key = 0; // keyword translated UTF-8 string, 0 or more chars or a NULL pointer +- ++#endif + // set the tag + png_set_text(png_ptr, info_ptr, &text_metadata, 1); + +@@ -205,10 +212,11 @@ WriteMetadata(png_structp png_ptr, png_infop info_ptr, FIBITMAP *dib) { + text_metadata.key = (char*)g_png_xmp_keyword; // keyword, 1-79 character description of "text" + text_metadata.text = (char*)FreeImage_GetTagValue(tag); // comment, may be an empty string (ie "") + text_metadata.text_length = FreeImage_GetTagLength(tag);// length of the text string ++#ifdef PNG_iTXt_SUPPORTED + text_metadata.itxt_length = FreeImage_GetTagLength(tag);// length of the itxt string + text_metadata.lang = 0; // language code, 0-79 characters or a NULL pointer + text_metadata.lang_key = 0; // keyword translated UTF-8 string, 0 or more chars or a NULL pointer +- ++#endif + // set the tag + png_set_text(png_ptr, info_ptr, &text_metadata, 1); + bResult &= TRUE; +@@ -705,11 +713,19 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { + + if (png_get_valid(png_ptr, info_ptr, PNG_INFO_iCCP)) { + png_charp profile_name = NULL; +- png_bytep profile_data = NULL; ++#if PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 4 || PNG_LIBPNG_VER_MAJOR > 1 ++ png_bytepp profile_data = NULL; ++#else ++ png_charp profile_data = NULL; ++#endif + png_uint_32 profile_length = 0; + int compression_type; + ++#if PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 4 || PNG_LIBPNG_VER_MAJOR > 1 ++ png_get_iCCP(png_ptr, info_ptr, &profile_name, &compression_type, profile_data, &profile_length); ++#else + png_get_iCCP(png_ptr, info_ptr, &profile_name, &compression_type, &profile_data, &profile_length); ++#endif + + // copy ICC profile data (must be done after FreeImage_AllocateHeader) + +@@ -744,8 +760,9 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { + for (png_uint_32 k = 0; k < height; k++) { + row_pointers[height - 1 - k] = FreeImage_GetScanLine(dib, k); + } +- ++#ifdef PNG_BENIGN_ERRORS_SUPPORTED + png_set_benign_errors(png_ptr, 1); ++#endif + png_read_image(png_ptr, row_pointers); + + // check if the bitmap contains transparency, if so enable it in the header +@@ -991,7 +1008,11 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void + + FIICCPROFILE *iccProfile = FreeImage_GetICCProfile(dib); + if (iccProfile->size && iccProfile->data) { +- png_set_iCCP(png_ptr, info_ptr, "Embedded Profile", 0, (png_const_bytep)iccProfile->data, iccProfile->size); ++#if PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 4 || PNG_LIBPNG_VER_MAJOR > 1 ++ //png_set_iCCP(png_ptr, info_ptr, "Embedded Profile", 0, (png_const_bytep)iccProfile->data, iccProfile->size); ++#else ++ png_set_iCCP(png_ptr, info_ptr, "Embedded Profile", 0, (png_charp)iccProfile->data, iccProfile->size); ++#endif + } + + // write metadata Property changes on: files/patch-png ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-raw-flags =================================================================== --- files/patch-raw-flags (nonexistent) +++ files/patch-raw-flags (working copy) @@ -0,0 +1,57 @@ +From: https://sourceforge.net/p/freeimage/patches/125/ + +--- Source/FreeImage/PluginRAW.cpp 2015-03-08 20:12:04.000000000 -0500 ++++ Source/FreeImage/PluginRAW.cpp 2016-06-26 09:10:48.000000000 -0500 +@@ -702,6 +702,31 @@ + // (-h) outputs the image in 50% size + RawProcessor->imgdata.params.half_size = ((flags & RAW_HALFSIZE) == RAW_HALFSIZE) ? 1 : 0; + ++ // Output Colorspace (-o [0-5]): ++ // raw: ++ if ((flags & RAW_COLOR_RAW) == RAW_COLOR_RAW) RawProcessor->imgdata.params.output_color = 0; ++ // sRGB D65: ++ if ((flags & RAW_COLOR_SRGB) == RAW_COLOR_SRGB) RawProcessor->imgdata.params.output_color = 1; ++ // Adobe RGB (1998) D65: ++ if ((flags & RAW_COLOR_ADOBE) == RAW_COLOR_ADOBE)RawProcessor->imgdata.params.output_color = 2; ++ // Wide Gamut RGB D65: ++ if ((flags & RAW_COLOR_WIDE) == RAW_COLOR_WIDE) RawProcessor->imgdata.params.output_color = 3; ++ // Kodak ProPhoto RGB D65: ++ if ((flags & RAW_COLOR_PROPHOTO) == RAW_COLOR_PROPHOTO) RawProcessor->imgdata.params.output_color = 4; ++ // XYZ: ++ if ((flags & RAW_COLOR_XYZ) == RAW_COLOR_XYZ) RawProcessor->imgdata.params.output_color = 5; ++ ++ // Demosaic interpolation algorithm (-q [0-3]): ++ // linear interpolatin: ++ if ((flags & RAW_QUAL_LINEAR) == RAW_QUAL_LINEAR) RawProcessor->imgdata.params.user_qual = 0; ++ // Variable Number of Gradients (VNG) interpolation: ++ if ((flags & RAW_QUAL_VNG) == RAW_QUAL_VNG) RawProcessor->imgdata.params.user_qual = 1; ++ // Patterned Pixel Grouping (PPG) interpolation: ++ if ((flags & RAW_QUAL_PPG) == RAW_QUAL_PPG)RawProcessor->imgdata.params.user_qual = 2; ++ // Adaptive Homogeneity-Directed (AHD) interpolation: ++ if ((flags & RAW_QUAL_AHD) == RAW_QUAL_AHD) RawProcessor->imgdata.params.user_qual = 3; ++ ++ + // open the datastream + if(RawProcessor->open_datastream(&datastream) != LIBRAW_SUCCESS) { + throw "LibRaw : failed to open input stream (unknown format)"; +diff -ur FreeImage3170.orig\Source\/FreeImage.h FreeImage3170.ggb\Source\/FreeImage.h +--- Source/FreeImage.h 2015-03-04 01:17:54.000000000 -0600 ++++ Source/FreeImage.h 2016-06-26 08:48:10.000000000 -0500 +@@ -737,6 +737,17 @@ + #define RAW_DISPLAY 2 //! load the file as RGB 24-bit + #define RAW_HALFSIZE 4 //! output a half-size color image + #define RAW_UNPROCESSED 8 //! output a FIT_UINT16 raw Bayer image ++#define RAW_COLOR_RAW 0x0010 // raw colorspace ++#define RAW_COLOR_SRGB 0x0020 // sRGB D65 colorspace ++#define RAW_COLOR_ADOBE 0x0040 // Adobe RGB (1998) D65 colorspace ++#define RAW_COLOR_WIDE 0x0080 // Wide Gamut RGB D65 colorspace ++#define RAW_COLOR_PROPHOTO 0x0100 // Kodak ProPhoto RGB D65 colorspace ++#define RAW_COLOR_XYZ 0x0200 // XYZ colorspace ++#define RAW_COLOR_ACES 0x0400 // ACES (in dcraw, not yet implemented in libraw) ++#define RAW_QUAL_LINEAR 0x0800 // linear interpolation ++#define RAW_QUAL_VNG 0x1000 // Variable Number of Gradients (VNG) interpolation ++#define RAW_QUAL_PPG 0x2000 // Patterned Pixel Grouping (PPG) interpolation ++#define RAW_QUAL_AHD 0x4000 // Adaptive Homogeneity-Directed (AHD) interpolation + #define SGI_DEFAULT 0 + #define TARGA_DEFAULT 0 + #define TARGA_LOAD_RGB888 1 //! if set the loader converts RGB555 and ARGB8888 -> RGB888. Property changes on: files/patch-raw-flags ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-warnings =================================================================== --- files/patch-warnings (nonexistent) +++ files/patch-warnings (working copy) @@ -0,0 +1,282 @@ +--- Source/FreeImage/PluginGIF.cpp 2017-05-02 13:55:26.070704000 -0400 ++++ Source/FreeImage/PluginGIF.cpp 2017-05-02 14:15:34.249511000 -0400 +@@ -825,5 +825,5 @@ + FITAG *tag; + if( FreeImage_GetMetadataEx(FIMD_ANIMATION, pagedib, "FrameTime", FIDT_LONG, &tag) ) { +- delay_time = *(LONG *)FreeImage_GetTagValue(tag); ++ delay_time = *(uint32_t *)FreeImage_GetTagValue(tag); + } + } +@@ -992,5 +992,5 @@ + + //Application Extension +- LONG loop = 1; //If no AE with a loop count is found, the default must be 1 ++ uint32_t loop = 1; //If no AE with a loop count is found, the default must be 1 + for( idx = 0; idx < info->application_extension_offsets.size(); idx++ ) { + io->seek_proc(handle, (long)info->application_extension_offsets[idx], SEEK_SET); +@@ -1028,5 +1028,5 @@ + } + comment.append(1, '\0'); +- sprintf(buf, "Comment%d", idx); ++ sprintf(buf, "Comment%zu", idx); + DWORD comment_size = (DWORD)comment.size(); + FreeImage_SetMetadataEx(FIMD_COMMENTS, dib, buf, 1, FIDT_ASCII, comment_size, comment_size, comment.c_str()); +@@ -1112,5 +1112,5 @@ + } + if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "FrameTime", FIDT_LONG, &tag) ) { +- delay_time = *(LONG *)FreeImage_GetTagValue(tag); ++ delay_time = *(uint32_t *)FreeImage_GetTagValue(tag); + } + if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "DisposalMethod", FIDT_BYTE, &tag) ) { +@@ -1215,7 +1215,7 @@ + + //Application Extension +- LONG loop = 0; ++ uint32_t loop = 0; + if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "Loop", FIDT_LONG, &tag) ) { +- loop = *(LONG *)FreeImage_GetTagValue(tag); ++ loop = *(uint32_t *)FreeImage_GetTagValue(tag); + } + if( loop != 1 ) { +--- Source/FreeImage/PluginPICT.cpp 2015-03-02 02:07:08.000000000 -0500 ++++ Source/FreeImage/PluginPICT.cpp 2017-04-14 19:51:56.531330000 -0400 +@@ -959,5 +959,5 @@ + try { + // Skip empty 512 byte header. +- if ( !io->seek_proc(handle, 512, SEEK_CUR) == 0 ) ++ if (io->seek_proc(handle, 512, SEEK_CUR) != 0) + return NULL; + +--- Source/FreeImageToolkit/CopyPaste.cpp 2015-03-02 02:07:10.000000000 -0500 ++++ Source/FreeImageToolkit/CopyPaste.cpp 2017-04-14 19:58:50.520119000 -0400 +@@ -800,5 +800,5 @@ + unsigned width = FreeImage_GetWidth(dib); + unsigned height = FreeImage_GetHeight(dib); +- if (left < 0 || right > width || top < 0 || bottom > height) { ++ if (right > width || bottom > height) { + return NULL; + } +--- Source/Metadata/TagConversion.cpp 2015-03-02 02:07:10.000000000 -0500 ++++ Source/Metadata/TagConversion.cpp 2017-05-02 15:23:47.348985000 -0400 +@@ -35,8 +35,9 @@ + */ + static const char* +-ConvertAnyTag(FITAG *tag) { ++ConvertAnyTag(const FITAG *tag) { + char format[MAX_TEXT_EXTENT]; + static std::string buffer; + DWORD i; ++ const void *pv; + + if(!tag) +@@ -49,14 +50,15 @@ + FREE_IMAGE_MDTYPE tag_type = FreeImage_GetTagType(tag); + DWORD tag_count = FreeImage_GetTagCount(tag); ++ pv = FreeImage_GetTagValue(tag); + + switch(tag_type) { + case FIDT_BYTE: // N x 8-bit unsigned integer + { +- BYTE *pvalue = (BYTE*)FreeImage_GetTagValue(tag); ++ const uint8_t *pvalue = (const uint8_t *)pv; + +- sprintf(format, "%ld", (LONG) pvalue[0]); ++ sprintf(format, "%u", (unsigned)pvalue[0]); + buffer += format; + for(i = 1; i < tag_count; i++) { +- sprintf(format, " %ld", (LONG) pvalue[i]); ++ sprintf(format, " %u", (unsigned)pvalue[i]); + buffer += format; + } +@@ -65,5 +67,5 @@ + case FIDT_SHORT: // N x 16-bit unsigned integer + { +- unsigned short *pvalue = (unsigned short *)FreeImage_GetTagValue(tag); ++ const uint16_t *pvalue = (const uint16_t *)pv; + + sprintf(format, "%hu", pvalue[0]); +@@ -77,10 +79,10 @@ + case FIDT_LONG: // N x 32-bit unsigned integer + { +- DWORD *pvalue = (DWORD *)FreeImage_GetTagValue(tag); ++ const uint32_t *pvalue = (const uint32_t *)pv; + +- sprintf(format, "%lu", pvalue[0]); ++ sprintf(format, "%u", (unsigned)pvalue[0]); + buffer += format; + for(i = 1; i < tag_count; i++) { +- sprintf(format, " %lu", pvalue[i]); ++ sprintf(format, " %u", (unsigned)pvalue[i]); + buffer += format; + } +@@ -89,10 +91,10 @@ + case FIDT_RATIONAL: // N x 64-bit unsigned fraction + { +- DWORD *pvalue = (DWORD*)FreeImage_GetTagValue(tag); ++ const uint32_t *pvalue = (const uint32_t *)pv; + +- sprintf(format, "%ld/%ld", pvalue[0], pvalue[1]); ++ sprintf(format, "%lu/%lu", (unsigned long)pvalue[0], (unsigned long)pvalue[1]); + buffer += format; + for(i = 1; i < tag_count; i++) { +- sprintf(format, " %ld/%ld", pvalue[2*i], pvalue[2*i+1]); ++ sprintf(format, " %lu/%lu", (unsigned long)pvalue[2*i], (unsigned long)pvalue[2*i+1]); + buffer += format; + } +@@ -101,10 +103,10 @@ + case FIDT_SBYTE: // N x 8-bit signed integer + { +- char *pvalue = (char*)FreeImage_GetTagValue(tag); ++ const int8_t *pvalue = (const int8_t *)pv; + +- sprintf(format, "%ld", (LONG) pvalue[0]); ++ sprintf(format, "%d", (int)pvalue[0]); + buffer += format; + for(i = 1; i < tag_count; i++) { +- sprintf(format, " %ld", (LONG) pvalue[i]); ++ sprintf(format, " %d", (int)pvalue[i]); + buffer += format; + } +@@ -113,10 +115,10 @@ + case FIDT_SSHORT: // N x 16-bit signed integer + { +- short *pvalue = (short *)FreeImage_GetTagValue(tag); ++ const int16_t *pvalue = (const int16_t *)pv; + +- sprintf(format, "%hd", pvalue[0]); ++ sprintf(format, "%hd", (short)pvalue[0]); + buffer += format; + for(i = 1; i < tag_count; i++) { +- sprintf(format, " %hd", pvalue[i]); ++ sprintf(format, " %hd", (short)pvalue[i]); + buffer += format; + } +@@ -125,10 +127,10 @@ + case FIDT_SLONG: // N x 32-bit signed integer + { +- LONG *pvalue = (LONG *)FreeImage_GetTagValue(tag); ++ const int32_t *pvalue = (const int32_t *)pv; + +- sprintf(format, "%ld", pvalue[0]); ++ sprintf(format, "%ld", (long)pvalue[0]); + buffer += format; + for(i = 1; i < tag_count; i++) { +- sprintf(format, " %ld", pvalue[i]); ++ sprintf(format, " %ld", (long)pvalue[i]); + buffer += format; + } +@@ -137,10 +139,10 @@ + case FIDT_SRATIONAL:// N x 64-bit signed fraction + { +- LONG *pvalue = (LONG*)FreeImage_GetTagValue(tag); ++ const int64_t *pvalue = (const int64_t *)pv; + +- sprintf(format, "%ld/%ld", pvalue[0], pvalue[1]); ++ sprintf(format, "%ld/%ld", (long)pvalue[0], (long)pvalue[1]); + buffer += format; + for(i = 1; i < tag_count; i++) { +- sprintf(format, " %ld/%ld", pvalue[2*i], pvalue[2*i+1]); ++ sprintf(format, " %ld/%ld", (long)pvalue[2*i], (long)pvalue[2*i+1]); + buffer += format; + } +@@ -149,5 +151,5 @@ + case FIDT_FLOAT: // N x 32-bit IEEE floating point + { +- float *pvalue = (float *)FreeImage_GetTagValue(tag); ++ const float *pvalue = (const float *)pv; + + sprintf(format, "%f", (double) pvalue[0]); +@@ -161,5 +163,5 @@ + case FIDT_DOUBLE: // N x 64-bit IEEE floating point + { +- double *pvalue = (double *)FreeImage_GetTagValue(tag); ++ const double *pvalue = (const double *)pv; + + sprintf(format, "%f", pvalue[0]); +@@ -173,10 +175,10 @@ + case FIDT_IFD: // N x 32-bit unsigned integer (offset) + { +- DWORD *pvalue = (DWORD *)FreeImage_GetTagValue(tag); ++ const uint32_t *pvalue = (const uint32_t *)pv; + +- sprintf(format, "%X", pvalue[0]); ++ sprintf(format, "%lX", (unsigned long)pvalue[0]); + buffer += format; + for(i = 1; i < tag_count; i++) { +- sprintf(format, " %X", pvalue[i]); ++ sprintf(format, " %lX", (unsigned long)pvalue[i]); + buffer += format; + } +@@ -185,5 +187,5 @@ + case FIDT_PALETTE: // N x 32-bit RGBQUAD + { +- RGBQUAD *pvalue = (RGBQUAD *)FreeImage_GetTagValue(tag); ++ const RGBQUAD *pvalue = (const RGBQUAD *)pv; + + sprintf(format, "(%d,%d,%d,%d)", pvalue[0].rgbRed, pvalue[0].rgbGreen, pvalue[0].rgbBlue, pvalue[0].rgbReserved); +@@ -198,10 +200,10 @@ + case FIDT_LONG8: // N x 64-bit unsigned integer + { +- UINT64 *pvalue = (UINT64 *)FreeImage_GetTagValue(tag); ++ const uint64_t *pvalue = (const uint64_t *)pv; + +- sprintf(format, "%ld", pvalue[0]); ++ sprintf(format, "%llu", (unsigned long long)pvalue[0]); + buffer += format; + for(i = 1; i < tag_count; i++) { +- sprintf(format, "%ld", pvalue[i]); ++ sprintf(format, "%llu", (unsigned long long)pvalue[i]); + buffer += format; + } +@@ -211,10 +213,10 @@ + case FIDT_IFD8: // N x 64-bit unsigned integer (offset) + { +- UINT64 *pvalue = (UINT64 *)FreeImage_GetTagValue(tag); ++ const uint64_t *pvalue = (const uint64_t *)pv; + +- sprintf(format, "%X", pvalue[0]); ++ sprintf(format, "%llX", (unsigned long long)pvalue[0]); + buffer += format; + for(i = 1; i < tag_count; i++) { +- sprintf(format, "%X", pvalue[i]); ++ sprintf(format, "%llX", (unsigned long long)pvalue[i]); + buffer += format; + } +@@ -224,10 +226,10 @@ + case FIDT_SLONG8: // N x 64-bit signed integer + { +- INT64 *pvalue = (INT64 *)FreeImage_GetTagValue(tag); ++ const int64_t *pvalue = (const int64_t *)pv; + +- sprintf(format, "%ld", pvalue[0]); ++ sprintf(format, "%lld", (long long)pvalue[0]); + buffer += format; + for(i = 1; i < tag_count; i++) { +- sprintf(format, "%ld", pvalue[i]); ++ sprintf(format, "%lld", (long long)pvalue[i]); + buffer += format; + } +@@ -242,5 +244,5 @@ + if(max_size == MAX_TEXT_EXTENT) + max_size--; +- memcpy(format, (char*)FreeImage_GetTagValue(tag), max_size); ++ memcpy(format, pv, max_size); + format[max_size] = '\0'; + buffer += format; +@@ -256,5 +258,5 @@ + */ + static const char* +-ConvertExifTag(FITAG *tag) { ++ConvertExifTag(const FITAG *tag) { + char format[MAX_TEXT_EXTENT]; + static std::string buffer; +--- TestAPI/MainTestSuite.cpp 2015-02-25 09:08:38.000000000 -0500 ++++ TestAPI/MainTestSuite.cpp 2017-04-15 01:18:24.712061000 -0400 +@@ -35,6 +35,5 @@ + printf("%s Format\n", FreeImage_GetFormatFromFIF(fif)); + } +- printf(message); +- printf(" ***\n"); ++ printf("%s ***\n", message); + } + Property changes on: files/patch-warnings ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-webp =================================================================== --- files/patch-webp (nonexistent) +++ files/patch-webp (working copy) @@ -0,0 +1,18 @@ +--- Source/FreeImage/PluginWebP.cpp 2015-03-02 02:07:08.000000000 -0500 ++++ Source/FreeImage/PluginWebP.cpp 2017-04-15 00:38:52.407279000 -0400 +@@ -23,10 +23,10 @@ + #include "Utilities.h" + +-#include "../Metadata/FreeImageTag.h" ++#include + +-#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 ++#include ++ ++#include + + // ========================================================== Property changes on: files/patch-webp ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-xtiff =================================================================== --- files/patch-xtiff (nonexistent) +++ files/patch-xtiff (working copy) @@ -0,0 +1,125 @@ +Adapted from Debian: + From: Ghislain Antony Vaillant + Date: Tue, 3 Nov 2015 14:39:33 +0000 + Subject: Disable vendored dependencies. + +[...] + +This patch is based on Fedora's FreeImage-3.17.0_unbundle patch. +--- Source/Metadata/XTIFF.cpp ++++ Source/Metadata/XTIFF.cpp +@@ -29,13 +29,18 @@ + #pragma warning (disable : 4786) // identifier was truncated to 'number' characters + #endif + +-#include "../LibTIFF4/tiffiop.h" ++#include + + #include "FreeImage.h" + #include "Utilities.h" + #include "FreeImageTag.h" + #include "FIRational.h" + ++extern "C" ++{ ++ int _TIFFDataSize(TIFFDataType type); ++} ++ + // ---------------------------------------------------------- + // Extended TIFF Directory GEO Tag Support + // ---------------------------------------------------------- +@@ -224,6 +229,33 @@ tiff_write_geotiff_profile(TIFF *tif, FIBITMAP *dib) { + // TIFF EXIF tag reading & writing + // ---------------------------------------------------------- + ++static uint32 exif_tag_ids[] = { ++ EXIFTAG_EXPOSURETIME, EXIFTAG_FNUMBER, EXIFTAG_EXPOSUREPROGRAM, ++ EXIFTAG_SPECTRALSENSITIVITY, EXIFTAG_ISOSPEEDRATINGS, EXIFTAG_OECF, ++ EXIFTAG_EXIFVERSION, EXIFTAG_DATETIMEORIGINAL, EXIFTAG_DATETIMEDIGITIZED, ++ EXIFTAG_COMPONENTSCONFIGURATION, EXIFTAG_COMPRESSEDBITSPERPIXEL, ++ EXIFTAG_SHUTTERSPEEDVALUE, EXIFTAG_APERTUREVALUE, ++ EXIFTAG_BRIGHTNESSVALUE, EXIFTAG_EXPOSUREBIASVALUE, ++ EXIFTAG_MAXAPERTUREVALUE, EXIFTAG_SUBJECTDISTANCE, EXIFTAG_METERINGMODE, ++ EXIFTAG_LIGHTSOURCE, EXIFTAG_FLASH, EXIFTAG_FOCALLENGTH, ++ EXIFTAG_SUBJECTAREA, EXIFTAG_MAKERNOTE, EXIFTAG_USERCOMMENT, ++ EXIFTAG_SUBSECTIME, EXIFTAG_SUBSECTIMEORIGINAL, ++ EXIFTAG_SUBSECTIMEDIGITIZED, EXIFTAG_FLASHPIXVERSION, EXIFTAG_COLORSPACE, ++ EXIFTAG_PIXELXDIMENSION, EXIFTAG_PIXELYDIMENSION, ++ EXIFTAG_RELATEDSOUNDFILE, EXIFTAG_FLASHENERGY, ++ EXIFTAG_SPATIALFREQUENCYRESPONSE, EXIFTAG_FOCALPLANEXRESOLUTION, ++ EXIFTAG_FOCALPLANEYRESOLUTION, EXIFTAG_FOCALPLANERESOLUTIONUNIT, ++ EXIFTAG_SUBJECTLOCATION, EXIFTAG_EXPOSUREINDEX, EXIFTAG_SENSINGMETHOD, ++ EXIFTAG_FILESOURCE, EXIFTAG_SCENETYPE, EXIFTAG_CFAPATTERN, ++ EXIFTAG_CUSTOMRENDERED, EXIFTAG_EXPOSUREMODE, EXIFTAG_WHITEBALANCE, ++ EXIFTAG_DIGITALZOOMRATIO, EXIFTAG_FOCALLENGTHIN35MMFILM, ++ EXIFTAG_SCENECAPTURETYPE, EXIFTAG_GAINCONTROL, EXIFTAG_CONTRAST, ++ EXIFTAG_SATURATION, EXIFTAG_SHARPNESS, EXIFTAG_DEVICESETTINGDESCRIPTION, ++ EXIFTAG_SUBJECTDISTANCERANGE, EXIFTAG_GAINCONTROL, EXIFTAG_GAINCONTROL, ++ EXIFTAG_IMAGEUNIQUEID ++}; ++static int nExifTags = sizeof(exif_tag_ids) / sizeof(exif_tag_ids[0]); ++ + /** + Read a single Exif tag + +@@ -575,43 +607,10 @@ tiff_read_exif_tags(TIFF *tif, TagLib::MDMODEL md_model, FIBITMAP *dib) { + + // loop over all Core Directory Tags + // ### uses private data, but there is no other way ++ // -> Fedora: Best we can do without private headers is to hard-code a list of known EXIF tags and read those + if(md_model == TagLib::EXIF_MAIN) { +- const TIFFDirectory *td = &tif->tif_dir; +- +- uint32 lastTag = 0; //<- used to prevent reading some tags twice (as stored in tif_fieldinfo) +- +- for (int fi = 0, nfi = (int)tif->tif_nfields; nfi > 0; nfi--, fi++) { +- const TIFFField *fld = tif->tif_fields[fi]; +- +- const uint32 tag_id = TIFFFieldTag(fld); +- +- if(tag_id == lastTag) { +- continue; +- } +- +- // test if tag value is set +- // (lifted directly from LibTiff _TIFFWriteDirectory) +- +- if( fld->field_bit == FIELD_CUSTOM ) { +- int is_set = FALSE; +- +- for(int ci = 0; ci < td->td_customValueCount; ci++ ) { +- is_set |= (td->td_customValues[ci].info == fld); +- } +- +- if( !is_set ) { +- continue; +- } +- +- } else if(!TIFFFieldSet(tif, fld->field_bit)) { +- continue; +- } +- +- // process *all* other tags (some will be ignored) +- +- tiff_read_exif_tag(tif, tag_id, dib, md_model); +- +- lastTag = tag_id; ++ for (int i = 0; i < nExifTags; ++i) { ++ tiff_read_exif_tag(tif, exif_tag_ids[i], dib, md_model); + } + + } +@@ -723,10 +722,9 @@ tiff_write_exif_tags(TIFF *tif, TagLib::MDMODEL md_model, FIBITMAP *dib) { + + TagLib& tag_lib = TagLib::instance(); + +- for (int fi = 0, nfi = (int)tif->tif_nfields; nfi > 0; nfi--, fi++) { +- const TIFFField *fld = tif->tif_fields[fi]; +- +- const uint32 tag_id = TIFFFieldTag(fld); ++ for (int fi = 0, nfi = nExifTags; nfi > 0; nfi--, fi++) { ++ const uint32 tag_id = exif_tag_ids[fi]; ++ const TIFFField *fld = TIFFFieldWithTag(tif, tag_id); + + if(skip_write_field(tif, tag_id)) { + // skip tags that are already handled by the LibTIFF writing process Property changes on: files/patch-xtiff ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: files/patch-zutil =================================================================== --- files/patch-zutil (nonexistent) +++ files/patch-zutil (working copy) @@ -0,0 +1,14 @@ +Do not include zutil.h -- we only need it for OS_CODE and we simply +supply that #define on command-line... +--- Source/FreeImage/ZLibInterface.cpp 2015-03-02 02:07:10.000000000 -0500 ++++ Source/FreeImage/ZLibInterface.cpp 2017-04-14 18:05:32.342316000 -0400 +@@ -20,8 +20,7 @@ + // ========================================================== + +-#include "../ZLib/zlib.h" ++#include + #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) */ + + /** Property changes on: files/patch-zutil ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: pkg-plist =================================================================== --- pkg-plist (nonexistent) +++ pkg-plist (working copy) @@ -0,0 +1,8 @@ +include/FreeImage.h +include/FreeImagePlus.h +lib/libfreeimage.a +lib/libfreeimage.so.3 +lib/libfreeimage.so +lib/libfreeimageplus.a +lib/libfreeimageplus.so.3 +lib/libfreeimageplus.so Property changes on: pkg-plist ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property