• Home
  • Raw
  • Download

Lines Matching refs:dp

589 display_init(struct display *dp)  in display_init()  argument
595 memset(dp, 0, sizeof *dp); in display_init()
596 dp->options = WARNINGS; /* default to !verbose, !quiet */ in display_init()
597 dp->filename = NULL; in display_init()
598 dp->operation = NULL; in display_init()
599 dp->original_pp = NULL; in display_init()
600 dp->original_ip = NULL; in display_init()
601 dp->original_rows = NULL; in display_init()
602 dp->read_pp = NULL; in display_init()
603 dp->read_ip = NULL; in display_init()
604 buffer_init(&dp->original_file); in display_init()
607 dp->write_pp = NULL; in display_init()
608 buffer_init(&dp->written_file); in display_init()
613 display_clean_read(struct display *dp) in display_clean_read() argument
615 if (dp->read_pp != NULL) in display_clean_read()
616 png_destroy_read_struct(&dp->read_pp, &dp->read_ip, NULL); in display_clean_read()
621 display_clean_write(struct display *dp) in display_clean_write() argument
623 if (dp->write_pp != NULL) in display_clean_write()
624 png_destroy_write_struct(&dp->write_pp, NULL); in display_clean_write()
629 display_clean(struct display *dp) in display_clean() argument
632 display_clean_write(dp); in display_clean()
634 display_clean_read(dp); in display_clean()
636 dp->original_rowbytes = 0; in display_clean()
637 dp->original_rows = NULL; in display_clean()
638 dp->chunks = 0; in display_clean()
640 png_destroy_read_struct(&dp->original_pp, &dp->original_ip, NULL); in display_clean()
642 dp->results = 0; /* reset for next time */ in display_clean()
646 display_destroy(struct display *dp) in display_destroy() argument
650 buffer_destroy(&dp->written_file); in display_destroy()
653 buffer_destroy(&dp->original_file); in display_destroy()
660 struct display *dp = (struct display*)png_get_error_ptr(pp); in get_dp() local
662 if (dp == NULL) in get_dp()
668 return dp; in get_dp()
681 display_log(struct display *dp, error_level level, const char *fmt, ...) in display_log() argument
686 dp->results |= 1U << level; in display_log()
688 if (level > (error_level)(dp->options & LEVEL_MASK)) in display_log()
710 dp->filename != NULL ? dp->filename : "<stdin>", lp, dp->operation); in display_log()
712 if (dp->transforms != 0) in display_log()
714 int tr = dp->transforms; in display_log()
718 if (dp->options & LIST_COMBOS) in display_log()
762 if (level > APP_FAIL || (level > ERRORS && !(dp->options & CONTINUE))) in display_log()
763 longjmp(dp->error_return, level); in display_log()
776 struct display *dp = get_dp(pp); in display_error() local
778 display_log(dp, LIBPNG_ERROR, "%s", error); in display_error()
782 display_cache_file(struct display *dp, const char *filename) in display_cache_file() argument
788 dp->filename = filename; in display_cache_file()
794 display_log(dp, USER_ERROR, "open failed: %s", strerror(errno)); in display_cache_file()
800 ret = buffer_from_file(&dp->original_file, fp); in display_cache_file()
805 display_log(dp, APP_ERROR, "read failed: %s", strerror(ret)); in display_cache_file()
809 buffer_read(struct display *dp, struct buffer *bp, png_bytep data, in buffer_read() argument
822 display_log(dp, USER_ERROR, "file truncated (%lu bytes)", in buffer_read()
838 display_log(dp, INTERNAL_ERROR, "damaged buffer list"); in buffer_read()
864 read_png(struct display *dp, struct buffer *bp, const char *operation, in read_png() argument
873 display_clean_read(dp); in read_png()
877 dp->operation = operation; in read_png()
878 dp->transforms = transforms; in read_png()
881 dp->read_pp = pp = png_create_read_struct(PNG_LIBPNG_VER_STRING, dp, in read_png()
884 display_log(dp, LIBPNG_ERROR, "failed to create read struct"); in read_png()
889 dp->read_ip = ip = png_create_info_struct(pp); in read_png()
891 display_log(dp, LIBPNG_ERROR, "failed to create info struct"); in read_png()
922 update_display(struct display *dp) in update_display() argument
931 read_png(dp, &dp->original_file, "original read", 0/*no transform*/); in update_display()
934 dp->original_pp = pp = dp->read_pp, dp->read_pp = NULL; in update_display()
935 dp->original_ip = ip = dp->read_ip, dp->read_ip = NULL; in update_display()
937 dp->original_rowbytes = png_get_rowbytes(pp, ip); in update_display()
938 if (dp->original_rowbytes == 0) in update_display()
939 display_log(dp, LIBPNG_BUG, "png_get_rowbytes returned 0"); in update_display()
941 dp->chunks = png_get_valid(pp, ip, 0xffffffff); in update_display()
942 if ((dp->chunks & PNG_INFO_IDAT) == 0) /* set by png_read_png */ in update_display()
943 display_log(dp, LIBPNG_BUG, "png_read_png did not set IDAT flag"); in update_display()
945 dp->original_rows = png_get_rows(pp, ip); in update_display()
946 if (dp->original_rows == NULL) in update_display()
947 display_log(dp, LIBPNG_BUG, "png_read_png did not create row buffers"); in update_display()
950 &dp->width, &dp->height, &dp->bit_depth, &dp->color_type, in update_display()
951 &dp->interlace_method, &dp->compression_method, &dp->filter_method)) in update_display()
952 display_log(dp, LIBPNG_BUG, "png_get_IHDR failed"); in update_display()
959 png_uint_32 chunks = dp->chunks; in update_display()
961 int ct = dp->color_type; in update_display()
962 int bd = dp->bit_depth; in update_display()
988 dp->active_transforms = active; in update_display()
989 dp->ignored_transforms = inactive; /* excluding write-only transforms */ in update_display()
994 compare_read(struct display *dp, int applied_transforms) in compare_read() argument
1003 png_get_IHDR(dp->read_pp, dp->read_ip, &width, &height, &bit_depth, in compare_read()
1006 # define C(item) if (item != dp->item) \ in compare_read()
1007 display_log(dp, APP_WARNING, "IHDR " #item "(%lu) changed to %lu",\ in compare_read()
1008 (unsigned long)dp->item, (unsigned long)item), e = #item in compare_read()
1021 display_log(dp, APP_ERROR, "IHDR changed (%s)", e); in compare_read()
1028 png_get_valid(dp->read_pp, dp->read_ip, 0xffffffff); in compare_read()
1030 if (chunks != dp->chunks) in compare_read()
1031 display_log(dp, APP_FAIL, "PNG chunks changed from 0x%lx to 0x%lx", in compare_read()
1032 (unsigned long)dp->chunks, chunks); in compare_read()
1036 rowbytes = png_get_rowbytes(dp->read_pp, dp->read_ip); in compare_read()
1041 if (rowbytes != dp->original_rowbytes) in compare_read()
1042 display_log(dp, APP_ERROR, "PNG rowbytes changed from %lu to %lu", in compare_read()
1043 (unsigned long)dp->original_rowbytes, (unsigned long)rowbytes); in compare_read()
1049 png_bytepp rows = png_get_rows(dp->read_pp, dp->read_ip); in compare_read()
1065 display_log(dp, LIBPNG_BUG, "png_get_rows returned NULL"); in compare_read()
1068 (dp->active_transforms & PNG_TRANSFORM_SHIFT) == 0 || in compare_read()
1076 png_bytep orig = dp->original_rows[y]; in compare_read()
1087 display_log(dp, APP_FAIL, in compare_read()
1104 if (png_get_sBIT(dp->read_pp, dp->read_ip, &sBIT) != PNG_INFO_sBIT) in compare_read()
1105 display_log(dp, INTERNAL_ERROR, in compare_read()
1137 display_log(dp, LIBPNG_ERROR, "invalid colour type %d", in compare_read()
1154 display_log(dp, LIBPNG_BUG, in compare_read()
1165 display_log(dp, INTERNAL_ERROR, "invalid bpp %u for bit_depth %u", in compare_read()
1209 display_log(dp, LIBPNG_BUG, "invalid bit depth %d", bit_depth); in compare_read()
1224 display_log(dp, INTERNAL_ERROR, "mask calculation error %u, %u", in compare_read()
1231 png_bytep orig = dp->original_rows[y]; in compare_read()
1242 display_log(dp, APP_FAIL, in compare_read()
1252 display_log(dp, APP_FAIL, in compare_read()
1259 display_log(dp, INTERNAL_ERROR, in compare_read()
1269 buffer_write(struct display *dp, struct buffer *buffer, png_bytep data, in buffer_write() argument
1290 display_log(dp, APP_ERROR, "out of memory saving file"); in buffer_write()
1320 write_png(struct display *dp, png_infop ip, int transforms) in write_png() argument
1322 display_clean_write(dp); /* safety */ in write_png()
1324 buffer_start_write(&dp->written_file); in write_png()
1325 dp->operation = "write"; in write_png()
1326 dp->transforms = transforms; in write_png()
1328 dp->write_pp = png_create_write_struct(PNG_LIBPNG_VER_STRING, dp, in write_png()
1331 if (dp->write_pp == NULL) in write_png()
1332 display_log(dp, APP_ERROR, "failed to create write png_struct"); in write_png()
1334 png_set_write_fn(dp->write_pp, &dp->written_file, write_function, in write_png()
1339 png_set_user_limits(dp->write_pp, 0x7fffffff, 0x7fffffff); in write_png()
1349 int ct = dp->color_type; in write_png()
1355 png_set_IHDR(dp->write_pp, ip, dp->width, dp->height, dp->bit_depth, ct, in write_png()
1356 dp->interlace_method, dp->compression_method, dp->filter_method); in write_png()
1359 png_write_png(dp->write_pp, ip, transforms, NULL/*params*/); in write_png()
1364 display_clean_write(dp); in write_png()
1369 skip_transform(struct display *dp, int tr) in skip_transform() argument
1372 if ((dp->options & SKIP_BUGS) != 0 && is_bad_combo(tr)) in skip_transform()
1377 if ((dp->options & LOG_SKIPPED) != 0) in skip_transform()
1379 printf("SKIP: %s transforms ", dp->filename); in skip_transform()
1395 display_log(dp, INFORMATION, "%s: skipped known bad combo 0x%x", in skip_transform()
1396 dp->filename, tr); in skip_transform()
1405 test_one_file(struct display *dp, const char *filename) in test_one_file() argument
1410 dp->operation = "cache file"; in test_one_file()
1411 dp->transforms = 0; in test_one_file()
1412 display_cache_file(dp, filename); in test_one_file()
1413 update_display(dp); in test_one_file()
1418 if (dp->ignored_transforms != 0) in test_one_file()
1420 read_png(dp, &dp->original_file, "ignored transforms", in test_one_file()
1421 dp->ignored_transforms); in test_one_file()
1424 if (!compare_read(dp, 0/*transforms applied*/)) in test_one_file()
1433 dp->operation = "write"; in test_one_file()
1434 write_png(dp, dp->original_ip, 0/*transforms*/); in test_one_file()
1435 read_png(dp, &dp->written_file, NULL, 0/*transforms*/); in test_one_file()
1436 if (!compare_read(dp, 0/*transforms applied*/)) in test_one_file()
1448 unsigned int active = dp->active_transforms; in test_one_file()
1449 const int exhaustive = (dp->options & EXHAUSTIVE) != 0; in test_one_file()
1457 read_png(dp, &dp->original_file, "active transforms", current); in test_one_file()
1477 dp->operation = "reversible transforms"; in test_one_file()
1478 write_png(dp, dp->read_ip, current); in test_one_file()
1483 read_png(dp, &dp->written_file, NULL, 0); in test_one_file()
1484 if (!compare_read(dp, current/*for the SHIFT/sBIT transform*/)) in test_one_file()
1520 || skip_transform(dp, next)); in test_one_file()
1538 if (dp->options & FIND_BAD_COMBOS) in test_one_file()
1546 dp->filename, active, bad_combo, bad_combo_list, in test_one_file()
1550 printf("%s: no %sbad combos found\n", dp->filename, in test_one_file()
1551 (dp->options & SKIP_BUGS) ? "additional " : ""); in test_one_file()
1557 do_test(struct display *dp, const char *file) in do_test() argument
1560 int ret = setjmp(dp->error_return); in do_test()
1564 test_one_file(dp, file); in do_test()
1569 display_log(dp, INTERNAL_ERROR, "unexpected return code %d", ret); in do_test()