summaryrefslogtreecommitdiffstats
path: root/php-5.5.0-wip.patch
blob: c1e9ff2cca2d9159ae2c6dd8b138ebbd3c7afa57 (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
From dd0399f5c6d2acfe53621f9e5daf61c57e8e66c6 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@php.net>
Date: Wed, 24 Apr 2013 16:07:50 +0200
Subject: [PATCH] We need both gdImageCreateFromJpeg* and
 gdImageCreateFromJpeg*Ex

The new (Ex) functions are used with the new ignore_warning parameter

The standard functions are used in _php_image_create_from_string,
sent as a function pointer, and call without this optional parameter.
---
 ext/gd/gd.c            |  4 ++--
 ext/gd/libgd/gd.h      |  6 ++++--
 ext/gd/libgd/gd_jpeg.c | 25 ++++++++++++++++++++-----
 3 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 1888973..b9ed1cd 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -2670,7 +2670,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
 			case PHP_GDIMG_TYPE_JPG:
 				ignore_warning = INI_INT("gd.jpeg_ignore_warning");
 #ifdef HAVE_GD_BUNDLED
-				im = gdImageCreateFromJpeg(fp, ignore_warning);
+				im = gdImageCreateFromJpegEx(fp, ignore_warning);
 #else
 				im = gdImageCreateFromJpeg(fp);
 #endif
@@ -4783,7 +4783,7 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type )
 		case PHP_GDIMG_TYPE_JPG:
 			ignore_warning = INI_INT("gd.jpeg_ignore_warning");
 #ifdef HAVE_GD_BUNDLED
-			im_org = gdImageCreateFromJpeg(org, ignore_warning);
+			im_org = gdImageCreateFromJpegEx(org, ignore_warning);
 #else
 			im_org = gdImageCreateFromJpeg(org);
 #endif
diff --git a/ext/gd/libgd/gd.h b/ext/gd/libgd/gd.h
index 0bd8ad3..e640b96 100644
--- a/ext/gd/libgd/gd.h
+++ b/ext/gd/libgd/gd.h
@@ -362,8 +362,10 @@ gdImagePtr gdImageCreateFromPng(FILE *fd);
 gdImagePtr gdImageCreateFromPngCtx(gdIOCtxPtr in);
 gdImagePtr gdImageCreateFromWBMP(FILE *inFile);
 gdImagePtr gdImageCreateFromWBMPCtx(gdIOCtx *infile);
-gdImagePtr gdImageCreateFromJpeg(FILE *infile, int ignore_warning);
-gdImagePtr gdImageCreateFromJpegCtx(gdIOCtx *infile, int ignore_warning);
+gdImagePtr gdImageCreateFromJpeg(FILE *infile);
+gdImagePtr gdImageCreateFromJpegEx(FILE *infile, int ignore_warning);
+gdImagePtr gdImageCreateFromJpegCtx(gdIOCtx *infile);
+gdImagePtr gdImageCreateFromJpegCtxEx(gdIOCtx *infile, int ignore_warning);
 gdImagePtr gdImageCreateFromWebp(FILE *fd);
 gdImagePtr gdImageCreateFromWebpCtx(gdIOCtxPtr in);
 gdImagePtr gdImageCreateFromWebpPtr (int size, void *data);
diff --git a/ext/gd/libgd/gd_jpeg.c b/ext/gd/libgd/gd_jpeg.c
index 175c5b8..a882b28 100644
--- a/ext/gd/libgd/gd_jpeg.c
+++ b/ext/gd/libgd/gd_jpeg.c
@@ -269,21 +269,31 @@ void gdImageJpegCtx (gdImagePtr im, gdIOCtx * outfile, int quality)
 	gdFree (row);
 }
 
-gdImagePtr gdImageCreateFromJpeg (FILE * inFile, int ignore_warning)
+gdImagePtr gdImageCreateFromJpeg (FILE * inFile)
+{
+	return gdImageCreateFromJpegEx(inFile, 1);
+}
+
+gdImagePtr gdImageCreateFromJpegEx (FILE * inFile, int ignore_warning)
 {
 	gdImagePtr im;
 	gdIOCtx *in = gdNewFileCtx(inFile);
-	im = gdImageCreateFromJpegCtx(in, ignore_warning);
+	im = gdImageCreateFromJpegCtxEx(in, ignore_warning);
 	in->gd_free (in);
 
 	return im;
 }
 
-gdImagePtr gdImageCreateFromJpegPtr (int size, void *data, int ignore_warning)
+gdImagePtr gdImageCreateFromJpegPtr (int size, void *data)
+{
+	return gdImageCreateFromJpegPtrEx(size, data, 1);
+}
+
+gdImagePtr gdImageCreateFromJpegPtrEx (int size, void *data, int ignore_warning)
 {
 	gdImagePtr im;
 	gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
-	im = gdImageCreateFromJpegCtx(in, ignore_warning);
+	im = gdImageCreateFromJpegCtxEx(in, ignore_warning);
 	in->gd_free(in);
 
 	return im;
@@ -298,7 +308,12 @@ static int CMYKToRGB(int c, int m, int y, int k, int inverted);
  * Create a gd-format image from the JPEG-format INFILE.  Returns the
  * image, or NULL upon error.
  */
-gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile, int ignore_warning)
+gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
+{
+	return gdImageCreateFromJpegCtxEx(infile, 1);
+}
+
+gdImagePtr gdImageCreateFromJpegCtxEx (gdIOCtx * infile, int ignore_warning)
 {
 	struct jpeg_decompress_struct cinfo;
 	struct jpeg_error_mgr jerr;
-- 
1.7.11.5

diff --git a/ext/gd/libgd/gd.h b/ext/gd/libgd/gd.h
index e640b96..7251510 100644
--- a/ext/gd/libgd/gd.h
+++ b/ext/gd/libgd/gd.h
@@ -366,6 +366,8 @@ gdImagePtr gdImageCreateFromJpeg(FILE *infile);
 gdImagePtr gdImageCreateFromJpegEx(FILE *infile, int ignore_warning);
 gdImagePtr gdImageCreateFromJpegCtx(gdIOCtx *infile);
 gdImagePtr gdImageCreateFromJpegCtxEx(gdIOCtx *infile, int ignore_warning);
+gdImagePtr gdImageCreateFromJpegPtr (int size, void *data);
+gdImagePtr gdImageCreateFromJpegPtrEx (int size, void *data, int ignore_warning);
 gdImagePtr gdImageCreateFromWebp(FILE *fd);
 gdImagePtr gdImageCreateFromWebpCtx(gdIOCtxPtr in);
 gdImagePtr gdImageCreateFromWebpPtr (int size, void *data);