Skip to content

Commit

Permalink
unbork filename everywhere. ImagickPixel::getColor should be required.
Browse files Browse the repository at this point in the history
  • Loading branch information
Danack committed Jun 16, 2021
1 parent f58a8d7 commit 2605370
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 39 deletions.
12 changes: 6 additions & 6 deletions ImagickPixel_arginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ImagickPixel___construct, 0, 0, 0)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, color, IS_STRING, 1, "null")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, color)
#endif

ZEND_END_ARG_INFO()
Expand All @@ -34,7 +34,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ImagickPixel_getColor, 0, 0, 0)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, normalized, IS_LONG, 0, "0")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, normalized)
#endif

ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -70,17 +70,17 @@ ZEND_END_ARG_INFO()
#if MAGICKCORE_HDRI_ENABLE

#if PHP_VERSION_ID >= 80000
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ImagickPixel_getColorValue, 0, 0, IS_DOUBLE, 0)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ImagickPixel_getColorValue, 0, 1, IS_DOUBLE, 0)
#else
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ImagickPixel_getColorValue, 0, 0, 0)
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ImagickPixel_getColorValue, 0, 0, 1)
#endif

#else

#if PHP_VERSION_ID >= 80000
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ImagickPixel_getColorValue, 0, 0, IS_LONG, 0)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ImagickPixel_getColorValue, 0, 1, IS_LONG, 0)
#else
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ImagickPixel_getColorValue, 0, 0, 0)
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ImagickPixel_getColorValue, 0, 0, 1)
#endif

#endif
Expand Down
56 changes: 28 additions & 28 deletions Imagick_arginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,14 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_adaptiveResizeImage, 0, 0, 2)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, bestfit, _IS_BOOL, 0, "false")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, bestfit)
#endif


#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, legacy, _IS_BOOL, 0, "false")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, legacy)
#endif

ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -422,14 +422,14 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_roundCornersImage, 0, 0, 2)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, stroke_width, IS_DOUBLE, 0, "10")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, stroke_width)
#endif


#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, displace, IS_DOUBLE, 0, "5")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, displace)
#endif

ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, size_correction, IS_DOUBLE, 0, "-6")
Expand Down Expand Up @@ -804,7 +804,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_getImageProperties, 0, 0, 0)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, include_values, _IS_BOOL, 0, "true")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, include_values)
#endif

ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -862,7 +862,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_writeImageFile, 0, 0, 1)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, format, IS_STRING, 1, "null")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, format)
#endif

ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -1382,7 +1382,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_segmentImage, 0, 0, 3)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, verbose, _IS_BOOL, 0, "false")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, verbose)
#endif

ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -1747,7 +1747,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_count, 0, 0, 0)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "0")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, mode)
#endif

ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -1896,14 +1896,14 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_scaleImage, 0, 0, 2)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, bestfit, _IS_BOOL, 0, "false")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, bestfit)
#endif


#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, legacy, _IS_BOOL, 0, "false")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, legacy)
#endif

ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -1990,21 +1990,21 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_thumbnailImage, 0, 0, 2)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, bestfit, _IS_BOOL, 0, "false")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, bestfit)
#endif


#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, fill, _IS_BOOL, 0, "false")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, fill)
#endif


#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, legacy, _IS_BOOL, 0, "false")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, legacy)
#endif

ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -2032,7 +2032,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_cropThumbnailImage, 0, 0, 2)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, legacy, _IS_BOOL, 0, "false")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, legacy)
#endif

ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -2384,7 +2384,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_identifyImage, 0, 0, 0)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, append_raw_output, _IS_BOOL, 0, "false")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, append_raw_output)
#endif

ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -2651,14 +2651,14 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_resizeImage, 0, 0, 4)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, bestfit, _IS_BOOL, 0, "false")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, bestfit)
#endif


#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, legacy, _IS_BOOL, 0, "false")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, legacy)
#endif

ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -3127,7 +3127,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_queryFontMetrics, 0, 0, 2)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, multiline, _IS_BOOL, 1, "null")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, multiline)
#endif

ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -3291,7 +3291,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_calculateCrop, 0, 0, 4)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, legacy, _IS_BOOL, 0, "false")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, legacy)
#endif

ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -3388,7 +3388,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_colorizeImage, 0, 0, 2)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, legacy, _IS_BOOL, 1, "false")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, legacy)
#endif

ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -4495,7 +4495,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_tintImage, 0, 0, 2)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, legacy, _IS_BOOL, 0, "false")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, legacy)
#endif

ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -4572,7 +4572,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_newImage, 0, 0, 3)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, format, IS_STRING, 0, "null")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, format)
#endif

ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -4940,22 +4940,22 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_subimageMatch, 0, 0, 1)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(1, offset, IS_ARRAY, 1, "null")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, offset)
#endif


#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(1, similarity, IS_DOUBLE, 1, "null")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, similarity)
#endif

ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, threshold, IS_DOUBLE, 0, "0.0")

#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, metric, IS_LONG, 0, "0")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, metric)
#endif

ZEND_END_ARG_INFO()
Expand All @@ -4974,22 +4974,22 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_similarityimage, 0, 0, 1)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(1, offset, IS_ARRAY, 1, "null")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, offset)
#endif


#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(1, similarity, IS_DOUBLE, 1, "null")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, similarity)
#endif

ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, threshold, IS_DOUBLE, 0, "0.0")

#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, metric, IS_LONG, 0, "0")
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, metric)
#endif

ZEND_END_ARG_INFO()
Expand Down
9 changes: 4 additions & 5 deletions util/fixup_arginfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,12 @@
ZEND_ARG_INFO($1, $2)
#endif";


$search[] = "#ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX\((\w*), 0, 1, IMAGICK_QUANTUM_TYPE, 0\)#iu";
$search[] = "#ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX\((\w*), 0, (\w*), IMAGICK_QUANTUM_TYPE, 0\)#iu";
$replace[] = "
#if MAGICKCORE_HDRI_ENABLE
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX($1, 0, 0, IS_DOUBLE, 0)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX($1, 0, $2, IS_DOUBLE, 0)
#else
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX($1, 0, 0, IS_LONG, 0)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX($1, 0, $2, IS_LONG, 0)
#endif
";

Expand Down Expand Up @@ -122,7 +121,7 @@
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE($1, $2, $3, $4, $5)
#else
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, $2)

This comment has been minimized.

Copy link
@remicollet

remicollet Jun 16, 2021

Contributor

Should be ZEND_ARG_INFO($1, $2)else you loos the pass_by_ref (and breaks subImageMatch / similarityimage )

#endif
";

Expand Down

0 comments on commit 2605370

Please sign in to comment.