• Home
  • Raw
  • Download

Lines Matching refs:png_ptr

28 png_process_data(png_structp png_ptr, png_infop info_ptr,  in png_process_data()  argument
31 if(png_ptr == NULL) return; in png_process_data()
32 png_push_restore_buffer(png_ptr, buffer, buffer_size); in png_process_data()
34 while (png_ptr->buffer_size) in png_process_data()
36 png_process_some_data(png_ptr, info_ptr); in png_process_data()
44 png_process_some_data(png_structp png_ptr, png_infop info_ptr) in png_process_some_data() argument
46 if(png_ptr == NULL) return; in png_process_some_data()
47 switch (png_ptr->process_mode) in png_process_some_data()
51 png_push_read_sig(png_ptr, info_ptr); in png_process_some_data()
56 png_push_read_chunk(png_ptr, info_ptr); in png_process_some_data()
61 png_push_read_IDAT(png_ptr); in png_process_some_data()
67 png_push_read_tEXt(png_ptr, info_ptr); in png_process_some_data()
74 png_push_read_zTXt(png_ptr, info_ptr); in png_process_some_data()
81 png_push_read_iTXt(png_ptr, info_ptr); in png_process_some_data()
87 png_push_crc_finish(png_ptr); in png_process_some_data()
92 png_ptr->buffer_size = 0; in png_process_some_data()
105 png_push_read_sig(png_structp png_ptr, png_infop info_ptr) in png_push_read_sig() argument
107 png_size_t num_checked = png_ptr->sig_bytes, in png_push_read_sig()
110 if (png_ptr->buffer_size < num_to_check) in png_push_read_sig()
112 num_to_check = png_ptr->buffer_size; in png_push_read_sig()
115 png_push_fill_buffer(png_ptr, &(info_ptr->signature[num_checked]), in png_push_read_sig()
117 png_ptr->sig_bytes = (png_byte)(png_ptr->sig_bytes+num_to_check); in png_push_read_sig()
123 png_error(png_ptr, "Not a PNG file"); in png_push_read_sig()
125 png_error(png_ptr, "PNG file corrupted by ASCII conversion"); in png_push_read_sig()
129 if (png_ptr->sig_bytes >= 8) in png_push_read_sig()
131 png_ptr->process_mode = PNG_READ_CHUNK_MODE; in png_push_read_sig()
137 png_push_read_chunk(png_structp png_ptr, png_infop info_ptr) in png_push_read_chunk() argument
202 if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER)) in png_push_read_chunk()
206 if (png_ptr->buffer_size < 8) in png_push_read_chunk()
208 png_push_save_buffer(png_ptr); in png_push_read_chunk()
212 png_push_fill_buffer(png_ptr, chunk_length, 4); in png_push_read_chunk()
213 png_ptr->push_length = png_get_uint_31(png_ptr,chunk_length); in png_push_read_chunk()
214 png_reset_crc(png_ptr); in png_push_read_chunk()
215 png_crc_read(png_ptr, png_ptr->chunk_name, 4); in png_push_read_chunk()
216 png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; in png_push_read_chunk()
219 if (!png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4)) in png_push_read_chunk()
220 if(png_ptr->mode & PNG_AFTER_IDAT) in png_push_read_chunk()
221 png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT; in png_push_read_chunk()
223 if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4)) in png_push_read_chunk()
225 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
227 png_push_save_buffer(png_ptr); in png_push_read_chunk()
230 png_handle_IHDR(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
232 else if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4)) in png_push_read_chunk()
234 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
236 png_push_save_buffer(png_ptr); in png_push_read_chunk()
239 png_handle_IEND(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
241 png_ptr->process_mode = PNG_READ_DONE_MODE; in png_push_read_chunk()
242 png_push_have_end(png_ptr, info_ptr); in png_push_read_chunk()
245 else if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name)) in png_push_read_chunk()
247 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
249 png_push_save_buffer(png_ptr); in png_push_read_chunk()
252 if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) in png_push_read_chunk()
253 png_ptr->mode |= PNG_HAVE_IDAT; in png_push_read_chunk()
254 png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
255 if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) in png_push_read_chunk()
256 png_ptr->mode |= PNG_HAVE_PLTE; in png_push_read_chunk()
257 else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) in png_push_read_chunk()
259 if (!(png_ptr->mode & PNG_HAVE_IHDR)) in png_push_read_chunk()
260 png_error(png_ptr, "Missing IHDR before IDAT"); in png_push_read_chunk()
261 else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && in png_push_read_chunk()
262 !(png_ptr->mode & PNG_HAVE_PLTE)) in png_push_read_chunk()
263 png_error(png_ptr, "Missing PLTE before IDAT"); in png_push_read_chunk()
267 else if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) in png_push_read_chunk()
269 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
271 png_push_save_buffer(png_ptr); in png_push_read_chunk()
274 png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
276 else if (!png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4)) in png_push_read_chunk()
282 if (!(png_ptr->mode & PNG_HAVE_IHDR)) in png_push_read_chunk()
283 png_error(png_ptr, "Missing IHDR before IDAT"); in png_push_read_chunk()
284 else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && in png_push_read_chunk()
285 !(png_ptr->mode & PNG_HAVE_PLTE)) in png_push_read_chunk()
286 png_error(png_ptr, "Missing PLTE before IDAT"); in png_push_read_chunk()
288 if (png_ptr->mode & PNG_HAVE_IDAT) in png_push_read_chunk()
290 if (!(png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT)) in png_push_read_chunk()
291 if (png_ptr->push_length == 0) in png_push_read_chunk()
294 if (png_ptr->mode & PNG_AFTER_IDAT) in png_push_read_chunk()
295 png_error(png_ptr, "Too many IDAT's found"); in png_push_read_chunk()
298 png_ptr->idat_size = png_ptr->push_length; in png_push_read_chunk()
299 png_ptr->mode |= PNG_HAVE_IDAT; in png_push_read_chunk()
300 png_ptr->process_mode = PNG_READ_IDAT_MODE; in png_push_read_chunk()
301 png_push_have_info(png_ptr, info_ptr); in png_push_read_chunk()
302 png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes; in png_push_read_chunk()
303 png_ptr->zstream.next_out = png_ptr->row_buf; in png_push_read_chunk()
307 else if (!png_memcmp(png_ptr->chunk_name, png_gAMA, 4)) in png_push_read_chunk()
309 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
311 png_push_save_buffer(png_ptr); in png_push_read_chunk()
314 png_handle_gAMA(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
318 else if (!png_memcmp(png_ptr->chunk_name, png_sBIT, 4)) in png_push_read_chunk()
320 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
322 png_push_save_buffer(png_ptr); in png_push_read_chunk()
325 png_handle_sBIT(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
329 else if (!png_memcmp(png_ptr->chunk_name, png_cHRM, 4)) in png_push_read_chunk()
331 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
333 png_push_save_buffer(png_ptr); in png_push_read_chunk()
336 png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
340 else if (!png_memcmp(png_ptr->chunk_name, png_sRGB, 4)) in png_push_read_chunk()
342 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
344 png_push_save_buffer(png_ptr); in png_push_read_chunk()
347 png_handle_sRGB(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
351 else if (!png_memcmp(png_ptr->chunk_name, png_iCCP, 4)) in png_push_read_chunk()
353 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
355 png_push_save_buffer(png_ptr); in png_push_read_chunk()
358 png_handle_iCCP(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
362 else if (!png_memcmp(png_ptr->chunk_name, png_sPLT, 4)) in png_push_read_chunk()
364 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
366 png_push_save_buffer(png_ptr); in png_push_read_chunk()
369 png_handle_sPLT(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
373 else if (!png_memcmp(png_ptr->chunk_name, png_tRNS, 4)) in png_push_read_chunk()
375 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
377 png_push_save_buffer(png_ptr); in png_push_read_chunk()
380 png_handle_tRNS(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
384 else if (!png_memcmp(png_ptr->chunk_name, png_bKGD, 4)) in png_push_read_chunk()
386 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
388 png_push_save_buffer(png_ptr); in png_push_read_chunk()
391 png_handle_bKGD(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
395 else if (!png_memcmp(png_ptr->chunk_name, png_hIST, 4)) in png_push_read_chunk()
397 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
399 png_push_save_buffer(png_ptr); in png_push_read_chunk()
402 png_handle_hIST(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
406 else if (!png_memcmp(png_ptr->chunk_name, png_pHYs, 4)) in png_push_read_chunk()
408 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
410 png_push_save_buffer(png_ptr); in png_push_read_chunk()
413 png_handle_pHYs(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
417 else if (!png_memcmp(png_ptr->chunk_name, png_oFFs, 4)) in png_push_read_chunk()
419 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
421 png_push_save_buffer(png_ptr); in png_push_read_chunk()
424 png_handle_oFFs(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
428 else if (!png_memcmp(png_ptr->chunk_name, png_pCAL, 4)) in png_push_read_chunk()
430 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
432 png_push_save_buffer(png_ptr); in png_push_read_chunk()
435 png_handle_pCAL(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
439 else if (!png_memcmp(png_ptr->chunk_name, png_sCAL, 4)) in png_push_read_chunk()
441 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
443 png_push_save_buffer(png_ptr); in png_push_read_chunk()
446 png_handle_sCAL(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
450 else if (!png_memcmp(png_ptr->chunk_name, png_tIME, 4)) in png_push_read_chunk()
452 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
454 png_push_save_buffer(png_ptr); in png_push_read_chunk()
457 png_handle_tIME(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
461 else if (!png_memcmp(png_ptr->chunk_name, png_tEXt, 4)) in png_push_read_chunk()
463 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
465 png_push_save_buffer(png_ptr); in png_push_read_chunk()
468 png_push_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
472 else if (!png_memcmp(png_ptr->chunk_name, png_zTXt, 4)) in png_push_read_chunk()
474 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
476 png_push_save_buffer(png_ptr); in png_push_read_chunk()
479 png_push_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
483 else if (!png_memcmp(png_ptr->chunk_name, png_iTXt, 4)) in png_push_read_chunk()
485 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
487 png_push_save_buffer(png_ptr); in png_push_read_chunk()
490 png_push_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
495 if (png_ptr->push_length + 4 > png_ptr->buffer_size) in png_push_read_chunk()
497 png_push_save_buffer(png_ptr); in png_push_read_chunk()
500 png_push_handle_unknown(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
503 png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; in png_push_read_chunk()
507 png_push_crc_skip(png_structp png_ptr, png_uint_32 skip) in png_push_crc_skip() argument
509 png_ptr->process_mode = PNG_SKIP_MODE; in png_push_crc_skip()
510 png_ptr->skip_length = skip; in png_push_crc_skip()
514 png_push_crc_finish(png_structp png_ptr) in png_push_crc_finish() argument
516 if (png_ptr->skip_length && png_ptr->save_buffer_size) in png_push_crc_finish()
520 if (png_ptr->skip_length < (png_uint_32)png_ptr->save_buffer_size) in png_push_crc_finish()
521 save_size = (png_size_t)png_ptr->skip_length; in png_push_crc_finish()
523 save_size = png_ptr->save_buffer_size; in png_push_crc_finish()
525 png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size); in png_push_crc_finish()
527 png_ptr->skip_length -= save_size; in png_push_crc_finish()
528 png_ptr->buffer_size -= save_size; in png_push_crc_finish()
529 png_ptr->save_buffer_size -= save_size; in png_push_crc_finish()
530 png_ptr->save_buffer_ptr += save_size; in png_push_crc_finish()
532 if (png_ptr->skip_length && png_ptr->current_buffer_size) in png_push_crc_finish()
536 if (png_ptr->skip_length < (png_uint_32)png_ptr->current_buffer_size) in png_push_crc_finish()
537 save_size = (png_size_t)png_ptr->skip_length; in png_push_crc_finish()
539 save_size = png_ptr->current_buffer_size; in png_push_crc_finish()
541 png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size); in png_push_crc_finish()
543 png_ptr->skip_length -= save_size; in png_push_crc_finish()
544 png_ptr->buffer_size -= save_size; in png_push_crc_finish()
545 png_ptr->current_buffer_size -= save_size; in png_push_crc_finish()
546 png_ptr->current_buffer_ptr += save_size; in png_push_crc_finish()
548 if (!png_ptr->skip_length) in png_push_crc_finish()
550 if (png_ptr->buffer_size < 4) in png_push_crc_finish()
552 png_push_save_buffer(png_ptr); in png_push_crc_finish()
556 png_crc_finish(png_ptr, 0); in png_push_crc_finish()
557 png_ptr->process_mode = PNG_READ_CHUNK_MODE; in png_push_crc_finish()
562 png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length) in png_push_fill_buffer() argument
566 if(png_ptr == NULL) return; in png_push_fill_buffer()
568 if (png_ptr->save_buffer_size) in png_push_fill_buffer()
572 if (length < png_ptr->save_buffer_size) in png_push_fill_buffer()
575 save_size = png_ptr->save_buffer_size; in png_push_fill_buffer()
577 png_memcpy(ptr, png_ptr->save_buffer_ptr, save_size); in png_push_fill_buffer()
580 png_ptr->buffer_size -= save_size; in png_push_fill_buffer()
581 png_ptr->save_buffer_size -= save_size; in png_push_fill_buffer()
582 png_ptr->save_buffer_ptr += save_size; in png_push_fill_buffer()
584 if (length && png_ptr->current_buffer_size) in png_push_fill_buffer()
588 if (length < png_ptr->current_buffer_size) in png_push_fill_buffer()
591 save_size = png_ptr->current_buffer_size; in png_push_fill_buffer()
593 png_memcpy(ptr, png_ptr->current_buffer_ptr, save_size); in png_push_fill_buffer()
594 png_ptr->buffer_size -= save_size; in png_push_fill_buffer()
595 png_ptr->current_buffer_size -= save_size; in png_push_fill_buffer()
596 png_ptr->current_buffer_ptr += save_size; in png_push_fill_buffer()
601 png_push_save_buffer(png_structp png_ptr) in png_push_save_buffer() argument
603 if (png_ptr->save_buffer_size) in png_push_save_buffer()
605 if (png_ptr->save_buffer_ptr != png_ptr->save_buffer) in png_push_save_buffer()
611 istop = png_ptr->save_buffer_size; in png_push_save_buffer()
612 for (i = 0, sp = png_ptr->save_buffer_ptr, dp = png_ptr->save_buffer; in png_push_save_buffer()
619 if (png_ptr->save_buffer_size + png_ptr->current_buffer_size > in png_push_save_buffer()
620 png_ptr->save_buffer_max) in png_push_save_buffer()
625 if (png_ptr->save_buffer_size > PNG_SIZE_MAX - in png_push_save_buffer()
626 (png_ptr->current_buffer_size + 256)) in png_push_save_buffer()
628 png_error(png_ptr, "Potential overflow of save_buffer"); in png_push_save_buffer()
630 new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256; in png_push_save_buffer()
631 old_buffer = png_ptr->save_buffer; in png_push_save_buffer()
632 png_ptr->save_buffer = (png_bytep)png_malloc(png_ptr, in png_push_save_buffer()
634 png_memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size); in png_push_save_buffer()
635 png_free(png_ptr, old_buffer); in png_push_save_buffer()
636 png_ptr->save_buffer_max = new_max; in png_push_save_buffer()
638 if (png_ptr->current_buffer_size) in png_push_save_buffer()
640 png_memcpy(png_ptr->save_buffer + png_ptr->save_buffer_size, in png_push_save_buffer()
641 png_ptr->current_buffer_ptr, png_ptr->current_buffer_size); in png_push_save_buffer()
642 png_ptr->save_buffer_size += png_ptr->current_buffer_size; in png_push_save_buffer()
643 png_ptr->current_buffer_size = 0; in png_push_save_buffer()
645 png_ptr->save_buffer_ptr = png_ptr->save_buffer; in png_push_save_buffer()
646 png_ptr->buffer_size = 0; in png_push_save_buffer()
650 png_push_restore_buffer(png_structp png_ptr, png_bytep buffer, in png_push_restore_buffer() argument
653 png_ptr->current_buffer = buffer; in png_push_restore_buffer()
654 png_ptr->current_buffer_size = buffer_length; in png_push_restore_buffer()
655 png_ptr->buffer_size = buffer_length + png_ptr->save_buffer_size; in png_push_restore_buffer()
656 png_ptr->current_buffer_ptr = png_ptr->current_buffer; in png_push_restore_buffer()
660 png_push_read_IDAT(png_structp png_ptr) in png_push_read_IDAT() argument
665 if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER)) in png_push_read_IDAT()
669 if (png_ptr->buffer_size < 8) in png_push_read_IDAT()
671 png_push_save_buffer(png_ptr); in png_push_read_IDAT()
675 png_push_fill_buffer(png_ptr, chunk_length, 4); in png_push_read_IDAT()
676 png_ptr->push_length = png_get_uint_31(png_ptr,chunk_length); in png_push_read_IDAT()
677 png_reset_crc(png_ptr); in png_push_read_IDAT()
678 png_crc_read(png_ptr, png_ptr->chunk_name, 4); in png_push_read_IDAT()
679 png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; in png_push_read_IDAT()
681 if (png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4)) in png_push_read_IDAT()
683 png_ptr->process_mode = PNG_READ_CHUNK_MODE; in png_push_read_IDAT()
684 if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) in png_push_read_IDAT()
685 png_error(png_ptr, "Not enough compressed data"); in png_push_read_IDAT()
689 png_ptr->idat_size = png_ptr->push_length; in png_push_read_IDAT()
691 if (png_ptr->idat_size && png_ptr->save_buffer_size) in png_push_read_IDAT()
695 if (png_ptr->idat_size < (png_uint_32)png_ptr->save_buffer_size) in png_push_read_IDAT()
697 save_size = (png_size_t)png_ptr->idat_size; in png_push_read_IDAT()
699 if((png_uint_32)save_size != png_ptr->idat_size) in png_push_read_IDAT()
700 png_error(png_ptr, "save_size overflowed in pngpread"); in png_push_read_IDAT()
703 save_size = png_ptr->save_buffer_size; in png_push_read_IDAT()
705 png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size); in png_push_read_IDAT()
706 if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) in png_push_read_IDAT()
707 png_process_IDAT_data(png_ptr, png_ptr->save_buffer_ptr, save_size); in png_push_read_IDAT()
708 png_ptr->idat_size -= save_size; in png_push_read_IDAT()
709 png_ptr->buffer_size -= save_size; in png_push_read_IDAT()
710 png_ptr->save_buffer_size -= save_size; in png_push_read_IDAT()
711 png_ptr->save_buffer_ptr += save_size; in png_push_read_IDAT()
713 if (png_ptr->idat_size && png_ptr->current_buffer_size) in png_push_read_IDAT()
717 if (png_ptr->idat_size < (png_uint_32)png_ptr->current_buffer_size) in png_push_read_IDAT()
719 save_size = (png_size_t)png_ptr->idat_size; in png_push_read_IDAT()
721 if((png_uint_32)save_size != png_ptr->idat_size) in png_push_read_IDAT()
722 png_error(png_ptr, "save_size overflowed in pngpread"); in png_push_read_IDAT()
725 save_size = png_ptr->current_buffer_size; in png_push_read_IDAT()
727 png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size); in png_push_read_IDAT()
728 if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) in png_push_read_IDAT()
729 png_process_IDAT_data(png_ptr, png_ptr->current_buffer_ptr, save_size); in png_push_read_IDAT()
731 png_ptr->idat_size -= save_size; in png_push_read_IDAT()
732 png_ptr->buffer_size -= save_size; in png_push_read_IDAT()
733 png_ptr->current_buffer_size -= save_size; in png_push_read_IDAT()
734 png_ptr->current_buffer_ptr += save_size; in png_push_read_IDAT()
736 if (!png_ptr->idat_size) in png_push_read_IDAT()
738 if (png_ptr->buffer_size < 4) in png_push_read_IDAT()
740 png_push_save_buffer(png_ptr); in png_push_read_IDAT()
744 png_crc_finish(png_ptr, 0); in png_push_read_IDAT()
745 png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; in png_push_read_IDAT()
746 png_ptr->mode |= PNG_AFTER_IDAT; in png_push_read_IDAT()
751 png_process_IDAT_data(png_structp png_ptr, png_bytep buffer, in png_process_IDAT_data() argument
756 if ((png_ptr->flags & PNG_FLAG_ZLIB_FINISHED) && buffer_length) in png_process_IDAT_data()
757 png_error(png_ptr, "Extra compression data"); in png_process_IDAT_data()
759 png_ptr->zstream.next_in = buffer; in png_process_IDAT_data()
760 png_ptr->zstream.avail_in = (uInt)buffer_length; in png_process_IDAT_data()
763 ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH); in png_process_IDAT_data()
768 if (png_ptr->zstream.avail_in) in png_process_IDAT_data()
769 png_error(png_ptr, "Extra compressed data"); in png_process_IDAT_data()
770 if (!(png_ptr->zstream.avail_out)) in png_process_IDAT_data()
772 png_push_process_row(png_ptr); in png_process_IDAT_data()
775 png_ptr->mode |= PNG_AFTER_IDAT; in png_process_IDAT_data()
776 png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; in png_process_IDAT_data()
782 png_error(png_ptr, "Decompression Error"); in png_process_IDAT_data()
784 if (!(png_ptr->zstream.avail_out)) in png_process_IDAT_data()
788 png_ptr->interlaced && png_ptr->pass > 6) || in png_process_IDAT_data()
789 (!png_ptr->interlaced && in png_process_IDAT_data()
791 png_ptr->row_number == png_ptr->num_rows)) in png_process_IDAT_data()
793 if (png_ptr->zstream.avail_in) in png_process_IDAT_data()
794 png_warning(png_ptr, "Too much data in IDAT chunks"); in png_process_IDAT_data()
795 png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; in png_process_IDAT_data()
798 png_push_process_row(png_ptr); in png_process_IDAT_data()
799 png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes; in png_process_IDAT_data()
800 png_ptr->zstream.next_out = png_ptr->row_buf; in png_process_IDAT_data()
808 png_push_process_row(png_structp png_ptr) in png_push_process_row() argument
810 png_ptr->row_info.color_type = png_ptr->color_type; in png_push_process_row()
811 png_ptr->row_info.width = png_ptr->iwidth; in png_push_process_row()
812 png_ptr->row_info.channels = png_ptr->channels; in png_push_process_row()
813 png_ptr->row_info.bit_depth = png_ptr->bit_depth; in png_push_process_row()
814 png_ptr->row_info.pixel_depth = png_ptr->pixel_depth; in png_push_process_row()
816 png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth, in png_push_process_row()
817 png_ptr->row_info.width); in png_push_process_row()
819 png_read_filter_row(png_ptr, &(png_ptr->row_info), in png_push_process_row()
820 png_ptr->row_buf + 1, png_ptr->prev_row + 1, in png_push_process_row()
821 (int)(png_ptr->row_buf[0])); in png_push_process_row()
823 png_memcpy_check(png_ptr, png_ptr->prev_row, png_ptr->row_buf, in png_push_process_row()
824 png_ptr->rowbytes + 1); in png_push_process_row()
826 if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA)) in png_push_process_row()
827 png_do_read_transformations(png_ptr); in png_push_process_row()
831 if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) in png_push_process_row()
833 if (png_ptr->pass < 6) in png_push_process_row()
838 png_do_read_interlace(png_ptr); in png_push_process_row()
840 switch (png_ptr->pass) in png_push_process_row()
845 for (i = 0; i < 8 && png_ptr->pass == 0; i++) in png_push_process_row()
847 png_push_have_row(png_ptr, png_ptr->row_buf + 1); in png_push_process_row()
848 png_read_push_finish_row(png_ptr); /* updates png_ptr->pass */ in png_push_process_row()
850 if (png_ptr->pass == 2) /* pass 1 might be empty */ in png_push_process_row()
852 for (i = 0; i < 4 && png_ptr->pass == 2; i++) in png_push_process_row()
854 png_push_have_row(png_ptr, png_bytep_NULL); in png_push_process_row()
855 png_read_push_finish_row(png_ptr); in png_push_process_row()
858 if (png_ptr->pass == 4 && png_ptr->height <= 4) in png_push_process_row()
860 for (i = 0; i < 2 && png_ptr->pass == 4; i++) in png_push_process_row()
862 png_push_have_row(png_ptr, png_bytep_NULL); in png_push_process_row()
863 png_read_push_finish_row(png_ptr); in png_push_process_row()
866 if (png_ptr->pass == 6 && png_ptr->height <= 4) in png_push_process_row()
868 png_push_have_row(png_ptr, png_bytep_NULL); in png_push_process_row()
869 png_read_push_finish_row(png_ptr); in png_push_process_row()
876 for (i = 0; i < 8 && png_ptr->pass == 1; i++) in png_push_process_row()
878 png_push_have_row(png_ptr, png_ptr->row_buf + 1); in png_push_process_row()
879 png_read_push_finish_row(png_ptr); in png_push_process_row()
881 if (png_ptr->pass == 2) /* skip top 4 generated rows */ in png_push_process_row()
883 for (i = 0; i < 4 && png_ptr->pass == 2; i++) in png_push_process_row()
885 png_push_have_row(png_ptr, png_bytep_NULL); in png_push_process_row()
886 png_read_push_finish_row(png_ptr); in png_push_process_row()
894 for (i = 0; i < 4 && png_ptr->pass == 2; i++) in png_push_process_row()
896 png_push_have_row(png_ptr, png_ptr->row_buf + 1); in png_push_process_row()
897 png_read_push_finish_row(png_ptr); in png_push_process_row()
899 for (i = 0; i < 4 && png_ptr->pass == 2; i++) in png_push_process_row()
901 png_push_have_row(png_ptr, png_bytep_NULL); in png_push_process_row()
902 png_read_push_finish_row(png_ptr); in png_push_process_row()
904 if (png_ptr->pass == 4) /* pass 3 might be empty */ in png_push_process_row()
906 for (i = 0; i < 2 && png_ptr->pass == 4; i++) in png_push_process_row()
908 png_push_have_row(png_ptr, png_bytep_NULL); in png_push_process_row()
909 png_read_push_finish_row(png_ptr); in png_push_process_row()
917 for (i = 0; i < 4 && png_ptr->pass == 3; i++) in png_push_process_row()
919 png_push_have_row(png_ptr, png_ptr->row_buf + 1); in png_push_process_row()
920 png_read_push_finish_row(png_ptr); in png_push_process_row()
922 if (png_ptr->pass == 4) /* skip top two generated rows */ in png_push_process_row()
924 for (i = 0; i < 2 && png_ptr->pass == 4; i++) in png_push_process_row()
926 png_push_have_row(png_ptr, png_bytep_NULL); in png_push_process_row()
927 png_read_push_finish_row(png_ptr); in png_push_process_row()
935 for (i = 0; i < 2 && png_ptr->pass == 4; i++) in png_push_process_row()
937 png_push_have_row(png_ptr, png_ptr->row_buf + 1); in png_push_process_row()
938 png_read_push_finish_row(png_ptr); in png_push_process_row()
940 for (i = 0; i < 2 && png_ptr->pass == 4; i++) in png_push_process_row()
942 png_push_have_row(png_ptr, png_bytep_NULL); in png_push_process_row()
943 png_read_push_finish_row(png_ptr); in png_push_process_row()
945 if (png_ptr->pass == 6) /* pass 5 might be empty */ in png_push_process_row()
947 png_push_have_row(png_ptr, png_bytep_NULL); in png_push_process_row()
948 png_read_push_finish_row(png_ptr); in png_push_process_row()
955 for (i = 0; i < 2 && png_ptr->pass == 5; i++) in png_push_process_row()
957 png_push_have_row(png_ptr, png_ptr->row_buf + 1); in png_push_process_row()
958 png_read_push_finish_row(png_ptr); in png_push_process_row()
960 if (png_ptr->pass == 6) /* skip top generated row */ in png_push_process_row()
962 png_push_have_row(png_ptr, png_bytep_NULL); in png_push_process_row()
963 png_read_push_finish_row(png_ptr); in png_push_process_row()
969 png_push_have_row(png_ptr, png_ptr->row_buf + 1); in png_push_process_row()
970 png_read_push_finish_row(png_ptr); in png_push_process_row()
971 if (png_ptr->pass != 6) in png_push_process_row()
973 png_push_have_row(png_ptr, png_bytep_NULL); in png_push_process_row()
974 png_read_push_finish_row(png_ptr); in png_push_process_row()
981 png_push_have_row(png_ptr, png_ptr->row_buf + 1); in png_push_process_row()
982 png_read_push_finish_row(png_ptr); in png_push_process_row()
987 png_read_push_finish_row(png_structp png_ptr) in png_read_push_finish_row() argument
1015 png_ptr->row_number++; in png_read_push_finish_row()
1016 if (png_ptr->row_number < png_ptr->num_rows) in png_read_push_finish_row()
1019 if (png_ptr->interlaced) in png_read_push_finish_row()
1021 png_ptr->row_number = 0; in png_read_push_finish_row()
1022 png_memset_check(png_ptr, png_ptr->prev_row, 0, in png_read_push_finish_row()
1023 png_ptr->rowbytes + 1); in png_read_push_finish_row()
1026 png_ptr->pass++; in png_read_push_finish_row()
1027 if ((png_ptr->pass == 1 && png_ptr->width < 5) || in png_read_push_finish_row()
1028 (png_ptr->pass == 3 && png_ptr->width < 3) || in png_read_push_finish_row()
1029 (png_ptr->pass == 5 && png_ptr->width < 2)) in png_read_push_finish_row()
1030 png_ptr->pass++; in png_read_push_finish_row()
1032 if (png_ptr->pass > 7) in png_read_push_finish_row()
1033 png_ptr->pass--; in png_read_push_finish_row()
1034 if (png_ptr->pass >= 7) in png_read_push_finish_row()
1037 png_ptr->iwidth = (png_ptr->width + in png_read_push_finish_row()
1038 png_pass_inc[png_ptr->pass] - 1 - in png_read_push_finish_row()
1039 png_pass_start[png_ptr->pass]) / in png_read_push_finish_row()
1040 png_pass_inc[png_ptr->pass]; in png_read_push_finish_row()
1042 png_ptr->irowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, in png_read_push_finish_row()
1043 png_ptr->iwidth) + 1; in png_read_push_finish_row()
1045 if (png_ptr->transformations & PNG_INTERLACE) in png_read_push_finish_row()
1048 png_ptr->num_rows = (png_ptr->height + in png_read_push_finish_row()
1049 png_pass_yinc[png_ptr->pass] - 1 - in png_read_push_finish_row()
1050 png_pass_ystart[png_ptr->pass]) / in png_read_push_finish_row()
1051 png_pass_yinc[png_ptr->pass]; in png_read_push_finish_row()
1053 } while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0); in png_read_push_finish_row()
1059 png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 in png_push_handle_tEXt() argument
1062 if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) in png_push_handle_tEXt()
1064 png_error(png_ptr, "Out of place tEXt"); in png_push_handle_tEXt()
1069 png_ptr->skip_length = 0; /* This may not be necessary */ in png_push_handle_tEXt()
1073 png_warning(png_ptr, "tEXt chunk too large to fit in memory"); in png_push_handle_tEXt()
1074 png_ptr->skip_length = length - (png_uint_32)65535L; in png_push_handle_tEXt()
1079 png_ptr->current_text = (png_charp)png_malloc(png_ptr, in png_push_handle_tEXt()
1081 png_ptr->current_text[length] = '\0'; in png_push_handle_tEXt()
1082 png_ptr->current_text_ptr = png_ptr->current_text; in png_push_handle_tEXt()
1083 png_ptr->current_text_size = (png_size_t)length; in png_push_handle_tEXt()
1084 png_ptr->current_text_left = (png_size_t)length; in png_push_handle_tEXt()
1085 png_ptr->process_mode = PNG_READ_tEXt_MODE; in png_push_handle_tEXt()
1089 png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr) in png_push_read_tEXt() argument
1091 if (png_ptr->buffer_size && png_ptr->current_text_left) in png_push_read_tEXt()
1095 if (png_ptr->buffer_size < png_ptr->current_text_left) in png_push_read_tEXt()
1096 text_size = png_ptr->buffer_size; in png_push_read_tEXt()
1098 text_size = png_ptr->current_text_left; in png_push_read_tEXt()
1099 png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size); in png_push_read_tEXt()
1100 png_ptr->current_text_left -= text_size; in png_push_read_tEXt()
1101 png_ptr->current_text_ptr += text_size; in png_push_read_tEXt()
1103 if (!(png_ptr->current_text_left)) in png_push_read_tEXt()
1110 if (png_ptr->buffer_size < 4) in png_push_read_tEXt()
1112 png_push_save_buffer(png_ptr); in png_push_read_tEXt()
1116 png_push_crc_finish(png_ptr); in png_push_read_tEXt()
1119 if (png_ptr->skip_length) in png_push_read_tEXt()
1123 key = png_ptr->current_text; in png_push_read_tEXt()
1128 if (text != key + png_ptr->current_text_size) in png_push_read_tEXt()
1131 text_ptr = (png_textp)png_malloc(png_ptr, in png_push_read_tEXt()
1141 ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1); in png_push_read_tEXt()
1143 png_free(png_ptr, key); in png_push_read_tEXt()
1144 png_free(png_ptr, text_ptr); in png_push_read_tEXt()
1145 png_ptr->current_text = NULL; in png_push_read_tEXt()
1148 png_warning(png_ptr, "Insufficient memory to store text chunk."); in png_push_read_tEXt()
1155 png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 in png_push_handle_zTXt() argument
1158 if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) in png_push_handle_zTXt()
1160 png_error(png_ptr, "Out of place zTXt"); in png_push_handle_zTXt()
1171 png_warning(png_ptr, "zTXt chunk too large to fit in memory"); in png_push_handle_zTXt()
1172 png_push_crc_skip(png_ptr, length); in png_push_handle_zTXt()
1177 png_ptr->current_text = (png_charp)png_malloc(png_ptr, in png_push_handle_zTXt()
1179 png_ptr->current_text[length] = '\0'; in png_push_handle_zTXt()
1180 png_ptr->current_text_ptr = png_ptr->current_text; in png_push_handle_zTXt()
1181 png_ptr->current_text_size = (png_size_t)length; in png_push_handle_zTXt()
1182 png_ptr->current_text_left = (png_size_t)length; in png_push_handle_zTXt()
1183 png_ptr->process_mode = PNG_READ_zTXt_MODE; in png_push_handle_zTXt()
1187 png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr) in png_push_read_zTXt() argument
1189 if (png_ptr->buffer_size && png_ptr->current_text_left) in png_push_read_zTXt()
1193 if (png_ptr->buffer_size < (png_uint_32)png_ptr->current_text_left) in png_push_read_zTXt()
1194 text_size = png_ptr->buffer_size; in png_push_read_zTXt()
1196 text_size = png_ptr->current_text_left; in png_push_read_zTXt()
1197 png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size); in png_push_read_zTXt()
1198 png_ptr->current_text_left -= text_size; in png_push_read_zTXt()
1199 png_ptr->current_text_ptr += text_size; in png_push_read_zTXt()
1201 if (!(png_ptr->current_text_left)) in png_push_read_zTXt()
1209 if (png_ptr->buffer_size < 4) in png_push_read_zTXt()
1211 png_push_save_buffer(png_ptr); in png_push_read_zTXt()
1215 png_push_crc_finish(png_ptr); in png_push_read_zTXt()
1217 key = png_ptr->current_text; in png_push_read_zTXt()
1223 if (text == key + png_ptr->current_text_size) in png_push_read_zTXt()
1225 png_ptr->current_text = NULL; in png_push_read_zTXt()
1226 png_free(png_ptr, key); in png_push_read_zTXt()
1234 png_ptr->current_text = NULL; in png_push_read_zTXt()
1235 png_free(png_ptr, key); in png_push_read_zTXt()
1241 png_ptr->zstream.next_in = (png_bytep )text; in png_push_read_zTXt()
1242 png_ptr->zstream.avail_in = (uInt)(png_ptr->current_text_size - in png_push_read_zTXt()
1244 png_ptr->zstream.next_out = png_ptr->zbuf; in png_push_read_zTXt()
1245 png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; in png_push_read_zTXt()
1252 while (png_ptr->zstream.avail_in) in png_push_read_zTXt()
1254 ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH); in png_push_read_zTXt()
1257 inflateReset(&png_ptr->zstream); in png_push_read_zTXt()
1258 png_ptr->zstream.avail_in = 0; in png_push_read_zTXt()
1259 png_ptr->current_text = NULL; in png_push_read_zTXt()
1260 png_free(png_ptr, key); in png_push_read_zTXt()
1261 png_free(png_ptr, text); in png_push_read_zTXt()
1264 if (!(png_ptr->zstream.avail_out) || ret == Z_STREAM_END) in png_push_read_zTXt()
1268 text = (png_charp)png_malloc(png_ptr, in png_push_read_zTXt()
1269 (png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out in png_push_read_zTXt()
1271 png_memcpy(text + key_size, png_ptr->zbuf, in png_push_read_zTXt()
1272 png_ptr->zbuf_size - png_ptr->zstream.avail_out); in png_push_read_zTXt()
1274 text_size = key_size + png_ptr->zbuf_size - in png_push_read_zTXt()
1275 png_ptr->zstream.avail_out; in png_push_read_zTXt()
1283 text = (png_charp)png_malloc(png_ptr, text_size + in png_push_read_zTXt()
1284 (png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out in png_push_read_zTXt()
1287 png_free(png_ptr, tmp); in png_push_read_zTXt()
1288 png_memcpy(text + text_size, png_ptr->zbuf, in png_push_read_zTXt()
1289 png_ptr->zbuf_size - png_ptr->zstream.avail_out); in png_push_read_zTXt()
1290 text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out; in png_push_read_zTXt()
1295 png_ptr->zstream.next_out = png_ptr->zbuf; in png_push_read_zTXt()
1296 png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; in png_push_read_zTXt()
1308 inflateReset(&png_ptr->zstream); in png_push_read_zTXt()
1309 png_ptr->zstream.avail_in = 0; in png_push_read_zTXt()
1313 png_ptr->current_text = NULL; in png_push_read_zTXt()
1314 png_free(png_ptr, key); in png_push_read_zTXt()
1315 png_free(png_ptr, text); in png_push_read_zTXt()
1319 png_ptr->current_text = NULL; in png_push_read_zTXt()
1320 png_free(png_ptr, key); in png_push_read_zTXt()
1324 text_ptr = (png_textp)png_malloc(png_ptr, in png_push_read_zTXt()
1334 ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1); in png_push_read_zTXt()
1336 png_free(png_ptr, key); in png_push_read_zTXt()
1337 png_free(png_ptr, text_ptr); in png_push_read_zTXt()
1340 png_warning(png_ptr, "Insufficient memory to store text chunk."); in png_push_read_zTXt()
1347 png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 in png_push_handle_iTXt() argument
1350 if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) in png_push_handle_iTXt()
1352 png_error(png_ptr, "Out of place iTXt"); in png_push_handle_iTXt()
1357 png_ptr->skip_length = 0; /* This may not be necessary */ in png_push_handle_iTXt()
1361 png_warning(png_ptr, "iTXt chunk too large to fit in memory"); in png_push_handle_iTXt()
1362 png_ptr->skip_length = length - (png_uint_32)65535L; in png_push_handle_iTXt()
1367 png_ptr->current_text = (png_charp)png_malloc(png_ptr, in png_push_handle_iTXt()
1369 png_ptr->current_text[length] = '\0'; in png_push_handle_iTXt()
1370 png_ptr->current_text_ptr = png_ptr->current_text; in png_push_handle_iTXt()
1371 png_ptr->current_text_size = (png_size_t)length; in png_push_handle_iTXt()
1372 png_ptr->current_text_left = (png_size_t)length; in png_push_handle_iTXt()
1373 png_ptr->process_mode = PNG_READ_iTXt_MODE; in png_push_handle_iTXt()
1377 png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr) in png_push_read_iTXt() argument
1380 if (png_ptr->buffer_size && png_ptr->current_text_left) in png_push_read_iTXt()
1384 if (png_ptr->buffer_size < png_ptr->current_text_left) in png_push_read_iTXt()
1385 text_size = png_ptr->buffer_size; in png_push_read_iTXt()
1387 text_size = png_ptr->current_text_left; in png_push_read_iTXt()
1388 png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size); in png_push_read_iTXt()
1389 png_ptr->current_text_left -= text_size; in png_push_read_iTXt()
1390 png_ptr->current_text_ptr += text_size; in png_push_read_iTXt()
1392 if (!(png_ptr->current_text_left)) in png_push_read_iTXt()
1402 if (png_ptr->buffer_size < 4) in png_push_read_iTXt()
1404 png_push_save_buffer(png_ptr); in png_push_read_iTXt()
1408 png_push_crc_finish(png_ptr); in png_push_read_iTXt()
1411 if (png_ptr->skip_length) in png_push_read_iTXt()
1415 key = png_ptr->current_text; in png_push_read_iTXt()
1420 if (lang != key + png_ptr->current_text_size) in png_push_read_iTXt()
1433 if (text != key + png_ptr->current_text_size) in png_push_read_iTXt()
1436 text_ptr = (png_textp)png_malloc(png_ptr, in png_push_read_iTXt()
1446 ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1); in png_push_read_iTXt()
1448 png_ptr->current_text = NULL; in png_push_read_iTXt()
1450 png_free(png_ptr, text_ptr); in png_push_read_iTXt()
1452 png_warning(png_ptr, "Insufficient memory to store iTXt chunk."); in png_push_read_iTXt()
1462 png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 in png_push_handle_unknown() argument
1466 png_check_chunk_name(png_ptr, png_ptr->chunk_name); in png_push_handle_unknown()
1468 if (!(png_ptr->chunk_name[0] & 0x20)) in png_push_handle_unknown()
1471 if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != in png_push_handle_unknown()
1474 && png_ptr->read_user_chunk_fn == NULL in png_push_handle_unknown()
1478 png_chunk_error(png_ptr, "unknown critical chunk"); in png_push_handle_unknown()
1484 if (png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS) in png_push_handle_unknown()
1489 png_warning(png_ptr, "unknown chunk too large to fit in memory"); in png_push_handle_unknown()
1494 png_strncpy((png_charp)png_ptr->unknown_chunk.name, in png_push_handle_unknown()
1495 (png_charp)png_ptr->chunk_name, in png_push_handle_unknown()
1496 png_sizeof((png_charp)png_ptr->chunk_name)); in png_push_handle_unknown()
1497 png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length); in png_push_handle_unknown()
1498 png_ptr->unknown_chunk.size = (png_size_t)length; in png_push_handle_unknown()
1499 png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length); in png_push_handle_unknown()
1501 if(png_ptr->read_user_chunk_fn != NULL) in png_push_handle_unknown()
1505 ret = (*(png_ptr->read_user_chunk_fn)) in png_push_handle_unknown()
1506 (png_ptr, &png_ptr->unknown_chunk); in png_push_handle_unknown()
1508 png_chunk_error(png_ptr, "error in user chunk"); in png_push_handle_unknown()
1511 if (!(png_ptr->chunk_name[0] & 0x20)) in png_push_handle_unknown()
1512 if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != in png_push_handle_unknown()
1514 png_chunk_error(png_ptr, "unknown critical chunk"); in png_push_handle_unknown()
1515 png_set_unknown_chunks(png_ptr, info_ptr, in png_push_handle_unknown()
1516 &png_ptr->unknown_chunk, 1); in png_push_handle_unknown()
1520 png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); in png_push_handle_unknown()
1522 png_free(png_ptr, png_ptr->unknown_chunk.data); in png_push_handle_unknown()
1523 png_ptr->unknown_chunk.data = NULL; in png_push_handle_unknown()
1528 png_push_crc_skip(png_ptr, skip); in png_push_handle_unknown()
1532 png_push_have_info(png_structp png_ptr, png_infop info_ptr) in png_push_have_info() argument
1534 if (png_ptr->info_fn != NULL) in png_push_have_info()
1535 (*(png_ptr->info_fn))(png_ptr, info_ptr); in png_push_have_info()
1539 png_push_have_end(png_structp png_ptr, png_infop info_ptr) in png_push_have_end() argument
1541 if (png_ptr->end_fn != NULL) in png_push_have_end()
1542 (*(png_ptr->end_fn))(png_ptr, info_ptr); in png_push_have_end()
1546 png_push_have_row(png_structp png_ptr, png_bytep row) in png_push_have_row() argument
1548 if (png_ptr->row_fn != NULL) in png_push_have_row()
1549 (*(png_ptr->row_fn))(png_ptr, row, png_ptr->row_number, in png_push_have_row()
1550 (int)png_ptr->pass); in png_push_have_row()
1554 png_progressive_combine_row (png_structp png_ptr, in png_progressive_combine_row() argument
1561 if(png_ptr == NULL) return; in png_progressive_combine_row()
1563 png_combine_row(png_ptr, old_row, png_pass_dsp_mask[png_ptr->pass]); in png_progressive_combine_row()
1567 png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr, in png_set_progressive_read_fn() argument
1571 if(png_ptr == NULL) return; in png_set_progressive_read_fn()
1572 png_ptr->info_fn = info_fn; in png_set_progressive_read_fn()
1573 png_ptr->row_fn = row_fn; in png_set_progressive_read_fn()
1574 png_ptr->end_fn = end_fn; in png_set_progressive_read_fn()
1576 png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer); in png_set_progressive_read_fn()
1580 png_get_progressive_ptr(png_structp png_ptr) in png_get_progressive_ptr() argument
1582 if(png_ptr == NULL) return (NULL); in png_get_progressive_ptr()
1583 return png_ptr->io_ptr; in png_get_progressive_ptr()