[Bf-blender-cvs] [5a19d9d] master: ImBuf: Fix compilation error with older libpng

Sergey Sharybin noreply at git.blender.org
Sat Jul 11 19:21:57 CEST 2015


Commit: 5a19d9d8f352dd8491f8800ddc2e1c52337a25ca
Author: Sergey Sharybin
Date:   Sat Jul 11 19:18:20 2015 +0200
Branches: master
https://developer.blender.org/rB5a19d9d8f352dd8491f8800ddc2e1c52337a25ca

ImBuf: Fix compilation error with older libpng

Older libpng library does not use const pointer to a memory.

The exact version is a bit of a guess here, maybe needs tweaks to it tho.

===================================================================

M	source/blender/imbuf/intern/png.c

===================================================================

diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c
index b96424d..77a0f1d 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -71,7 +71,14 @@ int imb_is_a_png(const unsigned char *mem)
 {
 	int ret_val = 0;
 
-	if (mem) ret_val = !png_sig_cmp(mem, 0, 8);
+	if (mem) {
+#if (PNG_LIBPNG_VER_MAJOR == 1) && (PNG_LIBPNG_VER_MINOR == 2)
+		/* Older version of libpng doesn't use const pointer to memory. */
+		ret_val = !png_sig_cmp((png_bytep)mem, 0, 8);
+#else
+		ret_val = !png_sig_cmp(mem, 0, 8);
+#endif
+	}
 	return(ret_val);
 }




More information about the Bf-blender-cvs mailing list