9
9
#include <math.h>
10
10
11
11
#include "gd.h"
12
+ #include "gd_errors.h"
12
13
#include "gdhelpers.h"
13
14
#include "gd_intern.h"
14
15
@@ -141,7 +142,7 @@ static avifBool isAvifSrgbImage(avifImage *avifIm) {
141
142
*/
142
143
static avifBool isAvifError (avifResult result , const char * msg ) {
143
144
if (result != AVIF_RESULT_OK ) {
144
- zend_error ( E_ERROR , "avif error - %s: %s" , msg , avifResultToString (result ));
145
+ gd_error ( "avif error - %s: %s" , msg , avifResultToString (result ));
145
146
return AVIF_TRUE ;
146
147
}
147
148
@@ -178,7 +179,7 @@ static avifResult readFromCtx(avifIO *io, uint32_t readFlags, uint64_t offset, s
178
179
179
180
dataBuf = avifAlloc (size );
180
181
if (!dataBuf ) {
181
- zend_error ( E_ERROR , "avif error - couldn't allocate memory" );
182
+ gd_error ( "avif error - couldn't allocate memory" );
182
183
return AVIF_RESULT_UNKNOWN_ERROR ;
183
184
}
184
185
@@ -343,7 +344,7 @@ gdImagePtr gdImageCreateFromAvifCtx (gdIOCtx *ctx)
343
344
344
345
io = createAvifIOFromCtx (ctx );
345
346
if (!io ) {
346
- zend_error ( E_ERROR , "avif error - Could not allocate memory" );
347
+ gd_error ( "avif error - Could not allocate memory" );
347
348
goto cleanup ;
348
349
}
349
350
@@ -359,7 +360,7 @@ gdImagePtr gdImageCreateFromAvifCtx (gdIOCtx *ctx)
359
360
goto cleanup ;
360
361
361
362
if (!isAvifSrgbImage (decoder -> image ))
362
- zend_error ( E_WARNING , "Image's color profile is not sRGB" );
363
+ gd_error_ex ( GD_NOTICE , "Image's color profile is not sRGB" );
363
364
364
365
// Set up the avifRGBImage, and convert it from YUV to an 8-bit RGB image.
365
366
// (While AVIF image pixel depth can be 8, 10, or 12 bits, GD truecolor images are 8-bit.)
@@ -373,7 +374,7 @@ gdImagePtr gdImageCreateFromAvifCtx (gdIOCtx *ctx)
373
374
374
375
im = gdImageCreateTrueColor (decoder -> image -> width , decoder -> image -> height );
375
376
if (!im ) {
376
- zend_error ( E_ERROR , "avif error - Could not create GD truecolor image" );
377
+ gd_error ( "avif error - Could not create GD truecolor image" );
377
378
goto cleanup ;
378
379
}
379
380
@@ -470,17 +471,17 @@ void gdImageAvifCtx(gdImagePtr im, gdIOCtx *outfile, int quality, int speed)
470
471
return ;
471
472
472
473
if (!gdImageTrueColor (im )) {
473
- zend_error ( E_ERROR , " avif doesn't support palette images" );
474
+ gd_error ( "avif error - avif doesn't support palette images" );
474
475
return ;
475
476
}
476
477
477
478
if (!gdImageSX (im ) || !gdImageSY (im )) {
478
- zend_error ( E_ERROR , " image dimensions must not be zero" );
479
+ gd_error ( "avif error - image dimensions must not be zero" );
479
480
return ;
480
481
}
481
482
482
483
if (overflow2 (gdImageSX (im ), gdImageSY (im ))) {
483
- zend_error ( E_ERROR , " image dimensions are too large" );
484
+ gd_error ( "avif error - image dimensions are too large" );
484
485
return ;
485
486
}
486
487
0 commit comments