| Index: third_party/libtiff/tif_zip.c
|
| diff --git a/third_party/tiff_v403/tif_zip.c b/third_party/libtiff/tif_zip.c
|
| similarity index 94%
|
| rename from third_party/tiff_v403/tif_zip.c
|
| rename to third_party/libtiff/tif_zip.c
|
| index 1a0d821ba86d37d6c459899c28e750986fe71585..b3ac9b956e1197fe3f6e0221b1dda53c1eff4784 100644
|
| --- a/third_party/tiff_v403/tif_zip.c
|
| +++ b/third_party/libtiff/tif_zip.c
|
| @@ -1,4 +1,4 @@
|
| -/* $Id: tif_zip.c,v 1.31 2011-01-06 16:00:23 fwarmerdam Exp $ */
|
| +/* $Id: tif_zip.c,v 1.33 2014-12-25 18:29:11 erouault Exp $ */
|
|
|
| /*
|
| * Copyright (c) 1995-1997 Sam Leffler
|
| @@ -23,6 +23,7 @@
|
| * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| * OF THIS SOFTWARE.
|
| */
|
| +
|
| #include "tiffiop.h"
|
| #ifdef ZIP_SUPPORT
|
| /*
|
| @@ -35,7 +36,7 @@
|
| * of the library: this code assumes the 1.0 API and also depends on
|
| * the ability to write the zlib header multiple times (one per strip)
|
| * which was not possible with versions prior to 0.95. Note also that
|
| - * older versions of this codec avoided this bug by supressing the header
|
| + * older versions of this codec avoided this bug by suppressing the header
|
| * entirely. This means that files written with the old library cannot
|
| * be read; they should be converted to a different compression scheme
|
| * and then reconverted.
|
| @@ -60,6 +61,8 @@
|
| #error "Antiquated ZLIB software; you must use version 1.0 or later"
|
| #endif
|
|
|
| +#define SAFE_MSG(sp) ((sp)->stream.msg == NULL ? "" : (sp)->stream.msg)
|
| +
|
| /*
|
| * State block for each open TIFF
|
| * file using ZIP compression/decompression.
|
| @@ -105,7 +108,7 @@ ZIPSetupDecode(TIFF* tif)
|
| }
|
|
|
| if (inflateInit(&sp->stream) != Z_OK) {
|
| - TIFFErrorExt(tif->tif_clientdata, module, "%s", sp->stream.msg);
|
| + TIFFErrorExt(tif->tif_clientdata, module, "%s", SAFE_MSG(sp));
|
| return (0);
|
| } else {
|
| sp->state |= ZSTATE_INIT_DECODE;
|
| @@ -173,14 +176,14 @@ ZIPDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
|
| if (state == Z_DATA_ERROR) {
|
| TIFFErrorExt(tif->tif_clientdata, module,
|
| "Decoding error at scanline %lu, %s",
|
| - (unsigned long) tif->tif_row, sp->stream.msg);
|
| + (unsigned long) tif->tif_row, SAFE_MSG(sp));
|
| if (inflateSync(&sp->stream) != Z_OK)
|
| return (0);
|
| continue;
|
| }
|
| if (state != Z_OK) {
|
| - TIFFErrorExt(tif->tif_clientdata, module, "ZLib error: %s",
|
| - sp->stream.msg);
|
| + TIFFErrorExt(tif->tif_clientdata, module,
|
| + "ZLib error: %s", SAFE_MSG(sp));
|
| return (0);
|
| }
|
| } while (sp->stream.avail_out > 0);
|
| @@ -210,7 +213,7 @@ ZIPSetupEncode(TIFF* tif)
|
| }
|
|
|
| if (deflateInit(&sp->stream, sp->zipquality) != Z_OK) {
|
| - TIFFErrorExt(tif->tif_clientdata, module, "%s", sp->stream.msg);
|
| + TIFFErrorExt(tif->tif_clientdata, module, "%s", SAFE_MSG(sp));
|
| return (0);
|
| } else {
|
| sp->state |= ZSTATE_INIT_ENCODE;
|
| @@ -237,7 +240,7 @@ ZIPPreEncode(TIFF* tif, uint16 s)
|
| we need to simplify this code to reflect a ZLib that is likely updated
|
| to deal with 8byte memory sizes, though this code will respond
|
| apropriately even before we simplify it */
|
| - sp->stream.avail_out = (uInt)tif->tif_rawdatasize;
|
| + sp->stream.avail_out = tif->tif_rawdatasize;
|
| if ((tmsize_t)sp->stream.avail_out != tif->tif_rawdatasize)
|
| {
|
| TIFFErrorExt(tif->tif_clientdata, module, "ZLib cannot deal with buffers this size");
|
| @@ -272,8 +275,9 @@ ZIPEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
|
| }
|
| do {
|
| if (deflate(&sp->stream, Z_NO_FLUSH) != Z_OK) {
|
| - TIFFErrorExt(tif->tif_clientdata, module, "Encoder error: %s",
|
| - sp->stream.msg);
|
| + TIFFErrorExt(tif->tif_clientdata, module,
|
| + "Encoder error: %s",
|
| + SAFE_MSG(sp));
|
| return (0);
|
| }
|
| if (sp->stream.avail_out == 0) {
|
| @@ -312,8 +316,8 @@ ZIPPostEncode(TIFF* tif)
|
| }
|
| break;
|
| default:
|
| - TIFFErrorExt(tif->tif_clientdata, module, "ZLib error: %s",
|
| - sp->stream.msg);
|
| + TIFFErrorExt(tif->tif_clientdata, module,
|
| + "ZLib error: %s", SAFE_MSG(sp));
|
| return (0);
|
| }
|
| } while (state != Z_STREAM_END);
|
| @@ -358,7 +362,7 @@ ZIPVSetField(TIFF* tif, uint32 tag, va_list ap)
|
| if (deflateParams(&sp->stream,
|
| sp->zipquality, Z_DEFAULT_STRATEGY) != Z_OK) {
|
| TIFFErrorExt(tif->tif_clientdata, module, "ZLib error: %s",
|
| - sp->stream.msg);
|
| + SAFE_MSG(sp));
|
| return (0);
|
| }
|
| }
|
| @@ -466,4 +470,3 @@ bad:
|
| * fill-column: 78
|
| * End:
|
| */
|
| -
|
|
|