summaryrefslogtreecommitdiff
path: root/community-testing/glpng/libpng15.patch
blob: 89e9bf67ead0a0fd43141419f90259a8df3b5f51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
diff -aur libglpng-1.45.orig/include/GL/glpng.h libglpng-1.45.new/include/GL/glpng.h
--- libglpng-1.45.orig/include/GL/glpng.h	2000-07-10 21:27:00.000000000 +0200
+++ libglpng-1.45.new/include/GL/glpng.h	2012-01-19 19:34:43.994280259 +0100
@@ -57,7 +57,7 @@
 #define PNG_SIMPLEMIPMAP PNG_SIMPLEMIPMAPS
 
 /* Transparency parameters */
-#define PNG_CALLBACK  -3 /* Call the callback function to generate alpha   */
+#define PNG_CALLBACKT  -3 /* Call the callback function to generate alpha   */
 #define PNG_ALPHA     -2 /* Use alpha channel in PNG file, if there is one */
 #define PNG_SOLID     -1 /* No transparency                                */
 #define PNG_STENCIL    0 /* Sets alpha to 0 for r=g=b=0, 1 otherwise       */
diff -aur libglpng-1.45.orig/src/glpng.c libglpng-1.45.new/src/glpng.c
--- libglpng-1.45.orig/src/glpng.c	2000-07-10 21:27:10.000000000 +0200
+++ libglpng-1.45.new/src/glpng.c	2012-01-19 19:39:37.379311651 +0100
@@ -29,7 +29,7 @@
 #include <GL/gl.h>
 #include <stdlib.h>
 #include <math.h>
-#include "png/png.h"
+#include <png.h>
 
 /* Used to decide if GL/gl.h supports the paletted extension */
 #ifdef GL_COLOR_INDEX1_EXT
@@ -113,6 +113,7 @@
 	}
 }
 
+#ifdef _WIN32
 static int ExtSupported(const char *x) {
 	static const GLubyte *ext = NULL;
 	const char *c;
@@ -129,6 +130,7 @@
 
 	return 0;
 }
+#endif
 
 #define GET(o) ((int)*(data + (o)))
 
@@ -269,14 +271,14 @@
 	if (pinfo == NULL) return 0;
 
 	fread(header, 1, 8, fp);
-	if (!png_check_sig(header, 8)) return 0;
+	if (!png_sig_cmp(header, 0, 8)) return 0;
 
 	png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
 	info = png_create_info_struct(png);
 	endinfo = png_create_info_struct(png);
 
 	// DH: added following lines
-	if (setjmp(png->jmpbuf))
+	if (setjmp(png_jmpbuf(png)))
 	{
 		png_destroy_read_struct(&png, &info, &endinfo);
 		return 0;
@@ -373,14 +375,14 @@
 	png_uint_32 i;
 
 	fread(header, 1, 8, fp);
-	if (!png_check_sig(header, 8)) return 0;
+	if (png_sig_cmp(header, 0, 8)) return 0;
 
 	png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
 	info = png_create_info_struct(png);
 	endinfo = png_create_info_struct(png);
 
 	// DH: added following lines
-	if (setjmp(png->jmpbuf))
+	if (setjmp(png_jmpbuf(png)))
 	{
 		png_destroy_read_struct(&png, &info, &endinfo);
 		return 0;
@@ -559,7 +561,7 @@
 			#define ALPHA *q
 
 			switch (trans) {
-				case PNG_CALLBACK:
+				case PNG_CALLBACKT:
 					FORSTART
 						ALPHA = AlphaCallback((unsigned char) r, (unsigned char) g, (unsigned char) b);
 					FOREND