Lines Matching +full:- +full:- +full:show +full:- +full:xfail

2 /* pngtest.c - a test program for libpng
4 * Copyright (c) 2018-2024 Cosmin Truta
5 * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
6 * Copyright (c) 1996-1997 Andreas Dilger
7 * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
22 * 3) unknown unsafe-to-copy ancillary chunks or unknown critical chunks
28 * If a filename is given on the command-line, then this file is used
31 * of files at once by typing "pngtest -m file1.png file2.png ..."
49 * still keeping it in libpng-1.6.x for compatibility reasons.
78 * fail simply as a result of re-ordering them. This may be fixed in the next
151 static int xfail = 0; variable
179 status_dots--; in read_row_callback()
248 * png_byte channels number of channels (1-4) in count_zero_samples()
254 if (row_info->color_type == 0 || row_info->color_type == 3) in count_zero_samples()
259 for (n = 0, nstop = row_info->width; n < nstop; n++) in count_zero_samples()
261 if (row_info->bit_depth == 1) in count_zero_samples()
273 if (row_info->bit_depth == 2) in count_zero_samples()
285 if (row_info->bit_depth == 4) in count_zero_samples()
297 if (row_info->bit_depth == 8) in count_zero_samples()
301 if (row_info->bit_depth == 16) in count_zero_samples()
313 int color_channels = row_info->channels; in count_zero_samples()
314 if (row_info->color_type > 3) in count_zero_samples()
315 color_channels--; in count_zero_samples()
317 for (n = 0, nstop = row_info->width; n < nstop; n++) in count_zero_samples()
321 if (row_info->bit_depth == 8) in count_zero_samples()
325 if (row_info->bit_depth == 16) in count_zero_samples()
333 if (row_info->color_type > 3) in count_zero_samples()
336 if (row_info->bit_depth == 16) in count_zero_samples()
345 /* START of code to validate stdio-free compilation */
471 if (test != NULL && test->file_name != NULL) in pngtest_warning()
472 name = test->file_name; in pngtest_warning()
493 /* END of code to validate stdio-free compilation */
544 pinfo->size = size; in png_debug_malloc()
552 pinfo->pointer = png_malloc(png_ptr, size); in png_debug_malloc()
558 if (size != 0 && pinfo->pointer == NULL) in png_debug_malloc()
560 current_allocation -= size; in png_debug_malloc()
561 total_allocation -= size; in png_debug_malloc()
563 "out of memory in pngtest->png_debug_malloc"); in png_debug_malloc()
566 pinfo->next = pinformation; in png_debug_malloc()
569 memset(pinfo->pointer, 0xdd, pinfo->size); in png_debug_malloc()
573 pinfo->pointer); in png_debug_malloc()
575 return (png_voidp)pinfo->pointer; in png_debug_malloc()
603 if (pinfo->pointer == ptr) in png_debug_free()
605 *ppinfo = pinfo->next; in png_debug_free()
606 current_allocation -= pinfo->size; in png_debug_free()
611 memset(ptr, 0x55, pinfo->size); in png_debug_free()
617 if (pinfo->next == NULL) in png_debug_free()
623 ppinfo = &pinfo->next; in png_debug_free()
665 chunk_data->info_ptr = info_ptr; in init_user_chunk_info()
673 if ((chunk_data->location[0] & what) != 0 || in set_chunk_location()
674 (chunk_data->location[1] & what) != 0) in set_chunk_location()
680 if (chunk_data->info_ptr == NULL) /* after IDAT */ in set_chunk_location()
683 else if (png_get_valid(png_ptr, chunk_data->info_ptr, PNG_INFO_PLTE) != 0) in set_chunk_location()
689 if (chunk_data->location[0] == 0) in set_chunk_location()
690 chunk_data->location[0] = location; in set_chunk_location()
693 chunk_data->location[1] = location; in set_chunk_location()
708 * return -n; chunk had an error in read_user_chunk_callback()
720 if (chunk->name[0] == 115 && chunk->name[1] == 84 && /* s T */ in read_user_chunk_callback()
721 chunk->name[2] == 69 && chunk->name[3] == 82) /* E R */ in read_user_chunk_callback()
724 if (chunk->size != 1) in read_user_chunk_callback()
725 return -1; /* Error return */ in read_user_chunk_callback()
727 if (chunk->data[0] != 0 && chunk->data[0] != 1) in read_user_chunk_callback()
728 return -1; /* Invalid mode */ in read_user_chunk_callback()
732 my_user_chunk_data->sTER_mode = chunk->data[0]; in read_user_chunk_callback()
737 return 0; /* duplicate sTER - give it to libpng */ in read_user_chunk_callback()
740 if (chunk->name[0] != 118 || chunk->name[1] != 112 || /* v p */ in read_user_chunk_callback()
741 chunk->name[2] != 65 || chunk->name[3] != 103) /* A g */ in read_user_chunk_callback()
746 if (chunk->size != 9) in read_user_chunk_callback()
747 return -1; /* Error return */ in read_user_chunk_callback()
752 my_user_chunk_data->vpAg_width = png_get_uint_31(png_ptr, chunk->data); in read_user_chunk_callback()
753 my_user_chunk_data->vpAg_height = png_get_uint_31(png_ptr, chunk->data + 4); in read_user_chunk_callback()
754 my_user_chunk_data->vpAg_units = chunk->data[8]; in read_user_chunk_callback()
766 fprintf(STDERR, "\n stereo mode = %d\n", data->sTER_mode); in write_sTER_chunk()
768 png_write_chunk(write_ptr, sTER, &data->sTER_mode, 1); in write_sTER_chunk()
780 (unsigned long)data->vpAg_width, in write_vpAg_chunk()
781 (unsigned long)data->vpAg_height, in write_vpAg_chunk()
782 data->vpAg_units); in write_vpAg_chunk()
784 png_save_uint_32(vpag_chunk_data, data->vpAg_width); in write_vpAg_chunk()
785 png_save_uint_32(vpag_chunk_data + 4, data->vpAg_height); in write_vpAg_chunk()
786 vpag_chunk_data[8] = data->vpAg_units; in write_vpAg_chunk()
799 * about - the chunks should not be duplicated! in write_chunks()
803 if (data->location[i] == (location | have_sTER)) in write_chunks()
806 else if (data->location[i] == (location | have_vpAg)) in write_chunks()
827 switch (text_ptr[--num_text].compression) in pngtest_check_text_support()
835 /* In libpng 1.7 this now does an app-error, so stop it: */ in pngtest_check_text_support()
944 fprintf(STDERR, "%s -> %s: libpng read error\n", inname, outname); in test_one_file()
966 fprintf(STDERR, "%s -> %s: libpng write error\n", inname, outname); in test_one_file()
996 * changed with '--relaxed'. in test_one_file()
1348 tIME_string[(sizeof tIME_string) - 1] = '\0'; in test_one_file()
1353 tIME_string[(sizeof tIME_string) - 1] = '\0'; in test_one_file()
1371 /* libpng doesn't reject a tRNS chunk with out-of-range samples */ in test_one_file()
1373 (int)trans_color->gray > sample_max) || in test_one_file()
1375 ((int)trans_color->red > sample_max || in test_one_file()
1376 (int)trans_color->green > sample_max || in test_one_file()
1377 (int)trans_color->blue > sample_max)))) in test_one_file()
1439 t_misc += (t_stop - t_start); in test_one_file()
1478 t_decode += (t_stop - t_start); in test_one_file()
1484 t_encode += (t_stop - t_start); in test_one_file()
1497 png_free_data(read_ptr, read_info_ptr, PNG_FREE_UNKN, -1); in test_one_file()
1500 png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1); in test_one_file()
1559 tIME_string[(sizeof tIME_string) - 1] = '\0'; in test_one_file()
1564 tIME_string[(sizeof tIME_string)-1] = '\0'; in test_one_file()
1650 inname, unsupported_chunks, strict ? ": IGNORED --strict!" : ""); in test_one_file()
1785 /* Show the version of libpng used in building the library */ in main()
1790 /* Show the version of libpng used in building the application */ in main()
1817 if (strcmp(argv[1], "-m") == 0) in main()
1823 else if (strcmp(argv[1], "-mv") == 0 || in main()
1824 strcmp(argv[1], "-vm") == 0 ) in main()
1831 else if (strcmp(argv[1], "-v") == 0) in main()
1838 else if (strcmp(argv[1], "--strict") == 0) in main()
1848 else if (strcmp(argv[1], "--relaxed") == 0) in main()
1857 else if (strcmp(argv[1], "--xfail") == 0) in main()
1863 xfail++; in main()
1882 "usage: %s [infile.png] [outfile.png]\n\t%s -m {infile.png}\n", in main()
1885 " reads/writes one PNG file (without -m) or multiple files (-m)\n"); in main()
1887 " with -m %s is used as a temporary file\n", outname); in main()
1923 if (xfail) in main()
1924 fprintf(STDERR, " XFAIL\n"); in main()
1934 current_allocation - allocation_now); in main()
1946 (unsigned long)pinfo->size, in main()
1947 pinfo->pointer); in main()
1948 pinfo = pinfo->next; in main()
2017 if (xfail) in main()
2018 fprintf(STDERR, " XFAIL\n"); in main()
2028 current_allocation - allocation_now); in main()
2040 (unsigned long)pinfo->size, pinfo->pointer); in main()
2041 pinfo = pinfo->next; in main()
2060 t_misc += (t_stop - t_start); in main()