@@ -751,11 +751,7 @@ PHP_FUNCTION(imagepalettetotruecolor)
751751
752752 im = php_gd_libgdimageptr_from_zval_p (IM );
753753
754- if (gdImagePaletteToTrueColor (im ) == 0 ) {
755- RETURN_FALSE ;
756- }
757-
758- RETURN_TRUE ;
754+ RETURN_BOOL (gdImagePaletteToTrueColor (im ) != 0 );
759755}
760756/* }}} */
761757
@@ -3424,22 +3420,14 @@ static void php_image_filter_negate(INTERNAL_FUNCTION_PARAMETERS)
34243420{
34253421 PHP_GD_SINGLE_RES
34263422
3427- if (gdImageNegate (im_src ) == 1 ) {
3428- RETURN_TRUE ;
3429- }
3430-
3431- RETURN_FALSE ;
3423+ RETURN_BOOL (gdImageNegate (im_src ) == 1 );
34323424}
34333425
34343426static void php_image_filter_grayscale (INTERNAL_FUNCTION_PARAMETERS )
34353427{
34363428 PHP_GD_SINGLE_RES
34373429
3438- if (gdImageGrayScale (im_src ) == 1 ) {
3439- RETURN_TRUE ;
3440- }
3441-
3442- RETURN_FALSE ;
3430+ RETURN_BOOL (gdImageGrayScale (im_src ) == 1 );
34433431}
34443432
34453433static void php_image_filter_brightness (INTERNAL_FUNCTION_PARAMETERS )
@@ -3456,11 +3444,7 @@ static void php_image_filter_brightness(INTERNAL_FUNCTION_PARAMETERS)
34563444
34573445 im_src = php_gd_libgdimageptr_from_zval_p (SIM );
34583446
3459- if (gdImageBrightness (im_src , (int )brightness ) == 1 ) {
3460- RETURN_TRUE ;
3461- }
3462-
3463- RETURN_FALSE ;
3447+ RETURN_BOOL (gdImageBrightness (im_src , (int )brightness ) == 1 );
34643448}
34653449
34663450static void php_image_filter_contrast (INTERNAL_FUNCTION_PARAMETERS )
@@ -3477,11 +3461,7 @@ static void php_image_filter_contrast(INTERNAL_FUNCTION_PARAMETERS)
34773461
34783462 im_src = php_gd_libgdimageptr_from_zval_p (SIM );
34793463
3480- if (gdImageContrast (im_src , (int )contrast ) == 1 ) {
3481- RETURN_TRUE ;
3482- }
3483-
3484- RETURN_FALSE ;
3464+ RETURN_BOOL (gdImageContrast (im_src , (int )contrast ) == 1 );
34853465}
34863466
34873467static void php_image_filter_colorize (INTERNAL_FUNCTION_PARAMETERS )
@@ -3503,66 +3483,42 @@ static void php_image_filter_colorize(INTERNAL_FUNCTION_PARAMETERS)
35033483
35043484 im_src = php_gd_libgdimageptr_from_zval_p (SIM );
35053485
3506- if (gdImageColor (im_src , (int ) r , (int ) g , (int ) b , (int ) a ) == 1 ) {
3507- RETURN_TRUE ;
3508- }
3509-
3510- RETURN_FALSE ;
3486+ RETURN_BOOL (gdImageColor (im_src , (int ) r , (int ) g , (int ) b , (int ) a ) == 1 );
35113487}
35123488
35133489static void php_image_filter_edgedetect (INTERNAL_FUNCTION_PARAMETERS )
35143490{
35153491 PHP_GD_SINGLE_RES
35163492
3517- if (gdImageEdgeDetectQuick (im_src ) == 1 ) {
3518- RETURN_TRUE ;
3519- }
3520-
3521- RETURN_FALSE ;
3493+ RETURN_BOOL (gdImageEdgeDetectQuick (im_src ) == 1 );
35223494}
35233495
35243496static void php_image_filter_emboss (INTERNAL_FUNCTION_PARAMETERS )
35253497{
35263498 PHP_GD_SINGLE_RES
35273499
3528- if (gdImageEmboss (im_src ) == 1 ) {
3529- RETURN_TRUE ;
3530- }
3531-
3532- RETURN_FALSE ;
3500+ RETURN_BOOL (gdImageEmboss (im_src ) == 1 );
35333501}
35343502
35353503static void php_image_filter_gaussian_blur (INTERNAL_FUNCTION_PARAMETERS )
35363504{
35373505 PHP_GD_SINGLE_RES
35383506
3539- if (gdImageGaussianBlur (im_src ) == 1 ) {
3540- RETURN_TRUE ;
3541- }
3542-
3543- RETURN_FALSE ;
3507+ RETURN_BOOL (gdImageGaussianBlur (im_src ) == 1 );
35443508}
35453509
35463510static void php_image_filter_selective_blur (INTERNAL_FUNCTION_PARAMETERS )
35473511{
35483512 PHP_GD_SINGLE_RES
35493513
3550- if (gdImageSelectiveBlur (im_src ) == 1 ) {
3551- RETURN_TRUE ;
3552- }
3553-
3554- RETURN_FALSE ;
3514+ RETURN_BOOL (gdImageSelectiveBlur (im_src ) == 1 );
35553515}
35563516
35573517static void php_image_filter_mean_removal (INTERNAL_FUNCTION_PARAMETERS )
35583518{
35593519 PHP_GD_SINGLE_RES
35603520
3561- if (gdImageMeanRemoval (im_src ) == 1 ) {
3562- RETURN_TRUE ;
3563- }
3564-
3565- RETURN_FALSE ;
3521+ RETURN_BOOL (gdImageMeanRemoval (im_src ) == 1 );
35663522}
35673523
35683524static void php_image_filter_smooth (INTERNAL_FUNCTION_PARAMETERS )
@@ -3580,11 +3536,7 @@ static void php_image_filter_smooth(INTERNAL_FUNCTION_PARAMETERS)
35803536
35813537 im_src = php_gd_libgdimageptr_from_zval_p (SIM );
35823538
3583- if (gdImageSmooth (im_src , (float )weight )== 1 ) {
3584- RETURN_TRUE ;
3585- }
3586-
3587- RETURN_FALSE ;
3539+ RETURN_BOOL (gdImageSmooth (im_src , (float )weight ) == 1 );
35883540}
35893541
35903542static void php_image_filter_pixelate (INTERNAL_FUNCTION_PARAMETERS )
@@ -3604,11 +3556,7 @@ static void php_image_filter_pixelate(INTERNAL_FUNCTION_PARAMETERS)
36043556
36053557 im = php_gd_libgdimageptr_from_zval_p (IM );
36063558
3607- if (gdImagePixelate (im , (int ) blocksize , (const unsigned int ) mode )) {
3608- RETURN_TRUE ;
3609- }
3610-
3611- RETURN_FALSE ;
3559+ RETURN_BOOL (gdImagePixelate (im , (int ) blocksize , (const unsigned int ) mode ));;
36123560}
36133561
36143562static void php_image_filter_scatter (INTERNAL_FUNCTION_PARAMETERS )
@@ -3707,7 +3655,6 @@ PHP_FUNCTION(imageconvolution)
37073655 zval * var = NULL , * var2 = NULL ;
37083656 gdImagePtr im_src = NULL ;
37093657 double div , offset ;
3710- int res ;
37113658 float matrix [3 ][3 ] = {{0 ,0 ,0 }, {0 ,0 ,0 }, {0 ,0 ,0 }};
37123659
37133660 ZEND_PARSE_PARAMETERS_START (4 , 4 )
@@ -3758,13 +3705,7 @@ PHP_FUNCTION(imageconvolution)
37583705 RETURN_THROWS ();
37593706 }
37603707
3761- res = gdImageConvolution (im_src , matrix , div_float , (float ) offset );
3762-
3763- if (res ) {
3764- RETURN_TRUE ;
3765- } else {
3766- RETURN_FALSE ;
3767- }
3708+ RETURN_BOOL (gdImageConvolution (im_src , matrix , div_float , (float ) offset ));
37683709}
37693710/* }}} */
37703711/* End section: Filters */
0 commit comments