X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b47c832e5529dc6c632536b4665a005f0a85aec8..1454d4e6599bbd18086cdf0cf1b06c2b9004fe3a:/src/tiff/tif_lzw.c diff --git a/src/tiff/tif_lzw.c b/src/tiff/tif_lzw.c index 3d90286aca..d739e6f18d 100644 --- a/src/tiff/tif_lzw.c +++ b/src/tiff/tif_lzw.c @@ -4,23 +4,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. */ @@ -36,7 +36,12 @@ * * The original Berkeley copyright notice appears below in its entirety. */ +/* Watcom C++ (or its make utility) doesn't like long filenames */ +#ifdef __WATCOMC__ +#include "tif_pred.h" +#else #include "tif_predict.h" +#endif #include #include @@ -115,7 +120,7 @@ typedef struct code_ent { u_char firstchar; /* first token of string */ } code_t; -typedef int (*decodeFunc)(TIFF*, tidata_t, tsize_t, tsample_t); +typedef int (LINKAGEMODE *decodeFunc)(TIFF*, tidata_t, tsize_t, tsample_t); typedef struct { LZWBaseState base; @@ -157,9 +162,9 @@ typedef struct { #define DecoderState(tif) ((LZWDecodeState*) LZWState(tif)) #define EncoderState(tif) ((LZWEncodeState*) LZWState(tif)) -static int LZWDecode(TIFF*, tidata_t, tsize_t, tsample_t); +static int LINKAGEMODE LZWDecode(TIFF*, tidata_t, tsize_t, tsample_t); #ifdef LZW_COMPAT -static int LZWDecodeCompat(TIFF*, tidata_t, tsize_t, tsample_t); +static int LINKAGEMODE LZWDecodeCompat(TIFF*, tidata_t, tsize_t, tsample_t); #endif static void cl_hash(LZWEncodeState*); @@ -489,7 +494,7 @@ LZWDecode(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s) nextbits -= nbits; \ } -static int +static int LINKAGEMODE LZWDecodeCompat(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s) { LZWDecodeState *sp = DecoderState(tif); @@ -706,18 +711,18 @@ LZWPreEncode(TIFF* tif, tsample_t s) /* * Encode a chunk of pixels. * - * Uses an open addressing double hashing (no chaining) on the + * Uses an open addressing double hashing (no chaining) on the * prefix code/next character combination. We do a variant of * Knuth's algorithm D (vol. 3, sec. 6.4) along with G. Knott's * relatively-prime secondary probe. Here, the modular division - * first probe is gives way to a faster exclusive-or manipulation. + * first probe is gives way to a faster exclusive-or manipulation. * Also do block compression with an adaptive reset, whereby the * code table is cleared when the compression ratio decreases, * but after the table fills. The variable-length output codes * are re-sized at this point, and a CODE_CLEAR is generated - * for the decoder. + * for the decoder. */ -static int +static int LINKAGEMODE LZWEncode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) { register LZWEncodeState *sp = EncoderState(tif); @@ -899,7 +904,7 @@ LZWPostEncode(TIFF* tif) sp->enc_oldcode = (hcode_t) -1; } PutNextCode(op, CODE_EOI); - if (nextbits > 0) + if (nextbits > 0) *op++ = (u_char)(nextdata << (8-nextbits)); tif->tif_rawcc = (tsize_t)(op - tif->tif_rawdata); return (1);