Commit 4c255f5a authored by Alexandre Julliard's avatar Alexandre Julliard

tiff: Import upstream release 4.5.0.

parent f93e53c9
......@@ -15,6 +15,7 @@ C_SRCS = \
libtiff/tif_fax3.c \
libtiff/tif_fax3sm.c \
libtiff/tif_flush.c \
libtiff/tif_hash_set.c \
libtiff/tif_jpeg.c \
libtiff/tif_luv.c \
libtiff/tif_lzw.c \
......
......@@ -2,23 +2,23 @@
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
......@@ -37,75 +37,81 @@
* completely freed, so you should save opened file handle and pointer
* to the close procedure in external variables before calling
* _TIFFCleanup(), if you will need these ones to close the file.
*
*
* @param tif A TIFF pointer.
*/
void
TIFFCleanup(TIFF* tif)
void TIFFCleanup(TIFF *tif)
{
/*
* Flush buffered data and directory (if dirty).
*/
if (tif->tif_mode != O_RDONLY)
TIFFFlush(tif);
(*tif->tif_cleanup)(tif);
TIFFFreeDirectory(tif);
if (tif->tif_dirlist)
_TIFFfree(tif->tif_dirlist);
/*
* Clean up client info links.
*/
while( tif->tif_clientinfo )
{
TIFFClientInfoLink *psLink = tif->tif_clientinfo;
tif->tif_clientinfo = psLink->next;
_TIFFfree( psLink->name );
_TIFFfree( psLink );
}
if (tif->tif_rawdata && (tif->tif_flags&TIFF_MYBUFFER))
_TIFFfree(tif->tif_rawdata);
if (isMapped(tif))
TIFFUnmapFileContents(tif, tif->tif_base, (toff_t)tif->tif_size);
/*
* Clean up custom fields.
*/
if (tif->tif_fields && tif->tif_nfields > 0) {
uint32_t i;
for (i = 0; i < tif->tif_nfields; i++) {
TIFFField *fld = tif->tif_fields[i];
if (fld->field_name != NULL) {
if (fld->field_bit == FIELD_CUSTOM &&
/* caution: tif_fields[i] must not be the beginning of a fields-array.
* Otherwise the following tags are also freed with the first free().
*/
TIFFFieldIsAnonymous(fld)) {
_TIFFfree(fld->field_name);
_TIFFfree(fld);
}
}
}
_TIFFfree(tif->tif_fields);
}
if (tif->tif_nfieldscompat > 0) {
uint32_t i;
for (i = 0; i < tif->tif_nfieldscompat; i++) {
if (tif->tif_fieldscompat[i].allocated_size)
_TIFFfree(tif->tif_fieldscompat[i].fields);
/*
* Flush buffered data and directory (if dirty).
*/
if (tif->tif_mode != O_RDONLY)
TIFFFlush(tif);
(*tif->tif_cleanup)(tif);
TIFFFreeDirectory(tif);
TIFFHashSetDestroy(tif->tif_map_dir_offset_to_number);
TIFFHashSetDestroy(tif->tif_map_dir_number_to_offset);
/*
* Clean up client info links.
*/
while (tif->tif_clientinfo)
{
TIFFClientInfoLink *psLink = tif->tif_clientinfo;
tif->tif_clientinfo = psLink->next;
_TIFFfreeExt(tif, psLink->name);
_TIFFfreeExt(tif, psLink);
}
if (tif->tif_rawdata && (tif->tif_flags & TIFF_MYBUFFER))
_TIFFfreeExt(tif, tif->tif_rawdata);
if (isMapped(tif))
TIFFUnmapFileContents(tif, tif->tif_base, (toff_t)tif->tif_size);
/*
* Clean up custom fields.
*/
if (tif->tif_fields && tif->tif_nfields > 0)
{
uint32_t i;
for (i = 0; i < tif->tif_nfields; i++)
{
TIFFField *fld = tif->tif_fields[i];
if (fld->field_name != NULL)
{
if (fld->field_bit == FIELD_CUSTOM &&
/* caution: tif_fields[i] must not be the beginning of a
* fields-array. Otherwise the following tags are also freed
* with the first free().
*/
TIFFFieldIsAnonymous(fld))
{
_TIFFfreeExt(tif, fld->field_name);
_TIFFfreeExt(tif, fld);
}
_TIFFfree(tif->tif_fieldscompat);
}
}
_TIFFfreeExt(tif, tif->tif_fields);
}
if (tif->tif_nfieldscompat > 0)
{
uint32_t i;
for (i = 0; i < tif->tif_nfieldscompat; i++)
{
if (tif->tif_fieldscompat[i].allocated_size)
_TIFFfreeExt(tif, tif->tif_fieldscompat[i].fields);
}
_TIFFfreeExt(tif, tif->tif_fieldscompat);
}
_TIFFfree(tif);
_TIFFfreeExt(NULL, tif);
}
/************************************************************************/
......@@ -118,26 +124,15 @@ TIFFCleanup(TIFF* tif)
* TIFFClose closes a file that was previously opened with TIFFOpen().
* Any buffered data are flushed to the file, including the contents of
* the current directory (if modified); and all resources are reclaimed.
*
*
* @param tif A TIFF pointer.
*/
void
TIFFClose(TIFF* tif)
void TIFFClose(TIFF *tif)
{
TIFFCloseProc closeproc = tif->tif_closeproc;
thandle_t fd = tif->tif_clientdata;
TIFFCloseProc closeproc = tif->tif_closeproc;
thandle_t fd = tif->tif_clientdata;
TIFFCleanup(tif);
(void) (*closeproc)(fd);
TIFFCleanup(tif);
(void)(*closeproc)(fd);
}
/* vim: set ts=8 sts=8 sw=8 noet: */
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/
......@@ -2,23 +2,23 @@
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
......@@ -29,7 +29,7 @@
*/
#include "tiffiop.h"
static int NotConfigured(TIFF*, int);
static int NotConfigured(TIFF *, int);
#ifndef LZW_SUPPORT
#define TIFFInitLZW NotConfigured
......@@ -84,54 +84,52 @@ static int NotConfigured(TIFF*, int);
* Compression schemes statically built into the library.
*/
const TIFFCodec _TIFFBuiltinCODECS[] = {
{ "None", COMPRESSION_NONE, TIFFInitDumpMode },
{ "LZW", COMPRESSION_LZW, TIFFInitLZW },
{ "PackBits", COMPRESSION_PACKBITS, TIFFInitPackBits },
{ "ThunderScan", COMPRESSION_THUNDERSCAN,TIFFInitThunderScan },
{ "NeXT", COMPRESSION_NEXT, TIFFInitNeXT },
{ "JPEG", COMPRESSION_JPEG, TIFFInitJPEG },
{ "Old-style JPEG", COMPRESSION_OJPEG, TIFFInitOJPEG },
{ "CCITT RLE", COMPRESSION_CCITTRLE, TIFFInitCCITTRLE },
{ "CCITT RLE/W", COMPRESSION_CCITTRLEW, TIFFInitCCITTRLEW },
{ "CCITT Group 3", COMPRESSION_CCITTFAX3, TIFFInitCCITTFax3 },
{ "CCITT Group 4", COMPRESSION_CCITTFAX4, TIFFInitCCITTFax4 },
{ "ISO JBIG", COMPRESSION_JBIG, TIFFInitJBIG },
{ "Deflate", COMPRESSION_DEFLATE, TIFFInitZIP },
{ "AdobeDeflate", COMPRESSION_ADOBE_DEFLATE , TIFFInitZIP },
{ "PixarLog", COMPRESSION_PIXARLOG, TIFFInitPixarLog },
{ "SGILog", COMPRESSION_SGILOG, TIFFInitSGILog },
{ "SGILog24", COMPRESSION_SGILOG24, TIFFInitSGILog },
{ "LZMA", COMPRESSION_LZMA, TIFFInitLZMA },
{ "ZSTD", COMPRESSION_ZSTD, TIFFInitZSTD },
{ "WEBP", COMPRESSION_WEBP, TIFFInitWebP },
{ "LERC", COMPRESSION_LERC, TIFFInitLERC },
{ NULL, 0, NULL }
};
{"None", COMPRESSION_NONE, TIFFInitDumpMode},
{"LZW", COMPRESSION_LZW, TIFFInitLZW},
{"PackBits", COMPRESSION_PACKBITS, TIFFInitPackBits},
{"ThunderScan", COMPRESSION_THUNDERSCAN, TIFFInitThunderScan},
{"NeXT", COMPRESSION_NEXT, TIFFInitNeXT},
{"JPEG", COMPRESSION_JPEG, TIFFInitJPEG},
{"Old-style JPEG", COMPRESSION_OJPEG, TIFFInitOJPEG},
{"CCITT RLE", COMPRESSION_CCITTRLE, TIFFInitCCITTRLE},
{"CCITT RLE/W", COMPRESSION_CCITTRLEW, TIFFInitCCITTRLEW},
{"CCITT Group 3", COMPRESSION_CCITTFAX3, TIFFInitCCITTFax3},
{"CCITT Group 4", COMPRESSION_CCITTFAX4, TIFFInitCCITTFax4},
{"ISO JBIG", COMPRESSION_JBIG, TIFFInitJBIG},
{"Deflate", COMPRESSION_DEFLATE, TIFFInitZIP},
{"AdobeDeflate", COMPRESSION_ADOBE_DEFLATE, TIFFInitZIP},
{"PixarLog", COMPRESSION_PIXARLOG, TIFFInitPixarLog},
{"SGILog", COMPRESSION_SGILOG, TIFFInitSGILog},
{"SGILog24", COMPRESSION_SGILOG24, TIFFInitSGILog},
{"LZMA", COMPRESSION_LZMA, TIFFInitLZMA},
{"ZSTD", COMPRESSION_ZSTD, TIFFInitZSTD},
{"WEBP", COMPRESSION_WEBP, TIFFInitWebP},
{"LERC", COMPRESSION_LERC, TIFFInitLERC},
{NULL, 0, NULL}};
static int
_notConfigured(TIFF* tif)
static int _notConfigured(TIFF *tif)
{
const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression);
char compression_code[20];
sprintf(compression_code, "%"PRIu16, tif->tif_dir.td_compression );
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
"%s compression support is not configured",
c ? c->name : compression_code );
return (0);
const TIFFCodec *c = TIFFFindCODEC(tif->tif_dir.td_compression);
char compression_code[20];
snprintf(compression_code, sizeof(compression_code), "%" PRIu16,
tif->tif_dir.td_compression);
TIFFErrorExtR(tif, tif->tif_name,
"%s compression support is not configured",
c ? c->name : compression_code);
return (0);
}
static int
NotConfigured(TIFF* tif, int scheme)
static int NotConfigured(TIFF *tif, int scheme)
{
(void) scheme;
(void)scheme;
tif->tif_fixuptags = _notConfigured;
tif->tif_decodestatus = FALSE;
tif->tif_setupdecode = _notConfigured;
tif->tif_encodestatus = FALSE;
tif->tif_setupencode = _notConfigured;
return (1);
tif->tif_fixuptags = _notConfigured;
tif->tif_decodestatus = FALSE;
tif->tif_setupdecode = _notConfigured;
tif->tif_encodestatus = FALSE;
tif->tif_setupencode = _notConfigured;
return (1);
}
/************************************************************************/
......@@ -145,27 +143,21 @@ NotConfigured(TIFF* tif, int scheme)
* 0 will be returned.
*/
int
TIFFIsCODECConfigured(uint16_t scheme)
int TIFFIsCODECConfigured(uint16_t scheme)
{
const TIFFCodec* codec = TIFFFindCODEC(scheme);
const TIFFCodec *codec = TIFFFindCODEC(scheme);
if(codec == NULL) {
return 0;
}
if(codec->init == NULL) {
return 0;
}
if(codec->init != NotConfigured){
return 1;
}
return 0;
if (codec == NULL)
{
return 0;
}
if (codec->init == NULL)
{
return 0;
}
if (codec->init != NotConfigured)
{
return 1;
}
return 0;
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/
......@@ -99,7 +99,7 @@
#define PACKAGE_NAME "LibTIFF Software"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "LibTIFF Software 4.4.0"
#define PACKAGE_STRING "LibTIFF Software 4.5.0"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "tiff"
......@@ -108,7 +108,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "4.4.0"
#define PACKAGE_VERSION "4.5.0"
/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 4
......@@ -120,7 +120,7 @@
#define USE_WIN32_FILEIO 1
/* Version number of package */
#define VERSION "4.4.0"
#define VERSION "4.5.0"
/* Support webp compression */
/* #undef WEBP_SUPPORT */
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -2,23 +2,23 @@
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
......@@ -29,105 +29,94 @@
*/
#include "tiffiop.h"
static int
DumpFixupTags(TIFF* tif)
static int DumpFixupTags(TIFF *tif)
{
(void) tif;
return (1);
(void)tif;
return (1);
}
/*
* Encode a hunk of pixels.
*/
static int
DumpModeEncode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s)
static int DumpModeEncode(TIFF *tif, uint8_t *pp, tmsize_t cc, uint16_t s)
{
(void) s;
while (cc > 0) {
tmsize_t n;
(void)s;
while (cc > 0)
{
tmsize_t n;
n = cc;
if (tif->tif_rawcc + n > tif->tif_rawdatasize)
n = tif->tif_rawdatasize - tif->tif_rawcc;
n = cc;
if (tif->tif_rawcc + n > tif->tif_rawdatasize)
n = tif->tif_rawdatasize - tif->tif_rawcc;
assert( n > 0 );
assert(n > 0);
/*
* Avoid copy if client has setup raw
* data buffer to avoid extra copy.
*/
if (tif->tif_rawcp != pp)
_TIFFmemcpy(tif->tif_rawcp, pp, n);
tif->tif_rawcp += n;
tif->tif_rawcc += n;
pp += n;
cc -= n;
if (tif->tif_rawcc >= tif->tif_rawdatasize &&
!TIFFFlushData1(tif))
return (0);
}
return (1);
/*
* Avoid copy if client has setup raw
* data buffer to avoid extra copy.
*/
if (tif->tif_rawcp != pp)
_TIFFmemcpy(tif->tif_rawcp, pp, n);
tif->tif_rawcp += n;
tif->tif_rawcc += n;
pp += n;
cc -= n;
if (tif->tif_rawcc >= tif->tif_rawdatasize && !TIFFFlushData1(tif))
return (0);
}
return (1);
}
/*
* Decode a hunk of pixels.
*/
static int
DumpModeDecode(TIFF* tif, uint8_t* buf, tmsize_t cc, uint16_t s)
static int DumpModeDecode(TIFF *tif, uint8_t *buf, tmsize_t cc, uint16_t s)
{
static const char module[] = "DumpModeDecode";
(void) s;
if (tif->tif_rawcc < cc) {
TIFFErrorExt(tif->tif_clientdata, module,
"Not enough data for scanline %"PRIu32", expected a request for at most %"TIFF_SSIZE_FORMAT" bytes, got a request for %"TIFF_SSIZE_FORMAT" bytes",
tif->tif_row,
tif->tif_rawcc,
cc);
return (0);
}
/*
* Avoid copy if client has setup raw
* data buffer to avoid extra copy.
*/
if (tif->tif_rawcp != buf)
_TIFFmemcpy(buf, tif->tif_rawcp, cc);
tif->tif_rawcp += cc;
tif->tif_rawcc -= cc;
return (1);
static const char module[] = "DumpModeDecode";
(void)s;
if (tif->tif_rawcc < cc)
{
TIFFErrorExtR(tif, module,
"Not enough data for scanline %" PRIu32
", expected a request for at most %" TIFF_SSIZE_FORMAT
" bytes, got a request for %" TIFF_SSIZE_FORMAT " bytes",
tif->tif_row, tif->tif_rawcc, cc);
return (0);
}
/*
* Avoid copy if client has setup raw
* data buffer to avoid extra copy.
*/
if (tif->tif_rawcp != buf)
_TIFFmemcpy(buf, tif->tif_rawcp, cc);
tif->tif_rawcp += cc;
tif->tif_rawcc -= cc;
return (1);
}
/*
* Seek forwards nrows in the current strip.
*/
static int
DumpModeSeek(TIFF* tif, uint32_t nrows)
static int DumpModeSeek(TIFF *tif, uint32_t nrows)
{
tif->tif_rawcp += nrows * tif->tif_scanlinesize;
tif->tif_rawcc -= nrows * tif->tif_scanlinesize;
return (1);
tif->tif_rawcp += nrows * tif->tif_scanlinesize;
tif->tif_rawcc -= nrows * tif->tif_scanlinesize;
return (1);
}
/*
* Initialize dump mode.
*/
int
TIFFInitDumpMode(TIFF* tif, int scheme)
int TIFFInitDumpMode(TIFF *tif, int scheme)
{
(void) scheme;
tif->tif_fixuptags = DumpFixupTags;
tif->tif_decoderow = DumpModeDecode;
tif->tif_decodestrip = DumpModeDecode;
tif->tif_decodetile = DumpModeDecode;
tif->tif_encoderow = DumpModeEncode;
tif->tif_encodestrip = DumpModeEncode;
tif->tif_encodetile = DumpModeEncode;
tif->tif_seek = DumpModeSeek;
return (1);
(void)scheme;
tif->tif_fixuptags = DumpFixupTags;
tif->tif_decoderow = DumpModeDecode;
tif->tif_decodestrip = DumpModeDecode;
tif->tif_decodetile = DumpModeDecode;
tif->tif_encoderow = DumpModeEncode;
tif->tif_encodestrip = DumpModeEncode;
tif->tif_encodetile = DumpModeEncode;
tif->tif_seek = DumpModeSeek;
return (1);
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/
......@@ -2,23 +2,23 @@
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
......@@ -29,58 +29,104 @@
TIFFErrorHandlerExt _TIFFerrorHandlerExt = NULL;
TIFFErrorHandler
TIFFSetErrorHandler(TIFFErrorHandler handler)
TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler handler)
{
TIFFErrorHandler prev = _TIFFerrorHandler;
_TIFFerrorHandler = handler;
return (prev);
TIFFErrorHandler prev = _TIFFerrorHandler;
_TIFFerrorHandler = handler;
return (prev);
}
TIFFErrorHandlerExt
TIFFSetErrorHandlerExt(TIFFErrorHandlerExt handler)
TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt handler)
{
TIFFErrorHandlerExt prev = _TIFFerrorHandlerExt;
_TIFFerrorHandlerExt = handler;
return (prev);
TIFFErrorHandlerExt prev = _TIFFerrorHandlerExt;
_TIFFerrorHandlerExt = handler;
return (prev);
}
void
TIFFError(const char* module, const char* fmt, ...)
void TIFFError(const char *module, const char *fmt, ...)
{
va_list ap;
if (_TIFFerrorHandler) {
va_start(ap, fmt);
(*_TIFFerrorHandler)(module, fmt, ap);
va_end(ap);
}
if (_TIFFerrorHandlerExt) {
va_start(ap, fmt);
(*_TIFFerrorHandlerExt)(0, module, fmt, ap);
va_end(ap);
}
va_list ap;
if (_TIFFerrorHandler)
{
va_start(ap, fmt);
(*_TIFFerrorHandler)(module, fmt, ap);
va_end(ap);
}
if (_TIFFerrorHandlerExt)
{
va_start(ap, fmt);
(*_TIFFerrorHandlerExt)(0, module, fmt, ap);
va_end(ap);
}
}
void
TIFFErrorExt(thandle_t fd, const char* module, const char* fmt, ...)
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt, ...)
{
va_list ap;
if (_TIFFerrorHandler) {
va_start(ap, fmt);
(*_TIFFerrorHandler)(module, fmt, ap);
va_end(ap);
}
if (_TIFFerrorHandlerExt) {
va_start(ap, fmt);
(*_TIFFerrorHandlerExt)(fd, module, fmt, ap);
va_end(ap);
}
va_list ap;
if (_TIFFerrorHandler)
{
va_start(ap, fmt);
(*_TIFFerrorHandler)(module, fmt, ap);
va_end(ap);
}
if (_TIFFerrorHandlerExt)
{
va_start(ap, fmt);
(*_TIFFerrorHandlerExt)(fd, module, fmt, ap);
va_end(ap);
}
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/
void _TIFFErrorEarly(TIFFOpenOptions *opts, thandle_t clientdata,
const char *module, const char *fmt, ...)
{
va_list ap;
if (opts && opts->errorhandler)
{
va_start(ap, fmt);
int stop = opts->errorhandler(NULL, opts->errorhandler_user_data,
module, fmt, ap);
va_end(ap);
if (stop)
return;
}
if (_TIFFerrorHandler)
{
va_start(ap, fmt);
(*_TIFFerrorHandler)(module, fmt, ap);
va_end(ap);
}
if (_TIFFerrorHandlerExt)
{
va_start(ap, fmt);
(*_TIFFerrorHandlerExt)(clientdata, module, fmt, ap);
va_end(ap);
}
}
void TIFFErrorExtR(TIFF *tif, const char *module, const char *fmt, ...)
{
va_list ap;
if (tif && tif->tif_errorhandler)
{
va_start(ap, fmt);
int stop = (*tif->tif_errorhandler)(
tif, tif->tif_errorhandler_user_data, module, fmt, ap);
va_end(ap);
if (stop)
return;
}
if (_TIFFerrorHandler)
{
va_start(ap, fmt);
(*_TIFFerrorHandler)(module, fmt, ap);
va_end(ap);
}
if (_TIFFerrorHandlerExt)
{
va_start(ap, fmt);
(*_TIFFerrorHandlerExt)(tif ? tif->tif_clientdata : NULL, module, fmt,
ap);
va_end(ap);
}
}
......@@ -2,23 +2,23 @@
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
......@@ -27,30 +27,28 @@
*/
#include "tiffiop.h"
int
TIFFFlush(TIFF* tif)
int TIFFFlush(TIFF *tif)
{
if( tif->tif_mode == O_RDONLY )
if (tif->tif_mode == O_RDONLY)
return 1;
if (!TIFFFlushData(tif))
return (0);
/* In update (r+) mode we try to detect the case where
only the strip/tile map has been altered, and we try to
rewrite only that portion of the directory without
/* In update (r+) mode we try to detect the case where
only the strip/tile map has been altered, and we try to
rewrite only that portion of the directory without
making any other changes */
if( (tif->tif_flags & TIFF_DIRTYSTRIP)
&& !(tif->tif_flags & TIFF_DIRTYDIRECT)
&& tif->tif_mode == O_RDWR )
if ((tif->tif_flags & TIFF_DIRTYSTRIP) &&
!(tif->tif_flags & TIFF_DIRTYDIRECT) && tif->tif_mode == O_RDWR)
{
if( TIFFForceStrileArrayWriting(tif) )
if (TIFFForceStrileArrayWriting(tif))
return 1;
}
if ((tif->tif_flags & (TIFF_DIRTYDIRECT|TIFF_DIRTYSTRIP))
&& !TIFFRewriteDirectory(tif))
if ((tif->tif_flags & (TIFF_DIRTYDIRECT | TIFF_DIRTYSTRIP)) &&
!TIFFRewriteDirectory(tif))
return (0);
return (1);
......@@ -75,45 +73,43 @@ TIFFFlush(TIFF* tif)
*
* Returns 1 in case of success, 0 otherwise.
*/
int TIFFForceStrileArrayWriting(TIFF* tif)
int TIFFForceStrileArrayWriting(TIFF *tif)
{
static const char module[] = "TIFFForceStrileArrayWriting";
const int isTiled = TIFFIsTiled(tif);
if (tif->tif_mode == O_RDONLY)
{
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
"File opened in read-only mode");
TIFFErrorExtR(tif, tif->tif_name, "File opened in read-only mode");
return 0;
}
if( tif->tif_diroff == 0 )
if (tif->tif_diroff == 0)
{
TIFFErrorExt(tif->tif_clientdata, module,
"Directory has not yet been written");
TIFFErrorExtR(tif, module, "Directory has not yet been written");
return 0;
}
if( (tif->tif_flags & TIFF_DIRTYDIRECT) != 0 )
if ((tif->tif_flags & TIFF_DIRTYDIRECT) != 0)
{
TIFFErrorExt(tif->tif_clientdata, module,
"Directory has changes other than the strile arrays. "
"TIFFRewriteDirectory() should be called instead");
TIFFErrorExtR(tif, module,
"Directory has changes other than the strile arrays. "
"TIFFRewriteDirectory() should be called instead");
return 0;
}
if( !(tif->tif_flags & TIFF_DIRTYSTRIP) )
if (!(tif->tif_flags & TIFF_DIRTYSTRIP))
{
if( !(tif->tif_dir.td_stripoffset_entry.tdir_tag != 0 &&
tif->tif_dir.td_stripoffset_entry.tdir_count == 0 &&
tif->tif_dir.td_stripoffset_entry.tdir_type == 0 &&
tif->tif_dir.td_stripoffset_entry.tdir_offset.toff_long8 == 0 &&
tif->tif_dir.td_stripbytecount_entry.tdir_tag != 0 &&
tif->tif_dir.td_stripbytecount_entry.tdir_count == 0 &&
tif->tif_dir.td_stripbytecount_entry.tdir_type == 0 &&
tif->tif_dir.td_stripbytecount_entry.tdir_offset.toff_long8 == 0) )
if (!(tif->tif_dir.td_stripoffset_entry.tdir_tag != 0 &&
tif->tif_dir.td_stripoffset_entry.tdir_count == 0 &&
tif->tif_dir.td_stripoffset_entry.tdir_type == 0 &&
tif->tif_dir.td_stripoffset_entry.tdir_offset.toff_long8 == 0 &&
tif->tif_dir.td_stripbytecount_entry.tdir_tag != 0 &&
tif->tif_dir.td_stripbytecount_entry.tdir_count == 0 &&
tif->tif_dir.td_stripbytecount_entry.tdir_type == 0 &&
tif->tif_dir.td_stripbytecount_entry.tdir_offset.toff_long8 == 0))
{
TIFFErrorExt(tif->tif_clientdata, module,
"Function not called together with "
"TIFFDeferStrileArrayWriting()");
TIFFErrorExtR(tif, module,
"Function not called together with "
"TIFFDeferStrileArrayWriting()");
return 0;
}
......@@ -121,18 +117,14 @@ int TIFFForceStrileArrayWriting(TIFF* tif)
return 0;
}
if( _TIFFRewriteField( tif,
isTiled ? TIFFTAG_TILEOFFSETS :
TIFFTAG_STRIPOFFSETS,
TIFF_LONG8,
tif->tif_dir.td_nstrips,
tif->tif_dir.td_stripoffset_p )
&& _TIFFRewriteField( tif,
isTiled ? TIFFTAG_TILEBYTECOUNTS :
TIFFTAG_STRIPBYTECOUNTS,
TIFF_LONG8,
tif->tif_dir.td_nstrips,
tif->tif_dir.td_stripbytecount_p ) )
if (_TIFFRewriteField(tif,
isTiled ? TIFFTAG_TILEOFFSETS : TIFFTAG_STRIPOFFSETS,
TIFF_LONG8, tif->tif_dir.td_nstrips,
tif->tif_dir.td_stripoffset_p) &&
_TIFFRewriteField(
tif, isTiled ? TIFFTAG_TILEBYTECOUNTS : TIFFTAG_STRIPBYTECOUNTS,
TIFF_LONG8, tif->tif_dir.td_nstrips,
tif->tif_dir.td_stripbytecount_p))
{
tif->tif_flags &= ~TIFF_DIRTYSTRIP;
tif->tif_flags &= ~TIFF_BEENWRITING;
......@@ -149,26 +141,17 @@ int TIFFForceStrileArrayWriting(TIFF* tif)
* is not set, so that TIFFFlush() will proceed to write out the directory.
* The documentation says returning 1 is an error indicator, but not having
* been writing isn't exactly a an error. Hopefully this doesn't cause
* problems for other people.
* problems for other people.
*/
int
TIFFFlushData(TIFF* tif)
int TIFFFlushData(TIFF *tif)
{
if ((tif->tif_flags & TIFF_BEENWRITING) == 0)
return (1);
if (tif->tif_flags & TIFF_POSTENCODE) {
tif->tif_flags &= ~TIFF_POSTENCODE;
if (!(*tif->tif_postencode)(tif))
return (0);
}
return (TIFFFlushData1(tif));
if ((tif->tif_flags & TIFF_BEENWRITING) == 0)
return (1);
if (tif->tif_flags & TIFF_POSTENCODE)
{
tif->tif_flags &= ~TIFF_POSTENCODE;
if (!(*tif->tif_postencode)(tif))
return (0);
}
return (TIFFFlushData1(tif));
}
/* vim: set ts=8 sts=8 sw=8 noet: */
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/
/**********************************************************************
* $Id$
*
* Name: tif_hash_set.h
* Project: TIFF - Common Portability Library
* Purpose: Hash set functions.
* Author: Even Rouault, <even dot rouault at spatialys.com>
*
**********************************************************************
* Copyright (c) 2008-2009, Even Rouault <even dot rouault at spatialys.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
****************************************************************************/
#ifndef TIFF_HASH_SET_H_INCLUDED
#define TIFF_HASH_SET_H_INCLUDED
#include <stdbool.h>
/**
* \file tif_hash_set.h
*
* Hash set implementation.
*
* An hash set is a data structure that holds elements that are unique
* according to a comparison function. Operations on the hash set, such as
* insertion, removal or lookup, are supposed to be fast if an efficient
* "hash" function is provided.
*/
#ifdef __cplusplus
extern "C"
{
#endif
/* Types */
/** Opaque type for a hash set */
typedef struct _TIFFHashSet TIFFHashSet;
/** TIFFHashSetHashFunc */
typedef unsigned long (*TIFFHashSetHashFunc)(const void *elt);
/** TIFFHashSetEqualFunc */
typedef bool (*TIFFHashSetEqualFunc)(const void *elt1, const void *elt2);
/** TIFFHashSetFreeEltFunc */
typedef void (*TIFFHashSetFreeEltFunc)(void *elt);
/* Functions */
TIFFHashSet *TIFFHashSetNew(TIFFHashSetHashFunc fnHashFunc,
TIFFHashSetEqualFunc fnEqualFunc,
TIFFHashSetFreeEltFunc fnFreeEltFunc);
void TIFFHashSetDestroy(TIFFHashSet *set);
#ifdef notused
void TIFFHashSetClear(TIFFHashSet *set);
int TIFFHashSetSize(const TIFFHashSet *set);
/** TIFFHashSetIterEltFunc */
typedef int (*TIFFHashSetIterEltFunc)(void *elt, void *user_data);
void TIFFHashSetForeach(TIFFHashSet *set, TIFFHashSetIterEltFunc fnIterFunc,
void *user_data);
#endif
bool TIFFHashSetInsert(TIFFHashSet *set, void *elt);
void *TIFFHashSetLookup(TIFFHashSet *set, const void *elt);
bool TIFFHashSetRemove(TIFFHashSet *set, const void *elt);
#ifdef notused
bool TIFFHashSetRemoveDeferRehash(TIFFHashSet *set, const void *elt);
#endif
#ifdef __cplusplus
}
#endif
#endif /* TIFF_HASH_SET_H_INCLUDED */
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -23,7 +23,7 @@
*/
#ifndef _TIFFPREDICT_
#define _TIFFPREDICT_
#define _TIFFPREDICT_
#include "tiffio.h"
#include "tiffiop.h"
......@@ -32,50 +32,43 @@
* ``Library-private'' Support for the Predictor Tag
*/
typedef int (*TIFFEncodeDecodeMethod)(TIFF* tif, uint8_t* buf, tmsize_t size);
typedef int (*TIFFEncodeDecodeMethod)(TIFF *tif, uint8_t *buf, tmsize_t size);
/*
* Codecs that want to support the Predictor tag must place
* this structure first in their private state block so that
* the predictor code can cast tif_data to find its state.
*/
typedef struct {
int predictor; /* predictor tag value */
tmsize_t stride; /* sample stride over data */
tmsize_t rowsize; /* tile/strip row size */
typedef struct
{
int predictor; /* predictor tag value */
tmsize_t stride; /* sample stride over data */
tmsize_t rowsize; /* tile/strip row size */
TIFFCodeMethod encoderow; /* parent codec encode/decode row */
TIFFCodeMethod encodestrip; /* parent codec encode/decode strip */
TIFFCodeMethod encodetile; /* parent codec encode/decode tile */
TIFFEncodeDecodeMethod encodepfunc; /* horizontal differencer */
TIFFCodeMethod encoderow; /* parent codec encode/decode row */
TIFFCodeMethod encodestrip; /* parent codec encode/decode strip */
TIFFCodeMethod encodetile; /* parent codec encode/decode tile */
TIFFEncodeDecodeMethod encodepfunc; /* horizontal differencer */
TIFFCodeMethod decoderow; /* parent codec encode/decode row */
TIFFCodeMethod decodestrip; /* parent codec encode/decode strip */
TIFFCodeMethod decodetile; /* parent codec encode/decode tile */
TIFFEncodeDecodeMethod decodepfunc; /* horizontal accumulator */
TIFFCodeMethod decoderow; /* parent codec encode/decode row */
TIFFCodeMethod decodestrip; /* parent codec encode/decode strip */
TIFFCodeMethod decodetile; /* parent codec encode/decode tile */
TIFFEncodeDecodeMethod decodepfunc; /* horizontal accumulator */
TIFFVGetMethod vgetparent; /* super-class method */
TIFFVSetMethod vsetparent; /* super-class method */
TIFFPrintMethod printdir; /* super-class method */
TIFFBoolMethod setupdecode; /* super-class method */
TIFFBoolMethod setupencode; /* super-class method */
TIFFVGetMethod vgetparent; /* super-class method */
TIFFVSetMethod vsetparent; /* super-class method */
TIFFPrintMethod printdir; /* super-class method */
TIFFBoolMethod setupdecode; /* super-class method */
TIFFBoolMethod setupencode; /* super-class method */
} TIFFPredictorState;
#if defined(__cplusplus)
extern "C" {
extern "C"
{
#endif
extern int TIFFPredictorInit(TIFF*);
extern int TIFFPredictorCleanup(TIFF*);
extern int TIFFPredictorInit(TIFF *);
extern int TIFFPredictorCleanup(TIFF *);
#if defined(__cplusplus)
}
#endif
#endif /* _TIFFPREDICT_ */
/* vim: set ts=8 sts=8 sw=8 noet: */
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/
......@@ -2,23 +2,23 @@
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
......@@ -29,59 +29,77 @@
TIFFErrorHandlerExt _TIFFwarningHandlerExt = NULL;
TIFFErrorHandler
TIFFSetWarningHandler(TIFFErrorHandler handler)
TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler handler)
{
TIFFErrorHandler prev = _TIFFwarningHandler;
_TIFFwarningHandler = handler;
return (prev);
TIFFErrorHandler prev = _TIFFwarningHandler;
_TIFFwarningHandler = handler;
return (prev);
}
TIFFErrorHandlerExt
TIFFSetWarningHandlerExt(TIFFErrorHandlerExt handler)
TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt handler)
{
TIFFErrorHandlerExt prev = _TIFFwarningHandlerExt;
_TIFFwarningHandlerExt = handler;
return (prev);
TIFFErrorHandlerExt prev = _TIFFwarningHandlerExt;
_TIFFwarningHandlerExt = handler;
return (prev);
}
void
TIFFWarning(const char* module, const char* fmt, ...)
void TIFFWarning(const char *module, const char *fmt, ...)
{
va_list ap;
if (_TIFFwarningHandler) {
va_start(ap, fmt);
(*_TIFFwarningHandler)(module, fmt, ap);
va_end(ap);
}
if (_TIFFwarningHandlerExt) {
va_start(ap, fmt);
(*_TIFFwarningHandlerExt)(0, module, fmt, ap);
va_end(ap);
}
va_list ap;
if (_TIFFwarningHandler)
{
va_start(ap, fmt);
(*_TIFFwarningHandler)(module, fmt, ap);
va_end(ap);
}
if (_TIFFwarningHandlerExt)
{
va_start(ap, fmt);
(*_TIFFwarningHandlerExt)(0, module, fmt, ap);
va_end(ap);
}
}
void
TIFFWarningExt(thandle_t fd, const char* module, const char* fmt, ...)
void TIFFWarningExt(thandle_t fd, const char *module, const char *fmt, ...)
{
va_list ap;
if (_TIFFwarningHandler) {
va_start(ap, fmt);
(*_TIFFwarningHandler)(module, fmt, ap);
va_end(ap);
}
if (_TIFFwarningHandlerExt) {
va_start(ap, fmt);
(*_TIFFwarningHandlerExt)(fd, module, fmt, ap);
va_end(ap);
}
va_list ap;
if (_TIFFwarningHandler)
{
va_start(ap, fmt);
(*_TIFFwarningHandler)(module, fmt, ap);
va_end(ap);
}
if (_TIFFwarningHandlerExt)
{
va_start(ap, fmt);
(*_TIFFwarningHandlerExt)(fd, module, fmt, ap);
va_end(ap);
}
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/
void TIFFWarningExtR(TIFF *tif, const char *module, const char *fmt, ...)
{
va_list ap;
if (tif && tif->tif_warnhandler)
{
va_start(ap, fmt);
int stop = (*tif->tif_warnhandler)(tif, tif->tif_warnhandler_user_data,
module, fmt, ap);
va_end(ap);
if (stop)
return;
}
if (_TIFFwarningHandler)
{
va_start(ap, fmt);
(*_TIFFwarningHandler)(module, fmt, ap);
va_end(ap);
}
if (_TIFFwarningHandlerExt)
{
va_start(ap, fmt);
(*_TIFFwarningHandlerExt)(tif ? tif->tif_clientdata : 0, module, fmt,
ap);
va_end(ap);
}
}
......@@ -12,6 +12,7 @@
#include <stddef.h>
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
/* Signed 16-bit type */
......
#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.4.0\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
/* clang-format off */
/* clang-format disabled because FindTIFF.cmake is very sensitive to the
* formatting of below line being a single line.
*/
#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.5.0\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
/*
* This define can be used in code that requires
* compilation-related definitions specific to a
......@@ -6,4 +11,20 @@
* version checking should be done based on the
* string returned by TIFFGetVersion.
*/
#define TIFFLIB_VERSION 20220520
#define TIFFLIB_VERSION 20221213
/* The following defines have been added in 4.5.0 */
#define TIFFLIB_MAJOR_VERSION 4
#define TIFFLIB_MINOR_VERSION 5
#define TIFFLIB_MICRO_VERSION 0
/* Macro added in 4.5.0. Returns TRUE if the current libtiff version is
* greater or equal to major.minor.micro
*/
#define TIFFLIB_AT_LEAST(major, minor, micro) \
(TIFFLIB_MAJOR_VERSION > (major) || \
(TIFFLIB_MAJOR_VERSION == (major) && TIFFLIB_MINOR_VERSION > (minor)) || \
(TIFFLIB_MAJOR_VERSION == (major) && TIFFLIB_MINOR_VERSION == (minor) && \
TIFFLIB_MICRO_VERSION >= (micro)))
/* clang-format on */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment