@@ -118,9 +118,9 @@ static void php_image_filter_pixelate(INTERNAL_FUNCTION_PARAMETERS);
118
118
static void php_image_filter_scatter (INTERNAL_FUNCTION_PARAMETERS );
119
119
120
120
/* End Section filters declarations */
121
- static gdImagePtr _php_image_create_from_string (zend_string * Data , char * tn , gdImagePtr (* ioctx_func_p )(gdIOCtxPtr ));
122
- static void _php_image_create_from (INTERNAL_FUNCTION_PARAMETERS , int image_type , char * tn , gdImagePtr (* func_p )(FILE * ), gdImagePtr (* ioctx_func_p )(gdIOCtxPtr ));
123
- static void _php_image_output (INTERNAL_FUNCTION_PARAMETERS , int image_type , char * tn );
121
+ static gdImagePtr _php_image_create_from_string (zend_string * Data , const char * tn , gdImagePtr (* ioctx_func_p )(gdIOCtxPtr ));
122
+ static void _php_image_create_from (INTERNAL_FUNCTION_PARAMETERS , int image_type , const char * tn , gdImagePtr (* func_p )(FILE * ), gdImagePtr (* ioctx_func_p )(gdIOCtxPtr ));
123
+ static void _php_image_output (INTERNAL_FUNCTION_PARAMETERS , int image_type , const char * tn );
124
124
static gdIOCtx * create_stream_context (php_stream * stream , int close_stream );
125
125
static gdIOCtx * create_output_context (zval * to_zval , uint32_t arg_num );
126
126
static int _php_image_type (zend_string * data );
@@ -1424,7 +1424,7 @@ static int _php_image_type(zend_string *data)
1424
1424
/* }}} */
1425
1425
1426
1426
/* {{{ _php_image_create_from_string */
1427
- gdImagePtr _php_image_create_from_string (zend_string * data , char * tn , gdImagePtr (* ioctx_func_p )(gdIOCtxPtr ))
1427
+ gdImagePtr _php_image_create_from_string (zend_string * data , const char * tn , gdImagePtr (* ioctx_func_p )(gdIOCtxPtr ))
1428
1428
{
1429
1429
gdImagePtr im ;
1430
1430
gdIOCtx * io_ctx ;
@@ -1529,7 +1529,7 @@ PHP_FUNCTION(imagecreatefromstring)
1529
1529
/* }}} */
1530
1530
1531
1531
/* {{{ _php_image_create_from */
1532
- static void _php_image_create_from (INTERNAL_FUNCTION_PARAMETERS , int image_type , char * tn , gdImagePtr (* func_p )(FILE * ), gdImagePtr (* ioctx_func_p )(gdIOCtxPtr ))
1532
+ static void _php_image_create_from (INTERNAL_FUNCTION_PARAMETERS , int image_type , const char * tn , gdImagePtr (* func_p )(FILE * ), gdImagePtr (* ioctx_func_p )(gdIOCtxPtr ))
1533
1533
{
1534
1534
char * file ;
1535
1535
size_t file_len ;
@@ -1759,7 +1759,7 @@ PHP_FUNCTION(imagecreatefromtga)
1759
1759
#endif
1760
1760
1761
1761
/* {{{ _php_image_output */
1762
- static void _php_image_output (INTERNAL_FUNCTION_PARAMETERS , int image_type , char * tn )
1762
+ static void _php_image_output (INTERNAL_FUNCTION_PARAMETERS , int image_type , const char * tn )
1763
1763
{
1764
1764
zval * imgind ;
1765
1765
char * file = NULL ;
@@ -3001,8 +3001,7 @@ static void php_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode)
3001
3001
{
3002
3002
zval * IM ;
3003
3003
zend_long X , Y , COL ;
3004
- char * C ;
3005
- size_t C_len ;
3004
+ zend_string * C ;
3006
3005
gdImagePtr im ;
3007
3006
int ch = 0 , col , x , y , i , l = 0 ;
3008
3007
unsigned char * str = NULL ;
@@ -3014,7 +3013,7 @@ static void php_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode)
3014
3013
Z_PARAM_OBJ_OF_CLASS_OR_LONG (font_obj , gd_font_ce , font_int )
3015
3014
Z_PARAM_LONG (X )
3016
3015
Z_PARAM_LONG (Y )
3017
- Z_PARAM_STRING ( C , C_len )
3016
+ Z_PARAM_STR ( C )
3018
3017
Z_PARAM_LONG (COL )
3019
3018
ZEND_PARSE_PARAMETERS_END ();
3020
3019
@@ -3023,9 +3022,9 @@ static void php_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode)
3023
3022
col = COL ;
3024
3023
3025
3024
if (mode < 2 ) {
3026
- ch = (int )((unsigned char )* C );
3025
+ ch = (int )((unsigned char )* ZSTR_VAL ( C ) );
3027
3026
} else {
3028
- str = (unsigned char * ) estrndup (C , C_len );
3027
+ str = (unsigned char * ) estrndup (ZSTR_VAL ( C ), ZSTR_LEN ( C ) );
3029
3028
l = strlen ((char * )str );
3030
3029
}
3031
3030
@@ -3407,6 +3406,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode)
3407
3406
3408
3407
PHP_GD_CHECK_OPEN_BASEDIR (fontname , "Invalid font filename" );
3409
3408
3409
+ // libgd note: Those should return const char * ideally, but backward compatibility ..
3410
3410
if (EXT ) {
3411
3411
error = gdImageStringFTEx (im , brect , col , fontname , ptsize , angle , x , y , str , & strex );
3412
3412
} else {
0 commit comments