mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Imported from libpng-1.2.23beta02.tar
This commit is contained in:
26
pngtest.c
26
pngtest.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngtest.c - a simple test program to test libpng
|
||||
*
|
||||
* Last changed in libpng 1.2.22 - [October 15, 2007]
|
||||
* Last changed in libpng 1.2.22 - [October 16, 2007]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2004 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@@ -82,9 +82,9 @@ static float t_start, t_stop, t_decode, t_encode, t_misc;
|
||||
#endif
|
||||
|
||||
#if defined(PNG_TIME_RFC1123_SUPPORTED)
|
||||
#define PNG_tIME_STRING_LENGTH 29
|
||||
#define PNG_tIME_STRING_LENGTH 30
|
||||
static int tIME_chunk_present=0;
|
||||
static char tIME_string[30] = "no tIME chunk present in file";
|
||||
static char tIME_string[PNG_tIME_STRING_LENGTH] = "no tIME chunk present in file";
|
||||
#endif
|
||||
|
||||
static int verbose = 0;
|
||||
@@ -1003,12 +1003,13 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
{
|
||||
png_set_tIME(write_ptr, write_info_ptr, mod_time);
|
||||
#if defined(PNG_TIME_RFC1123_SUPPORTED)
|
||||
/* we have to use png_strncpy instead of "=" because the string
|
||||
/* we have to use png_memcpy instead of "=" because the string
|
||||
pointed to by png_convert_to_rfc1123() gets free'ed before
|
||||
we use it */
|
||||
png_strncpy(tIME_string,png_convert_to_rfc1123(read_ptr,
|
||||
mod_time), PNG_tIME_STRING_LENGTH);
|
||||
tIME_string[PNG_tIME_STRING_LENGTH] = '\0';
|
||||
png_memcpy(tIME_string,
|
||||
png_convert_to_rfc1123(read_ptr, mod_time),
|
||||
png_sizeof(tIME_string));
|
||||
tIME_string[png_sizeof(tIME_string)-1] = '\0';
|
||||
tIME_chunk_present++;
|
||||
#endif /* PNG_TIME_RFC1123_SUPPORTED */
|
||||
}
|
||||
@@ -1145,12 +1146,13 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
{
|
||||
png_set_tIME(write_ptr, write_end_info_ptr, mod_time);
|
||||
#if defined(PNG_TIME_RFC1123_SUPPORTED)
|
||||
/* we have to use png_strncpy instead of "=" because the string
|
||||
/* we have to use png_memcpy instead of "=" because the string
|
||||
pointed to by png_convert_to_rfc1123() gets free'ed before
|
||||
we use it */
|
||||
png_strncpy(tIME_string,png_convert_to_rfc1123(read_ptr,
|
||||
mod_time),PNG_tIME_STRING_LENGTH);
|
||||
tIME_string[PNG_tIME_STRING_LENGTH] = '\0';
|
||||
png_memcpy(tIME_string,
|
||||
png_convert_to_rfc1123(read_ptr, mod_time),
|
||||
png_sizeof(tIME_string));
|
||||
tIME_string[png_sizeof(tIME_string)-1] = '\0';
|
||||
tIME_chunk_present++;
|
||||
#endif /* PNG_TIME_RFC1123_SUPPORTED */
|
||||
}
|
||||
@@ -1551,4 +1553,4 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef version_1_2_23beta01 your_png_h_is_not_version_1_2_23beta01;
|
||||
typedef version_1_2_23beta02 your_png_h_is_not_version_1_2_23beta02;
|
||||
|
||||
Reference in New Issue
Block a user