@@ -140,16 +140,16 @@ static void php_image_filter_pixelate(INTERNAL_FUNCTION_PARAMETERS);
140
140
static void php_image_filter_scatter (INTERNAL_FUNCTION_PARAMETERS );
141
141
142
142
/* End Section filters declarations */
143
- static gdImagePtr _php_image_create_from_string (zend_string * Data , char * tn , gdImagePtr (* ioctx_func_p )());
144
- static void _php_image_create_from (INTERNAL_FUNCTION_PARAMETERS , int image_type , char * tn , gdImagePtr (* func_p )(), gdImagePtr (* ioctx_func_p )());
145
- static void _php_image_output (INTERNAL_FUNCTION_PARAMETERS , int image_type , char * tn , void ( * func_p )() );
143
+ static gdImagePtr _php_image_create_from_string (zend_string * Data , char * tn , gdImagePtr (* ioctx_func_p )(gdIOCtxPtr ));
144
+ static void _php_image_create_from (INTERNAL_FUNCTION_PARAMETERS , int image_type , char * tn , gdImagePtr (* func_p )(FILE * ), gdImagePtr (* ioctx_func_p )(gdIOCtxPtr ));
145
+ static void _php_image_output (INTERNAL_FUNCTION_PARAMETERS , int image_type , char * tn );
146
146
static gdIOCtx * create_stream_context_from_zval (zval * to_zval );
147
147
static gdIOCtx * create_stream_context (php_stream * stream , int close_stream );
148
148
static gdIOCtx * create_output_context (void );
149
149
static int _php_image_type (zend_string * data );
150
150
151
151
/* output streaming (formerly gd_ctx.c) */
152
- static void _php_image_output_ctx (INTERNAL_FUNCTION_PARAMETERS , int image_type , char * tn , void ( * func_p )() );
152
+ static void _php_image_output_ctx (INTERNAL_FUNCTION_PARAMETERS , int image_type , char * tn );
153
153
154
154
/*********************************************************
155
155
*
@@ -291,7 +291,7 @@ static zend_function *php_gd_font_object_get_constructor(zend_object *object)
291
291
return NULL ;
292
292
}
293
293
294
- static void php_gd_font_minit_helper ()
294
+ static void php_gd_font_minit_helper (void )
295
295
{
296
296
gd_font_ce = register_class_GdFont ();
297
297
gd_font_ce -> create_object = php_gd_font_object_create ;
@@ -1524,7 +1524,7 @@ static int _php_image_type(zend_string *data)
1524
1524
/* }}} */
1525
1525
1526
1526
/* {{{ _php_image_create_from_string */
1527
- gdImagePtr _php_image_create_from_string (zend_string * data , char * tn , gdImagePtr (* ioctx_func_p )())
1527
+ gdImagePtr _php_image_create_from_string (zend_string * data , char * tn , gdImagePtr (* ioctx_func_p )(gdIOCtxPtr ))
1528
1528
{
1529
1529
gdImagePtr im ;
1530
1530
gdIOCtx * io_ctx ;
@@ -1629,7 +1629,7 @@ PHP_FUNCTION(imagecreatefromstring)
1629
1629
/* }}} */
1630
1630
1631
1631
/* {{{ _php_image_create_from */
1632
- static void _php_image_create_from (INTERNAL_FUNCTION_PARAMETERS , int image_type , char * tn , gdImagePtr (* func_p )(), gdImagePtr (* ioctx_func_p )())
1632
+ static void _php_image_create_from (INTERNAL_FUNCTION_PARAMETERS , int image_type , char * tn , gdImagePtr (* func_p )(FILE * ), gdImagePtr (* ioctx_func_p )(gdIOCtxPtr ))
1633
1633
{
1634
1634
char * file ;
1635
1635
size_t file_len ;
@@ -1673,7 +1673,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
1673
1673
if (FAILURE == php_stream_cast (stream , PHP_STREAM_AS_STDIO , (void * * )& fp , REPORT_ERRORS )) {
1674
1674
goto out_err ;
1675
1675
}
1676
- } else if (ioctx_func_p ) {
1676
+ } else if (ioctx_func_p || image_type == PHP_GDIMG_TYPE_GD2PART ) {
1677
1677
/* we can create an io context */
1678
1678
gdIOCtx * io_ctx ;
1679
1679
zend_string * buff ;
@@ -1697,7 +1697,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
1697
1697
}
1698
1698
1699
1699
if (image_type == PHP_GDIMG_TYPE_GD2PART ) {
1700
- im = ( * ioctx_func_p ) (io_ctx , srcx , srcy , width , height );
1700
+ im = gdImageCreateFromGd2PartCtx (io_ctx , srcx , srcy , width , height );
1701
1701
} else {
1702
1702
im = (* ioctx_func_p )(io_ctx );
1703
1703
}
@@ -1715,7 +1715,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
1715
1715
if (!im && fp ) {
1716
1716
switch (image_type ) {
1717
1717
case PHP_GDIMG_TYPE_GD2PART :
1718
- im = ( * func_p ) (fp , srcx , srcy , width , height );
1718
+ im = gdImageCreateFromGd2Part (fp , srcx , srcy , width , height );
1719
1719
break ;
1720
1720
#ifdef HAVE_GD_XPM
1721
1721
case PHP_GDIMG_TYPE_XPM :
@@ -1807,7 +1807,7 @@ PHP_FUNCTION(imagecreatefromavif)
1807
1807
/* {{{ Create a new image from XPM file or URL */
1808
1808
PHP_FUNCTION (imagecreatefromxpm )
1809
1809
{
1810
- _php_image_create_from (INTERNAL_FUNCTION_PARAM_PASSTHRU , PHP_GDIMG_TYPE_XPM , "XPM" , gdImageCreateFromXpm , NULL );
1810
+ _php_image_create_from (INTERNAL_FUNCTION_PARAM_PASSTHRU , PHP_GDIMG_TYPE_XPM , "XPM" , NULL , NULL );
1811
1811
}
1812
1812
/* }}} */
1813
1813
#endif
@@ -1836,7 +1836,7 @@ PHP_FUNCTION(imagecreatefromgd2)
1836
1836
/* {{{ Create a new image from a given part of GD2 file or URL */
1837
1837
PHP_FUNCTION (imagecreatefromgd2part )
1838
1838
{
1839
- _php_image_create_from (INTERNAL_FUNCTION_PARAM_PASSTHRU , PHP_GDIMG_TYPE_GD2PART , "GD2" , gdImageCreateFromGd2Part , gdImageCreateFromGd2PartCtx );
1839
+ _php_image_create_from (INTERNAL_FUNCTION_PARAM_PASSTHRU , PHP_GDIMG_TYPE_GD2PART , "GD2" , NULL , NULL );
1840
1840
}
1841
1841
/* }}} */
1842
1842
@@ -1859,7 +1859,7 @@ PHP_FUNCTION(imagecreatefromtga)
1859
1859
#endif
1860
1860
1861
1861
/* {{{ _php_image_output */
1862
- static void _php_image_output (INTERNAL_FUNCTION_PARAMETERS , int image_type , char * tn , void ( * func_p )() )
1862
+ static void _php_image_output (INTERNAL_FUNCTION_PARAMETERS , int image_type , char * tn )
1863
1863
{
1864
1864
zval * imgind ;
1865
1865
char * file = NULL ;
@@ -1906,13 +1906,13 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
1906
1906
1907
1907
switch (image_type ) {
1908
1908
case PHP_GDIMG_TYPE_GD :
1909
- ( * func_p ) (im , fp );
1909
+ gdImageGd (im , fp );
1910
1910
break ;
1911
1911
case PHP_GDIMG_TYPE_GD2 :
1912
1912
if (q == -1 ) {
1913
1913
q = 128 ;
1914
1914
}
1915
- ( * func_p ) (im , fp , q , t );
1915
+ gdImageGd2 (im , fp , q , t );
1916
1916
break ;
1917
1917
EMPTY_SWITCH_DEFAULT_CASE ()
1918
1918
}
@@ -1932,13 +1932,13 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
1932
1932
1933
1933
switch (image_type ) {
1934
1934
case PHP_GDIMG_TYPE_GD :
1935
- ( * func_p ) (im , tmp );
1935
+ gdImageGd (im , tmp );
1936
1936
break ;
1937
1937
case PHP_GDIMG_TYPE_GD2 :
1938
1938
if (q == -1 ) {
1939
1939
q = 128 ;
1940
1940
}
1941
- ( * func_p ) (im , tmp , q , t );
1941
+ gdImageGd2 (im , tmp , q , t );
1942
1942
break ;
1943
1943
EMPTY_SWITCH_DEFAULT_CASE ()
1944
1944
}
@@ -2008,15 +2008,15 @@ PHP_FUNCTION(imagexbm)
2008
2008
/* {{{ Output GIF image to browser or file */
2009
2009
PHP_FUNCTION (imagegif )
2010
2010
{
2011
- _php_image_output_ctx (INTERNAL_FUNCTION_PARAM_PASSTHRU , PHP_GDIMG_TYPE_GIF , "GIF" , gdImageGifCtx );
2011
+ _php_image_output_ctx (INTERNAL_FUNCTION_PARAM_PASSTHRU , PHP_GDIMG_TYPE_GIF , "GIF" );
2012
2012
}
2013
2013
/* }}} */
2014
2014
2015
2015
#ifdef HAVE_GD_PNG
2016
2016
/* {{{ Output PNG image to browser or file */
2017
2017
PHP_FUNCTION (imagepng )
2018
2018
{
2019
- _php_image_output_ctx (INTERNAL_FUNCTION_PARAM_PASSTHRU , PHP_GDIMG_TYPE_PNG , "PNG" , gdImagePngCtxEx );
2019
+ _php_image_output_ctx (INTERNAL_FUNCTION_PARAM_PASSTHRU , PHP_GDIMG_TYPE_PNG , "PNG" );
2020
2020
}
2021
2021
/* }}} */
2022
2022
#endif /* HAVE_GD_PNG */
@@ -2025,7 +2025,7 @@ PHP_FUNCTION(imagepng)
2025
2025
/* {{{ Output WEBP image to browser or file */
2026
2026
PHP_FUNCTION (imagewebp )
2027
2027
{
2028
- _php_image_output_ctx (INTERNAL_FUNCTION_PARAM_PASSTHRU , PHP_GDIMG_TYPE_WEBP , "WEBP" , gdImageWebpCtx );
2028
+ _php_image_output_ctx (INTERNAL_FUNCTION_PARAM_PASSTHRU , PHP_GDIMG_TYPE_WEBP , "WEBP" );
2029
2029
}
2030
2030
/* }}} */
2031
2031
#endif /* HAVE_GD_WEBP */
@@ -2034,7 +2034,7 @@ PHP_FUNCTION(imagewebp)
2034
2034
/* {{{ Output AVIF image to browser or file */
2035
2035
PHP_FUNCTION (imageavif )
2036
2036
{
2037
- _php_image_output_ctx (INTERNAL_FUNCTION_PARAM_PASSTHRU , PHP_GDIMG_TYPE_AVIF , "AVIF" , gdImageAvifCtx );
2037
+ _php_image_output_ctx (INTERNAL_FUNCTION_PARAM_PASSTHRU , PHP_GDIMG_TYPE_AVIF , "AVIF" );
2038
2038
}
2039
2039
/* }}} */
2040
2040
#endif /* HAVE_GD_AVIF */
@@ -2043,7 +2043,7 @@ PHP_FUNCTION(imageavif)
2043
2043
/* {{{ Output JPEG image to browser or file */
2044
2044
PHP_FUNCTION (imagejpeg )
2045
2045
{
2046
- _php_image_output_ctx (INTERNAL_FUNCTION_PARAM_PASSTHRU , PHP_GDIMG_TYPE_JPG , "JPEG" , gdImageJpegCtx );
2046
+ _php_image_output_ctx (INTERNAL_FUNCTION_PARAM_PASSTHRU , PHP_GDIMG_TYPE_JPG , "JPEG" );
2047
2047
}
2048
2048
/* }}} */
2049
2049
#endif /* HAVE_GD_JPG */
@@ -2095,14 +2095,14 @@ PHP_FUNCTION(imagewbmp)
2095
2095
/* {{{ Output GD image to browser or file */
2096
2096
PHP_FUNCTION (imagegd )
2097
2097
{
2098
- _php_image_output (INTERNAL_FUNCTION_PARAM_PASSTHRU , PHP_GDIMG_TYPE_GD , "GD" , gdImageGd );
2098
+ _php_image_output (INTERNAL_FUNCTION_PARAM_PASSTHRU , PHP_GDIMG_TYPE_GD , "GD" );
2099
2099
}
2100
2100
/* }}} */
2101
2101
2102
2102
/* {{{ Output GD2 image to browser or file */
2103
2103
PHP_FUNCTION (imagegd2 )
2104
2104
{
2105
- _php_image_output (INTERNAL_FUNCTION_PARAM_PASSTHRU , PHP_GDIMG_TYPE_GD2 , "GD2" , gdImageGd2 );
2105
+ _php_image_output (INTERNAL_FUNCTION_PARAM_PASSTHRU , PHP_GDIMG_TYPE_GD2 , "GD2" );
2106
2106
}
2107
2107
/* }}} */
2108
2108
@@ -4220,7 +4220,7 @@ static gdIOCtx *create_output_context() {
4220
4220
return ctx ;
4221
4221
}
4222
4222
4223
- static void _php_image_output_ctx (INTERNAL_FUNCTION_PARAMETERS , int image_type , char * tn , void ( * func_p )() )
4223
+ static void _php_image_output_ctx (INTERNAL_FUNCTION_PARAMETERS , int image_type , char * tn )
4224
4224
{
4225
4225
zval * imgind ;
4226
4226
zend_long quality = -1 , basefilter = -1 , speed = -1 ;
@@ -4259,19 +4259,19 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
4259
4259
4260
4260
switch (image_type ) {
4261
4261
case PHP_GDIMG_TYPE_JPG :
4262
- ( * func_p ) (im , ctx , (int ) quality );
4262
+ gdImageJpegCtx (im , ctx , (int ) quality );
4263
4263
break ;
4264
4264
case PHP_GDIMG_TYPE_WEBP :
4265
4265
if (quality == -1 ) {
4266
4266
quality = 80 ;
4267
4267
}
4268
- ( * func_p ) (im , ctx , (int ) quality );
4268
+ gdImageWebpCtx (im , ctx , (int ) quality );
4269
4269
break ;
4270
4270
case PHP_GDIMG_TYPE_AVIF :
4271
4271
if (speed == -1 ) {
4272
4272
speed = 6 ;
4273
4273
}
4274
- ( * func_p ) (im , ctx , (int ) quality , (int ) speed );
4274
+ gdImageAvifCtx (im , ctx , (int ) quality , (int ) speed );
4275
4275
break ;
4276
4276
#ifdef HAVE_GD_PNG
4277
4277
case PHP_GDIMG_TYPE_PNG :
@@ -4283,7 +4283,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
4283
4283
break ;
4284
4284
#endif
4285
4285
case PHP_GDIMG_TYPE_GIF :
4286
- ( * func_p ) (im , ctx );
4286
+ gdImageGifCtx (im , ctx );
4287
4287
break ;
4288
4288
EMPTY_SWITCH_DEFAULT_CASE ()
4289
4289
}
0 commit comments