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()
110 if (inflateInit(&sp->stream) != Z_OK) { in ZIPSetupDecode()
111 TIFFErrorExt(tif->tif_clientdata, module, "%s", SAFE_MSG(sp)); in ZIPSetupDecode()
114 sp->state |= ZSTATE_INIT_DECODE; in ZIPSetupDecode()
126 ZIPState* sp = DecoderState(tif); in ZIPPreDecode() local
129 assert(sp != NULL); in ZIPPreDecode()
131 if( (sp->state & ZSTATE_INIT_DECODE) == 0 ) in ZIPPreDecode()
134 sp->stream.next_in = tif->tif_rawdata; in ZIPPreDecode()
135 assert(sizeof(sp->stream.avail_in)==4); /* if this assert gets raised, in ZIPPreDecode()
139 sp->stream.avail_in = (uInt) tif->tif_rawcc; in ZIPPreDecode()
140 if ((tmsize_t)sp->stream.avail_in != tif->tif_rawcc) in ZIPPreDecode()
145 return (inflateReset(&sp->stream) == Z_OK); in ZIPPreDecode()
152 ZIPState* sp = DecoderState(tif); in ZIPDecode() local
155 assert(sp != NULL); in ZIPDecode()
156 assert(sp->state == ZSTATE_INIT_DECODE); in ZIPDecode()
158 sp->stream.next_in = tif->tif_rawcp; in ZIPDecode()
159 sp->stream.avail_in = (uInt) tif->tif_rawcc; in ZIPDecode()
161 sp->stream.next_out = op; in ZIPDecode()
162 assert(sizeof(sp->stream.avail_out)==4); /* if this assert gets raised, in ZIPDecode()
166 sp->stream.avail_out = (uInt) occ; in ZIPDecode()
167 if ((tmsize_t)sp->stream.avail_out != occ) in ZIPDecode()
173 int state = inflate(&sp->stream, Z_PARTIAL_FLUSH); in ZIPDecode()
179 (unsigned long) tif->tif_row, SAFE_MSG(sp)); in ZIPDecode()
180 if (inflateSync(&sp->stream) != Z_OK) in ZIPDecode()
186 "ZLib error: %s", SAFE_MSG(sp)); in ZIPDecode()
189 } while (sp->stream.avail_out > 0); in ZIPDecode()
190 if (sp->stream.avail_out != 0) { in ZIPDecode()
193 (unsigned long) tif->tif_row, (TIFF_UINT64_T) sp->stream.avail_out); in ZIPDecode()
197 tif->tif_rawcp = sp->stream.next_in; in ZIPDecode()
198 tif->tif_rawcc = sp->stream.avail_in; in ZIPDecode()
207 ZIPState* sp = EncoderState(tif); in ZIPSetupEncode() local
209 assert(sp != NULL); in ZIPSetupEncode()
210 if (sp->state & ZSTATE_INIT_DECODE) { in ZIPSetupEncode()
211 inflateEnd(&sp->stream); in ZIPSetupEncode()
212 sp->state = 0; in ZIPSetupEncode()
215 if (deflateInit(&sp->stream, sp->zipquality) != Z_OK) { in ZIPSetupEncode()
216 TIFFErrorExt(tif->tif_clientdata, module, "%s", SAFE_MSG(sp)); in ZIPSetupEncode()
219 sp->state |= ZSTATE_INIT_ENCODE; in ZIPSetupEncode()
231 ZIPState *sp = EncoderState(tif); in ZIPPreEncode() local
234 assert(sp != NULL); in ZIPPreEncode()
235 if( sp->state != ZSTATE_INIT_ENCODE ) in ZIPPreEncode()
238 sp->stream.next_out = tif->tif_rawdata; in ZIPPreEncode()
239 assert(sizeof(sp->stream.avail_out)==4); /* if this assert gets raised, in ZIPPreEncode()
243 sp->stream.avail_out = tif->tif_rawdatasize; in ZIPPreEncode()
244 if ((tmsize_t)sp->stream.avail_out != tif->tif_rawdatasize) in ZIPPreEncode()
249 return (deflateReset(&sp->stream) == Z_OK); in ZIPPreEncode()
259 ZIPState *sp = EncoderState(tif); in ZIPEncode() local
261 assert(sp != NULL); in ZIPEncode()
262 assert(sp->state == ZSTATE_INIT_ENCODE); in ZIPEncode()
265 sp->stream.next_in = bp; in ZIPEncode()
266 assert(sizeof(sp->stream.avail_in)==4); /* if this assert gets raised, in ZIPEncode()
270 sp->stream.avail_in = (uInt) cc; in ZIPEncode()
271 if ((tmsize_t)sp->stream.avail_in != cc) in ZIPEncode()
277 if (deflate(&sp->stream, Z_NO_FLUSH) != Z_OK) { in ZIPEncode()
280 SAFE_MSG(sp)); in ZIPEncode()
283 if (sp->stream.avail_out == 0) { in ZIPEncode()
286 sp->stream.next_out = tif->tif_rawdata; in ZIPEncode()
287 …sp->stream.avail_out = (uInt) tif->tif_rawdatasize; /* this is a safe typecast, as check is made … in ZIPEncode()
289 } while (sp->stream.avail_in > 0); in ZIPEncode()
301 ZIPState *sp = EncoderState(tif); in ZIPPostEncode() local
304 sp->stream.avail_in = 0; in ZIPPostEncode()
306 state = deflate(&sp->stream, Z_FINISH); in ZIPPostEncode()
310 if ((tmsize_t)sp->stream.avail_out != tif->tif_rawdatasize) in ZIPPostEncode()
312 tif->tif_rawcc = tif->tif_rawdatasize - sp->stream.avail_out; in ZIPPostEncode()
314 sp->stream.next_out = tif->tif_rawdata; in ZIPPostEncode()
315 …sp->stream.avail_out = (uInt) tif->tif_rawdatasize; /* this is a safe typecast, as check is made … in ZIPPostEncode()
320 "ZLib error: %s", SAFE_MSG(sp)); in ZIPPostEncode()
330 ZIPState* sp = ZState(tif); in ZIPCleanup() local
332 assert(sp != 0); in ZIPCleanup()
336 tif->tif_tagmethods.vgetfield = sp->vgetparent; in ZIPCleanup()
337 tif->tif_tagmethods.vsetfield = sp->vsetparent; in ZIPCleanup()
339 if (sp->state & ZSTATE_INIT_ENCODE) { in ZIPCleanup()
340 deflateEnd(&sp->stream); in ZIPCleanup()
341 sp->state = 0; in ZIPCleanup()
342 } else if( sp->state & ZSTATE_INIT_DECODE) { in ZIPCleanup()
343 inflateEnd(&sp->stream); in ZIPCleanup()
344 sp->state = 0; in ZIPCleanup()
346 _TIFFfree(sp); in ZIPCleanup()
356 ZIPState* sp = ZState(tif); in ZIPVSetField() local
360 sp->zipquality = (int) va_arg(ap, int); in ZIPVSetField()
361 if ( sp->state&ZSTATE_INIT_ENCODE ) { in ZIPVSetField()
362 if (deflateParams(&sp->stream, in ZIPVSetField()
363 sp->zipquality, Z_DEFAULT_STRATEGY) != Z_OK) { in ZIPVSetField()
365 SAFE_MSG(sp)); in ZIPVSetField()
371 return (*sp->vsetparent)(tif, tag, ap); in ZIPVSetField()
379 ZIPState* sp = ZState(tif); in ZIPVGetField() local
383 *va_arg(ap, int*) = sp->zipquality; in ZIPVGetField()
386 return (*sp->vgetparent)(tif, tag, ap); in ZIPVGetField()
399 ZIPState* sp; in TIFFInitZIP() local
419 sp = ZState(tif); in TIFFInitZIP()
420 sp->stream.zalloc = NULL; in TIFFInitZIP()
421 sp->stream.zfree = NULL; in TIFFInitZIP()
422 sp->stream.opaque = NULL; in TIFFInitZIP()
423 sp->stream.data_type = Z_BINARY; in TIFFInitZIP()
428 sp->vgetparent = tif->tif_tagmethods.vgetfield; in TIFFInitZIP()
430 sp->vsetparent = tif->tif_tagmethods.vsetfield; in TIFFInitZIP()
434 sp->zipquality = Z_DEFAULT_COMPRESSION; /* default comp. level */ in TIFFInitZIP()
435 sp->state = 0; in TIFFInitZIP()