3
3
#include <string.h>
4
4
#include <stdlib.h>
5
5
#include "gd.h"
6
+ #include "gd_errors.h"
6
7
#include "gdhelpers.h"
7
8
8
9
#ifdef HAVE_LIBWEBP
@@ -56,7 +57,7 @@ gdImagePtr gdImageCreateFromWebpCtx (gdIOCtx * infile)
56
57
if (filedata ) {
57
58
gdFree (filedata );
58
59
}
59
- zend_error ( E_ERROR , "WebP decode: realloc failed" );
60
+ gd_error ( "WebP decode: realloc failed" );
60
61
return NULL ;
61
62
}
62
63
@@ -67,7 +68,7 @@ gdImagePtr gdImageCreateFromWebpCtx (gdIOCtx * infile)
67
68
} while (n > 0 && n != EOF );
68
69
69
70
if (WebPGetInfo (filedata ,size , & width , & height ) == 0 ) {
70
- zend_error ( E_ERROR , "gd-webp cannot get webp info" );
71
+ gd_error ( "gd-webp cannot get webp info" );
71
72
gdFree (filedata );
72
73
return NULL ;
73
74
}
@@ -79,7 +80,7 @@ gdImagePtr gdImageCreateFromWebpCtx (gdIOCtx * infile)
79
80
}
80
81
argb = WebPDecodeARGB (filedata , size , & width , & height );
81
82
if (!argb ) {
82
- zend_error ( E_ERROR , "gd-webp cannot allocate temporary buffer" );
83
+ gd_error ( "gd-webp cannot allocate temporary buffer" );
83
84
gdFree (filedata );
84
85
gdImageDestroy (im );
85
86
return NULL ;
@@ -113,7 +114,7 @@ void gdImageWebpCtx (gdImagePtr im, gdIOCtx * outfile, int quality)
113
114
}
114
115
115
116
if (!gdImageTrueColor (im )) {
116
- zend_error ( E_ERROR , "Palette image not supported by webp" );
117
+ gd_error ( "Palette image not supported by webp" );
117
118
return ;
118
119
}
119
120
@@ -159,7 +160,7 @@ void gdImageWebpCtx (gdImagePtr im, gdIOCtx * outfile, int quality)
159
160
}
160
161
161
162
if (out_size == 0 ) {
162
- zend_error ( E_ERROR , "gd-webp encoding failed" );
163
+ gd_error ( "gd-webp encoding failed" );
163
164
goto freeargb ;
164
165
}
165
166
gdPutBuf (out , out_size , outfile );
0 commit comments