mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng16] Restored png_get_eXIf_1() and png_set_eXIf_1() because strlen(eXIf_buf)
does not work (the eXIf chunk data can contain zeroes).
This commit is contained in:
18
pngtest.c
18
pngtest.c
@@ -1201,16 +1201,15 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#ifdef PNG_READ_eXIf_SUPPORTED
|
||||
{
|
||||
png_bytep exif=NULL;
|
||||
size_t exif_length;
|
||||
png_uint_32 exif_length;
|
||||
|
||||
if (png_get_eXIf(read_ptr, read_info_ptr, &exif) != 0)
|
||||
if (png_get_eXIf_1(read_ptr, read_info_ptr, &exif_length, &exif) != 0)
|
||||
{
|
||||
exif_length=strlen((const char *)exif);
|
||||
if (exif_length > 1)
|
||||
printf(" eXIf type %c%c, %lu bytes\n",exif[0],exif[1],
|
||||
exif_length);
|
||||
(unsigned long)exif_length);
|
||||
# ifdef PNG_WRITE_eXIf_SUPPORTED
|
||||
png_set_eXIf(write_ptr, write_info_ptr, exif);
|
||||
png_set_eXIf_1(write_ptr, write_info_ptr, exif_length, exif);
|
||||
# endif
|
||||
}
|
||||
}
|
||||
@@ -1562,14 +1561,13 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
png_bytep exif=NULL;
|
||||
png_uint_32 exif_length;
|
||||
|
||||
if (png_get_eXIf(read_ptr, end_info_ptr, &exif) != 0)
|
||||
if (png_get_eXIf_1(read_ptr, end_info_ptr, &exif_length, &exif) != 0)
|
||||
{
|
||||
exif_length=(png_uint_32)strlen((const char *)exif);
|
||||
if (exif_length > 1)
|
||||
printf(" eXIf type %c%c, %d bytes\n",exif[0],exif[1],
|
||||
(int)exif_length);
|
||||
printf(" eXIf type %c%c, %lu bytes\n",exif[0],exif[1],
|
||||
(unsigned long)exif_length);
|
||||
# ifdef PNG_WRITE_eXIf_SUPPORTED
|
||||
png_set_eXIf(write_ptr, write_end_info_ptr, exif);
|
||||
png_set_eXIf_1(write_ptr, write_end_info_ptr, exif_length, exif);
|
||||
# endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user