Index: FreeImage/FreeImage.2003.vcproj =================================================================== --- FreeImage/FreeImage.2003.vcproj +++ FreeImage/FreeImage.2003.vcproj 2010-03-18 00:33:17.673043439 +0200 @@ -208,9 +208,6 @@ RelativePath=".\Source\FreeImage\PluginEXR.cpp"> </File> <File - RelativePath="Source\FreeImage\PluginG3.cpp"> - </File> - <File RelativePath="Source\FreeImage\PluginGIF.cpp"> </File> <File @@ -447,9 +444,6 @@ RelativePath="Source\FreeImageToolkit\Flip.cpp"> </File> <File - RelativePath="Source\FreeImageToolkit\JPEGTransform.cpp"> - </File> - <File RelativePath=".\Source\FreeImageToolkit\MultigridPoissonSolver.cpp"> </File> <File Index: FreeImage/Makefile.gnu =================================================================== --- FreeImage/Makefile.gnu +++ FreeImage/Makefile.gnu 2010-03-18 00:33:17.823900066 +0200 @@ -14,8 +14,8 @@ # Converts cr/lf to just lf DOS2UNIX = dos2unix -COMPILERFLAGS = -O3 -fPIC -fexceptions -fvisibility=hidden -LIBRARIES = -lstdc++ +COMPILERFLAGS = -O3 -fPIC -fexceptions -fvisibility=hidden -I/usr/include/OpenEXR +LIBRARIES = -lstdc++ -lz -lmng -lpng -ltiff -ljpeg -lopenjpeg `pkg-config --libs OpenEXR` MODULES = $(SRCS:.c=.o) MODULES := $(MODULES:.cpp=.o) Index: FreeImage/gensrclist.sh =================================================================== --- FreeImage/gensrclist.sh +++ FreeImage/gensrclist.sh 2010-03-18 00:33:18.162984320 +0200 @@ -1,6 +1,6 @@ #!/bin/sh -DIRLIST=". Source Source/Metadata Source/FreeImageToolkit Source/LibJPEG Source/LibMNG Source/LibPNG Source/LibTIFF Source/ZLib Source/LibOpenJPEG Source/OpenEXR Source/OpenEXR/Half Source/OpenEXR/Iex Source/OpenEXR/IlmImf Source/OpenEXR/IlmThread Source/OpenEXR/Imath" +DIRLIST=". Source Source/Metadata Source/FreeImageToolkit" echo "VER_MAJOR = 3" > Makefile.srcs echo "VER_MINOR = 11.0" >> Makefile.srcs Index: FreeImage/Source/FreeImage.h =================================================================== --- FreeImage/Source/FreeImage.h +++ FreeImage/Source/FreeImage.h 2010-03-18 00:33:18.114999628 +0200 @@ -405,8 +405,13 @@ FIF_XPM = 23, FIF_DDS = 24, FIF_GIF = 25, - FIF_HDR = 26, - FIF_FAXG3 = 27, + FIF_HDR = 26, +/* The G3 fax format plugin is deliberately disabled in the Mandriva build of + FreeImage as it requires that FreeImage uses a private copy of libtiff + which is a no no because of security reasons */ +#if 0 + FIF_FAXG3 = 27, +#endif FIF_SGI = 28, FIF_EXR = 29, FIF_J2K = 30, @@ -462,6 +467,11 @@ FID_CLUSTER16x16= 5, // Ordered clustered dot dithering (order 8 - 16x16 matrix) FID_BAYER16x16 = 6 // Bayer ordered dispersed dot dithering (order 4 dithering matrix) }; + +/* The FreeImage_JPEGTransform functions are deliberately disabled in the + Mandriva build of FreeImage as they require that FreeImage uses a private copy + of libjpeg which is a no no because of security reasons */ +#if 0 /** Lossless JPEG transformations Constants used in FreeImage_JPEGTransform @@ -475,7 +485,9 @@ FIJPEG_OP_ROTATE_90 = 5, // 90-degree clockwise rotation FIJPEG_OP_ROTATE_180 = 6, // 180-degree rotation FIJPEG_OP_ROTATE_270 = 7 // 270-degree clockwise (or 90 ccw) -}; +}; + +#endif /** Tone mapping operators. Constants used in FreeImage_ToneMapping. @@ -1007,8 +1019,13 @@ DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateClassic(FIBITMAP *dib, double angle); DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateEx(FIBITMAP *dib, double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask); DLL_API BOOL DLL_CALLCONV FreeImage_FlipHorizontal(FIBITMAP *dib); -DLL_API BOOL DLL_CALLCONV FreeImage_FlipVertical(FIBITMAP *dib); -DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransform(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(FALSE)); +DLL_API BOOL DLL_CALLCONV FreeImage_FlipVertical(FIBITMAP *dib); +/* The FreeImage_JPEGTransform functions are deliberately disabled in the + Mandriva build of FreeImage as they require that FreeImage uses a private copy + of libjpeg which is a no no because of security reasons */ +#if 0 +DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransform(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(FALSE)); +#endif // upsampling / downsampling DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rescale(FIBITMAP *dib, int dst_width, int dst_height, FREE_IMAGE_FILTER filter); @@ -1037,8 +1054,13 @@ // copy / paste / composite routines DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Copy(FIBITMAP *dib, int left, int top, int right, int bottom); DLL_API BOOL DLL_CALLCONV FreeImage_Paste(FIBITMAP *dst, FIBITMAP *src, int left, int top, int alpha); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg FI_DEFAULT(FALSE), RGBQUAD *appBkColor FI_DEFAULT(NULL), FIBITMAP *bg FI_DEFAULT(NULL)); -DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCrop(const char *src_file, const char *dst_file, int left, int top, int right, int bottom); +DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg FI_DEFAULT(FALSE), RGBQUAD *appBkColor FI_DEFAULT(NULL), FIBITMAP *bg FI_DEFAULT(NULL)); +/* The FreeImage_JPEGTransform functions are deliberately disabled in the + Mandriva build of FreeImage as they require that FreeImage uses a private copy + of libjpeg which is a no no because of security reasons */ +#if 0 +DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCrop(const char *src_file, const char *dst_file, int left, int top, int right, int bottom); +#endif DLL_API BOOL DLL_CALLCONV FreeImage_PreMultiplyWithAlpha(FIBITMAP *dib); // miscellaneous algorithms Index: FreeImage/Source/FreeImage/J2KHelper.cpp =================================================================== --- FreeImage/Source/FreeImage/J2KHelper.cpp +++ FreeImage/Source/FreeImage/J2KHelper.cpp 2010-03-18 00:33:17.843750048 +0200 @@ -21,7 +21,7 @@ #include "FreeImage.h" #include "Utilities.h" -#include "../LibOpenJPEG/openjpeg.h" +#include <openjpeg.h> /** Divide an integer by a power of 2 and round upwards Index: FreeImage/Source/FreeImage/Plugin.cpp =================================================================== --- FreeImage/Source/FreeImage/Plugin.cpp +++ FreeImage/Source/FreeImage/Plugin.cpp 2010-03-18 00:33:17.848998888 +0200 @@ -247,8 +247,13 @@ s_plugins->AddNode(InitXPM); s_plugins->AddNode(InitDDS); s_plugins->AddNode(InitGIF); - s_plugins->AddNode(InitHDR); - s_plugins->AddNode(InitG3); + s_plugins->AddNode(InitHDR); +/* The G3 fax format plugin is deliberately disabled in the Mandriva build of + FreeImage as it requires that FreeImage uses a private copy of libtiff + which is a no no because of security reasons */ +#if 0 + s_plugins->AddNode(InitG3); +#endif s_plugins->AddNode(InitSGI); s_plugins->AddNode(InitEXR); s_plugins->AddNode(InitJ2K); Index: FreeImage/Source/FreeImage/PluginBMP.cpp =================================================================== --- FreeImage/Source/FreeImage/PluginBMP.cpp +++ FreeImage/Source/FreeImage/PluginBMP.cpp 2010-03-18 00:33:17.854749446 +0200 @@ -188,6 +188,8 @@ } #endif } + +#define MIN(a, b) ( ((a) < (b))? (a):(b) ) /** Load image pixels for 4-bit RLE compressed dib Index: FreeImage/Source/FreeImage/PluginEXR.cpp =================================================================== --- FreeImage/Source/FreeImage/PluginEXR.cpp +++ FreeImage/Source/FreeImage/PluginEXR.cpp 2010-03-18 00:33:17.998749786 +0200 @@ -21,15 +21,15 @@ #include "FreeImage.h" #include "Utilities.h" -#include "../OpenEXR/IlmImf/ImfIO.h" -#include "../OpenEXR/Iex/Iex.h" -#include "../OpenEXR/IlmImf/ImfOutputFile.h" -#include "../OpenEXR/IlmImf/ImfInputFile.h" -#include "../OpenEXR/IlmImf/ImfRgbaFile.h" -#include "../OpenEXR/IlmImf/ImfChannelList.h" -#include "../OpenEXR/IlmImf/ImfRgba.h" -#include "../OpenEXR/IlmImf/ImfArray.h" -#include "../OpenEXR/Half/half.h" +#include <ImfIO.h> +#include <Iex.h> +#include <ImfOutputFile.h> +#include <ImfInputFile.h> +#include <ImfRgbaFile.h> +#include <ImfChannelList.h> +#include <ImfRgba.h> +#include <ImfArray.h> +#include <half.h> // ========================================================== Index: FreeImage/Source/FreeImage/PluginJ2K.cpp =================================================================== --- FreeImage/Source/FreeImage/PluginJ2K.cpp +++ FreeImage/Source/FreeImage/PluginJ2K.cpp 2010-03-18 00:33:18.002749714 +0200 @@ -21,7 +21,7 @@ #include "FreeImage.h" #include "Utilities.h" -#include "../LibOpenJPEG/openjpeg.h" +#include <openjpeg.h> // ========================================================== // Plugin Interface Index: FreeImage/Source/FreeImage/PluginJP2.cpp =================================================================== --- FreeImage/Source/FreeImage/PluginJP2.cpp +++ FreeImage/Source/FreeImage/PluginJP2.cpp 2010-03-18 00:33:18.006748633 +0200 @@ -21,7 +21,7 @@ #include "FreeImage.h" #include "Utilities.h" -#include "../LibOpenJPEG/openjpeg.h" +#include <openjpeg.h> // ========================================================== // Plugin Interface Index: FreeImage/Source/FreeImage/PluginJPEG.cpp =================================================================== --- FreeImage/Source/FreeImage/PluginJPEG.cpp +++ FreeImage/Source/FreeImage/PluginJPEG.cpp 2010-03-18 00:33:18.011749104 +0200 @@ -34,9 +34,9 @@ #undef FAR #include <setjmp.h> -#include "../LibJPEG/jinclude.h" -#include "../LibJPEG/jpeglib.h" -#include "../LibJPEG/jerror.h" +#include <stdio.h> +#include <jpeglib.h> +#include <jerror.h> } #include "FreeImage.h" @@ -158,7 +158,7 @@ dest->buffer = (JOCTET *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - OUTPUT_BUF_SIZE * SIZEOF(JOCTET)); + OUTPUT_BUF_SIZE * sizeof(JOCTET)); dest->pub.next_output_byte = dest->buffer; dest->pub.free_in_buffer = OUTPUT_BUF_SIZE; @@ -333,12 +333,12 @@ if (cinfo->src == NULL) { cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(SourceManager)); + ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(SourceManager)); src = (freeimage_src_ptr) cinfo->src; src->buffer = (JOCTET *) (*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_PERMANENT, INPUT_BUF_SIZE * SIZEOF(JOCTET)); + ((j_common_ptr) cinfo, JPOOL_PERMANENT, INPUT_BUF_SIZE * sizeof(JOCTET)); } // initialize the jpeg pointer struct with pointers to functions @@ -366,7 +366,7 @@ if (cinfo->dest == NULL) { cinfo->dest = (struct jpeg_destination_mgr *)(*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(DestinationManager)); + ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(DestinationManager)); } dest = (freeimage_dst_ptr) cinfo->dest; Index: FreeImage/Source/FreeImage/PluginMNG.cpp =================================================================== --- FreeImage/Source/FreeImage/PluginMNG.cpp +++ FreeImage/Source/FreeImage/PluginMNG.cpp 2010-03-18 00:33:18.016750059 +0200 @@ -22,7 +22,7 @@ #include "FreeImage.h" #include "Utilities.h" -#include "../LibMNG/libmng.h" +#include <libmng.h> // ---------------------------------------------------------- // Constants + headers Index: FreeImage/Source/FreeImage/PluginPNG.cpp =================================================================== --- FreeImage/Source/FreeImage/PluginPNG.cpp +++ FreeImage/Source/FreeImage/PluginPNG.cpp 2010-03-18 00:33:18.021998960 +0200 @@ -37,7 +37,7 @@ // ---------------------------------------------------------- -#include "../LibPNG/png.h" +#include <png.h> // ---------------------------------------------------------- @@ -100,8 +100,11 @@ // create a tag tag = FreeImage_CreateTag(); if(!tag) return FALSE; - - DWORD tag_length = (DWORD) MAX(text_ptr[i].text_length, text_ptr[i].itxt_length); +#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); @@ -147,10 +150,12 @@ text_metadata.compression = 1; // iTXt, none 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 + 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 + 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); @@ -169,10 +174,12 @@ text_metadata.compression = 1; // iTXt, none text_metadata.key = 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 + 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 + 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); Index: FreeImage/Source/FreeImage/PluginTIFF.cpp =================================================================== --- FreeImage/Source/FreeImage/PluginTIFF.cpp +++ FreeImage/Source/FreeImage/PluginTIFF.cpp 2010-03-18 00:33:18.028999231 +0200 @@ -34,7 +34,7 @@ #undef __unix #endif -#include "../LibTIFF/tiffiop.h" +#include <tiffio.h> #include "FreeImage.h" #include "Utilities.h" #include "../Metadata/FreeImageTag.h" @@ -178,8 +178,7 @@ // Open a TIFF file descriptor for read/writing. // ---------------------------------------------------------- -TIFF * -TIFFFdOpen(thandle_t handle, const char *name, const char *mode) { +static TIFF *FdOpen(thandle_t handle, const char *name, const char *mode) { TIFF *tif; // Set up the callback for extended TIFF directory tag support @@ -191,85 +190,10 @@ _tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc, _tiffSizeProc, _tiffMapProc, _tiffUnmapProc); - // Warning: tif_fd is declared as 'int' currently (see libTIFF), - // may result in incorrect file pointers inside libTIFF on - // 64bit machines (sizeof(int) != sizeof(long)). - // Needs to be fixed within libTIFF. - if (tif) - tif->tif_fd = (long)handle; - return tif; } // ---------------------------------------------------------- -// Open a TIFF file for read/writing. -// ---------------------------------------------------------- - -TIFF* -TIFFOpen(const char* name, const char* mode) { - return 0; -} - -// ---------------------------------------------------------- -// TIFF library FreeImage-specific routines. -// ---------------------------------------------------------- - -tdata_t -_TIFFmalloc(tsize_t s) { - return malloc(s); -} - -void -_TIFFfree(tdata_t p) { - free(p); -} - -tdata_t -_TIFFrealloc(tdata_t p, tsize_t s) { - return realloc(p, s); -} - -void -_TIFFmemset(tdata_t p, int v, tsize_t c) { - memset(p, v, (size_t) c); -} - -void -_TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c) { - memcpy(d, s, (size_t) c); -} - -int -_TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c) { - return (memcmp(p1, p2, (size_t) c)); -} - -// ---------------------------------------------------------- -// in FreeImage warnings and errors are disabled -// ---------------------------------------------------------- - -static void -msdosWarningHandler(const char* module, const char* fmt, va_list ap) { -} - -TIFFErrorHandler _TIFFwarningHandler = msdosWarningHandler; - -static void -msdosErrorHandler(const char* module, const char* fmt, va_list ap) { - - // use this for diagnostic only (do not use otherwise, even in DEBUG mode) - /* - if (module != NULL) { - char msg[1024]; - vsprintf(msg, fmt, ap); - FreeImage_OutputMessageProc(s_format_id, "%s: %s", module, msg); - } - */ -} - -TIFFErrorHandler _TIFFerrorHandler = msdosErrorHandler; - -// ---------------------------------------------------------- #define CVT(x) (((x) * 255L) / ((1L<<16)-1)) #define SCALE(x) (((x)*((1L<<16)-1))/255) @@ -995,9 +919,9 @@ fio->handle = handle; if (read) { - fio->tif = TIFFFdOpen((thandle_t)fio, "", "r"); + fio->tif = FdOpen((thandle_t)fio, "", "r"); } else { - fio->tif = TIFFFdOpen((thandle_t)fio, "", "w"); + fio->tif = FdOpen((thandle_t)fio, "", "w"); } if(fio->tif == NULL) { free(fio); Index: FreeImage/Source/FreeImage/ZLibInterface.cpp =================================================================== --- FreeImage/Source/FreeImage/ZLibInterface.cpp +++ FreeImage/Source/FreeImage/ZLibInterface.cpp 2010-03-18 00:33:18.107748157 +0200 @@ -19,10 +19,9 @@ // Use at your own risk! // ========================================================== -#include "../ZLib/zlib.h" +#include <zlib.h> #include "FreeImage.h" #include "Utilities.h" -#include "../ZLib/zutil.h" /* must be the last header because of error C3163 in VS2008 (_vsnprintf defined in stdio.h) */ /** Compresses a source buffer into a target buffer, using the ZLib library. @@ -115,7 +114,7 @@ return 0; case Z_OK: { // patch header, setup crc and length (stolen from mod_trace_output) - BYTE *p = target + 8; *p++ = 2; *p = OS_CODE; // xflags, os_code + BYTE *p = target + 8; *p++ = 2; *p = 0x03; // xflags, os_code (unix) crc = crc32(crc, source, source_size); memcpy(target + 4 + dest_len, &crc, 4); memcpy(target + 8 + dest_len, &source_size, 4); Index: FreeImage/Source/Metadata/XTIFF.cpp =================================================================== --- FreeImage/Source/Metadata/XTIFF.cpp +++ FreeImage/Source/Metadata/XTIFF.cpp 2010-03-18 00:33:18.117999980 +0200 @@ -27,7 +27,7 @@ #pragma warning (disable : 4786) // identifier was truncated to 'number' characters #endif -#include "../LibTIFF/tiffiop.h" +#include <tiffio.h> #include "FreeImage.h" #include "Utilities.h" @@ -194,16 +194,23 @@ // ---------------------------------------------------------- // EXIF tag reading -// ---------------------------------------------------------- +// ---------------------------------------------------------- + +/* + * Caveat emperor this is a private libtiff functions which we need, + * there is no better solution I'm afraid + */ +extern "C" +{ + int _TIFFDataSize(TIFFDataType type); +} BOOL tiff_read_exif_tags(TIFF *tif, TagLib::MDMODEL md_model, FIBITMAP *dib) { int i; short count; TagLib& tagLib = TagLib::instance(); - - TIFFDirectory *td = &tif->tif_dir; - + count = (short) TIFFGetTagListCount(tif); for(i = 0; i < count; i++) { ttag_t tag = TIFFGetTagListEntry(tif, i); @@ -234,7 +241,10 @@ if (fip->field_readcount == TIFF_VARIABLE || fip->field_readcount == TIFF_VARIABLE2) { value_count = 1; } else if (fip->field_readcount == TIFF_SPP) { - value_count = td->td_samplesperpixel; + uint16 spp; + TIFFGetFieldDefaulted(tif, + TIFFTAG_SAMPLESPERPIXEL, &spp); + value_count = spp; } else { value_count = fip->field_readcount; }