summaryrefslogtreecommitdiff
path: root/pngset.c
diff options
context:
space:
mode:
authorGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2017-07-13 11:19:53 -0500
committerGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2017-07-13 11:22:48 -0500
commit68cb0aaee3de6371b81a4613476d9b33e43e95b1 (patch)
tree86f4b7f941d11a18922dbc5321abd77ad14f4e98 /pngset.c
parent40943eb67aaf423bfd76dc9ce1e6ad98ba00a72e (diff)
[libpng16] Implement eXIf chunk support
Diffstat (limited to 'pngset.c')
-rw-r--r--pngset.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/pngset.c b/pngset.c
index 2bb575d38..998473557 100644
--- a/pngset.c
+++ b/pngset.c
@@ -134,6 +134,39 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X,
#endif /* cHRM */
+#ifdef PNG_eXIf_SUPPORTED
+void PNGAPI
+png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
+ const png_bytep eXIf_buf)
+{
+ int i;
+
+ png_debug1(1, "in %s storage function", "eXIf");
+
+ if (png_ptr == NULL || info_ptr == NULL)
+ return;
+
+ png_free_data(png_ptr, info_ptr, PNG_FREE_EXIF, 0);
+
+ info_ptr->exif = png_voidcast(png_bytep, png_malloc_warn(png_ptr,
+ info_ptr->num_exif));
+
+ if (info_ptr->exif == NULL)
+ {
+ png_warning(png_ptr, "Insufficient memory for eXIf chunk data");
+
+ return;
+ }
+
+ info_ptr->free_me |= PNG_FREE_EXIF;
+
+ for (i = 0; i < info_ptr->num_exif; i++)
+ info_ptr->exif[i] = eXIf_buf[i];
+
+ info_ptr->valid |= PNG_INFO_eXIf;
+}
+#endif /* eXIf */
+
#ifdef PNG_gAMA_SUPPORTED
void PNGFAPI
png_set_gAMA_fixed(png_const_structrp png_ptr, png_inforp info_ptr,