[freeimage] 13/47: PluginPNG: use external headers

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Sat Sep 26 22:27:22 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository freeimage.

commit ee3641146386469c0c0e3a8a9831a7bac178fc4a
Author: Julien Cristau <jcristau at debian.org>
Date:   Fri Oct 8 13:51:47 2010 +0200

    PluginPNG: use external headers
    
    Only use iTXt if supported by libpng
---
 Source/FreeImage/PluginPNG.cpp | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/Source/FreeImage/PluginPNG.cpp b/Source/FreeImage/PluginPNG.cpp
index 989c6e6..129d4a0 100644
--- a/Source/FreeImage/PluginPNG.cpp
+++ b/Source/FreeImage/PluginPNG.cpp
@@ -37,7 +37,7 @@
 
 // ----------------------------------------------------------
 
-#include "../LibPNG/png.h"
+#include <png.h>
 
 // ----------------------------------------------------------
 
@@ -101,7 +101,10 @@ ReadMetadata(png_structp png_ptr, png_infop info_ptr, FIBITMAP *dib) {
 			tag = FreeImage_CreateTag();
 			if(!tag) return FALSE;
 
-			DWORD tag_length = MAX(text_ptr[i].text_length, text_ptr[i].itxt_length);
+			DWORD tag_length = text_ptr[i].text_length;
+#ifdef PNG_iTXt_SUPPORTED
+			tag_length = MAX(tag_length, text_ptr[i].itxt_length);
+#endif
 
 			FreeImage_SetTagLength(tag, tag_length);
 			FreeImage_SetTagCount(tag, tag_length);
@@ -144,13 +147,19 @@ WriteMetadata(png_structp png_ptr, png_infop info_ptr, FIBITMAP *dib) {
 	if(mdhandle) {
 		do {
 			memset(&text_metadata, 0, sizeof(png_text));
+#ifdef PNG_iTXt_SUPPORTED
 			text_metadata.compression = 1;							// iTXt, none
+#else
+			text_metadata.compression = -1;
+#endif
 			text_metadata.key = (char*)FreeImage_GetTagKey(tag);	// keyword, 1-79 character description of "text"
 			text_metadata.text = (char*)FreeImage_GetTagValue(tag);	// comment, may be an empty string (ie "")
 			text_metadata.text_length = FreeImage_GetTagLength(tag);// length of the text string
+#ifdef PNG_iTXt_SUPPORTED
 			text_metadata.itxt_length = FreeImage_GetTagLength(tag);// length of the itxt string
 			text_metadata.lang = 0;		 // language code, 0-79 characters or a NULL pointer
 			text_metadata.lang_key = 0;	 // keyword translated UTF-8 string, 0 or more chars or a NULL pointer
+#endif
 
 			// set the tag 
 			png_set_text(png_ptr, info_ptr, &text_metadata, 1);
@@ -166,13 +175,19 @@ WriteMetadata(png_structp png_ptr, png_infop info_ptr, FIBITMAP *dib) {
 	FreeImage_GetMetadata(FIMD_XMP, dib, g_TagLib_XMPFieldName, &tag);
 	if(tag && FreeImage_GetTagLength(tag)) {
 		memset(&text_metadata, 0, sizeof(png_text));
+#ifdef PNG_iTXt_SUPPORTED
 		text_metadata.compression = 1;							// iTXt, none
+#else
+		text_metadata.compression = -1;
+#endif
 		text_metadata.key = g_png_xmp_keyword;					// keyword, 1-79 character description of "text"
 		text_metadata.text = (char*)FreeImage_GetTagValue(tag);	// comment, may be an empty string (ie "")
 		text_metadata.text_length = FreeImage_GetTagLength(tag);// length of the text string
+#ifdef PNG_iTXt_SUPPORTED
 		text_metadata.itxt_length = FreeImage_GetTagLength(tag);// length of the itxt string
 		text_metadata.lang = 0;		 // language code, 0-79 characters or a NULL pointer
 		text_metadata.lang_key = 0;	 // keyword translated UTF-8 string, 0 or more chars or a NULL pointer
+#endif
 
 		// set the tag 
 		png_set_text(png_ptr, info_ptr, &text_metadata, 1);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/freeimage.git



More information about the debian-science-commits mailing list