diff options
author | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2013-02-13 22:49:19 -0600 |
---|---|---|
committer | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2013-02-13 23:32:06 -0600 |
commit | 0da9cf38cd55178e6dabacf720fa21741bc50cd5 (patch) | |
tree | 690a2b6d2832b10018a14ffe1907589c27c3ae52 /pngtest.c | |
parent | d14caad2e9c46d02403e9db167a1daa8b59954b6 (diff) | |
download | libpng-0da9cf38cd55178e6dabacf720fa21741bc50cd5.tar.gz |
[master] Imported from libpng-1.6.0.tar
Diffstat (limited to 'pngtest.c')
-rw-r--r-- | pngtest.c | 41 |
1 files changed, 21 insertions, 20 deletions
@@ -1,7 +1,7 @@ /* pngtest.c - a simple test program to test libpng * - * Last changed in libpng 1.5.14 [January 24, 2013] + * Last changed in libpng 1.6.0 [February 14, 2013] * Copyright (c) 1998-2013 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -766,7 +766,7 @@ write_chunks(png_structp write_ptr, int location) */ #ifdef PNG_TEXT_SUPPORTED static void -pngtest_check_text_support(png_structp png_ptr, png_textp text_ptr, +pngtest_check_text_support(png_const_structp png_ptr, png_textp text_ptr, int num_text) { while (num_text > 0) @@ -1235,15 +1235,15 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) { png_set_tIME(write_ptr, write_info_ptr, mod_time); #ifdef PNG_TIME_RFC1123_SUPPORTED - /* We have to use memcpy instead of "=" because the string - * pointed to by png_convert_to_rfc1123() gets free'ed before - * we use it. - */ - memcpy(tIME_string, - png_convert_to_rfc1123(read_ptr, mod_time), - png_sizeof(tIME_string)); - - tIME_string[png_sizeof(tIME_string) - 1] = '\0'; + if (png_convert_to_rfc1123_buffer(tIME_string, mod_time)) + tIME_string[(sizeof tIME_string) - 1] = '\0'; + + else + { + strncpy(tIME_string, "*** invalid time ***", (sizeof tIME_string)); + tIME_string[(sizeof tIME_string) - 1] = '\0'; + } + tIME_chunk_present++; #endif /* PNG_TIME_RFC1123_SUPPORTED */ } @@ -1419,14 +1419,15 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) { png_set_tIME(write_ptr, write_end_info_ptr, mod_time); #ifdef PNG_TIME_RFC1123_SUPPORTED - /* We have to use memcpy instead of "=" because the string - pointed to by png_convert_to_rfc1123() gets free'ed before - we use it */ - memcpy(tIME_string, - png_convert_to_rfc1123(read_ptr, mod_time), - png_sizeof(tIME_string)); - - tIME_string[png_sizeof(tIME_string) - 1] = '\0'; + if (png_convert_to_rfc1123_buffer(tIME_string, mod_time)) + tIME_string[(sizeof tIME_string) - 1] = '\0'; + + else + { + strncpy(tIME_string, "*** invalid time ***", sizeof tIME_string); + tIME_string[(sizeof tIME_string)-1] = '\0'; + } + tIME_chunk_present++; #endif /* PNG_TIME_RFC1123_SUPPORTED */ } @@ -1948,4 +1949,4 @@ main(void) #endif /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_5_14 Your_png_h_is_not_version_1_5_14; +typedef png_libpng_version_1_6_0 Your_png_h_is_not_version_1_6_0; |