Lines Matching refs:sp
64 #define SAFE_MSG(sp) ((sp)->stream.msg == NULL ? "" : (sp)->stream.msg) argument
100 ZIPState* sp = DecoderState(tif); in ZIPSetupDecode() local
102 assert(sp != NULL); in ZIPSetupDecode()
105 if (sp->state & ZSTATE_INIT_ENCODE) { in ZIPSetupDecode()
106 deflateEnd(&sp->stream); in ZIPSetupDecode()
107 sp->state = 0; in ZIPSetupDecode()
113 if ((sp->state & ZSTATE_INIT_DECODE) == 0 && in ZIPSetupDecode()
114 inflateInit(&sp->stream) != Z_OK) { in ZIPSetupDecode()
115 TIFFErrorExt(tif->tif_clientdata, module, "%s", SAFE_MSG(sp)); in ZIPSetupDecode()
118 sp->state |= ZSTATE_INIT_DECODE; in ZIPSetupDecode()
130 ZIPState* sp = DecoderState(tif); in ZIPPreDecode() local
133 assert(sp != NULL); in ZIPPreDecode()
135 if( (sp->state & ZSTATE_INIT_DECODE) == 0 ) in ZIPPreDecode()
138 sp->stream.next_in = tif->tif_rawdata; in ZIPPreDecode()
139 assert(sizeof(sp->stream.avail_in)==4); /* if this assert gets raised, in ZIPPreDecode()
143 sp->stream.avail_in = (uInt) tif->tif_rawcc; in ZIPPreDecode()
144 if ((tmsize_t)sp->stream.avail_in != tif->tif_rawcc) in ZIPPreDecode()
149 return (inflateReset(&sp->stream) == Z_OK); in ZIPPreDecode()
156 ZIPState* sp = DecoderState(tif); in ZIPDecode() local
159 assert(sp != NULL); in ZIPDecode()
160 assert(sp->state == ZSTATE_INIT_DECODE); in ZIPDecode()
162 sp->stream.next_in = tif->tif_rawcp; in ZIPDecode()
163 sp->stream.avail_in = (uInt) tif->tif_rawcc; in ZIPDecode()
165 sp->stream.next_out = op; in ZIPDecode()
166 assert(sizeof(sp->stream.avail_out)==4); /* if this assert gets raised, in ZIPDecode()
170 sp->stream.avail_out = (uInt) occ; in ZIPDecode()
171 if ((tmsize_t)sp->stream.avail_out != occ) in ZIPDecode()
177 int state = inflate(&sp->stream, Z_PARTIAL_FLUSH); in ZIPDecode()
183 (unsigned long) tif->tif_row, SAFE_MSG(sp)); in ZIPDecode()
184 if (inflateSync(&sp->stream) != Z_OK) in ZIPDecode()
190 "ZLib error: %s", SAFE_MSG(sp)); in ZIPDecode()
193 } while (sp->stream.avail_out > 0); in ZIPDecode()
194 if (sp->stream.avail_out != 0) { in ZIPDecode()
197 (unsigned long) tif->tif_row, (TIFF_UINT64_T) sp->stream.avail_out); in ZIPDecode()
201 tif->tif_rawcp = sp->stream.next_in; in ZIPDecode()
202 tif->tif_rawcc = sp->stream.avail_in; in ZIPDecode()
211 ZIPState* sp = EncoderState(tif); in ZIPSetupEncode() local
213 assert(sp != NULL); in ZIPSetupEncode()
214 if (sp->state & ZSTATE_INIT_DECODE) { in ZIPSetupEncode()
215 inflateEnd(&sp->stream); in ZIPSetupEncode()
216 sp->state = 0; in ZIPSetupEncode()
219 if (deflateInit(&sp->stream, sp->zipquality) != Z_OK) { in ZIPSetupEncode()
220 TIFFErrorExt(tif->tif_clientdata, module, "%s", SAFE_MSG(sp)); in ZIPSetupEncode()
223 sp->state |= ZSTATE_INIT_ENCODE; in ZIPSetupEncode()
235 ZIPState *sp = EncoderState(tif); in ZIPPreEncode() local
238 assert(sp != NULL); in ZIPPreEncode()
239 if( sp->state != ZSTATE_INIT_ENCODE ) in ZIPPreEncode()
242 sp->stream.next_out = tif->tif_rawdata; in ZIPPreEncode()
243 assert(sizeof(sp->stream.avail_out)==4); /* if this assert gets raised, in ZIPPreEncode()
247 sp->stream.avail_out = (uInt)tif->tif_rawdatasize; in ZIPPreEncode()
248 if ((tmsize_t)sp->stream.avail_out != tif->tif_rawdatasize) in ZIPPreEncode()
253 return (deflateReset(&sp->stream) == Z_OK); in ZIPPreEncode()
263 ZIPState *sp = EncoderState(tif); in ZIPEncode() local
265 assert(sp != NULL); in ZIPEncode()
266 assert(sp->state == ZSTATE_INIT_ENCODE); in ZIPEncode()
269 sp->stream.next_in = bp; in ZIPEncode()
270 assert(sizeof(sp->stream.avail_in)==4); /* if this assert gets raised, in ZIPEncode()
274 sp->stream.avail_in = (uInt) cc; in ZIPEncode()
275 if ((tmsize_t)sp->stream.avail_in != cc) in ZIPEncode()
281 if (deflate(&sp->stream, Z_NO_FLUSH) != Z_OK) { in ZIPEncode()
284 SAFE_MSG(sp)); in ZIPEncode()
287 if (sp->stream.avail_out == 0) { in ZIPEncode()
290 sp->stream.next_out = tif->tif_rawdata; in ZIPEncode()
291 …sp->stream.avail_out = (uInt) tif->tif_rawdatasize; /* this is a safe typecast, as check is made … in ZIPEncode()
293 } while (sp->stream.avail_in > 0); in ZIPEncode()
305 ZIPState *sp = EncoderState(tif); in ZIPPostEncode() local
308 sp->stream.avail_in = 0; in ZIPPostEncode()
310 state = deflate(&sp->stream, Z_FINISH); in ZIPPostEncode()
314 if ((tmsize_t)sp->stream.avail_out != tif->tif_rawdatasize) in ZIPPostEncode()
316 tif->tif_rawcc = tif->tif_rawdatasize - sp->stream.avail_out; in ZIPPostEncode()
318 sp->stream.next_out = tif->tif_rawdata; in ZIPPostEncode()
319 …sp->stream.avail_out = (uInt) tif->tif_rawdatasize; /* this is a safe typecast, as check is made … in ZIPPostEncode()
324 "ZLib error: %s", SAFE_MSG(sp)); in ZIPPostEncode()
334 ZIPState* sp = ZState(tif); in ZIPCleanup() local
336 assert(sp != 0); in ZIPCleanup()
340 tif->tif_tagmethods.vgetfield = sp->vgetparent; in ZIPCleanup()
341 tif->tif_tagmethods.vsetfield = sp->vsetparent; in ZIPCleanup()
343 if (sp->state & ZSTATE_INIT_ENCODE) { in ZIPCleanup()
344 deflateEnd(&sp->stream); in ZIPCleanup()
345 sp->state = 0; in ZIPCleanup()
346 } else if( sp->state & ZSTATE_INIT_DECODE) { in ZIPCleanup()
347 inflateEnd(&sp->stream); in ZIPCleanup()
348 sp->state = 0; in ZIPCleanup()
350 _TIFFfree(sp); in ZIPCleanup()
360 ZIPState* sp = ZState(tif); in ZIPVSetField() local
364 sp->zipquality = (int) va_arg(ap, int); in ZIPVSetField()
365 if ( sp->state&ZSTATE_INIT_ENCODE ) { in ZIPVSetField()
366 if (deflateParams(&sp->stream, in ZIPVSetField()
367 sp->zipquality, Z_DEFAULT_STRATEGY) != Z_OK) { in ZIPVSetField()
369 SAFE_MSG(sp)); in ZIPVSetField()
375 return (*sp->vsetparent)(tif, tag, ap); in ZIPVSetField()
383 ZIPState* sp = ZState(tif); in ZIPVGetField() local
387 *va_arg(ap, int*) = sp->zipquality; in ZIPVGetField()
390 return (*sp->vgetparent)(tif, tag, ap); in ZIPVGetField()
403 ZIPState* sp; in TIFFInitZIP() local
423 sp = ZState(tif); in TIFFInitZIP()
424 sp->stream.zalloc = NULL; in TIFFInitZIP()
425 sp->stream.zfree = NULL; in TIFFInitZIP()
426 sp->stream.opaque = NULL; in TIFFInitZIP()
427 sp->stream.data_type = Z_BINARY; in TIFFInitZIP()
432 sp->vgetparent = tif->tif_tagmethods.vgetfield; in TIFFInitZIP()
434 sp->vsetparent = tif->tif_tagmethods.vsetfield; in TIFFInitZIP()
438 sp->zipquality = Z_DEFAULT_COMPRESSION; /* default comp. level */ in TIFFInitZIP()
439 sp->state = 0; in TIFFInitZIP()