Merge commit '11d9937d2377eddb1fa7cf31e7f5f89299942516'

* commit '11d9937d2377eddb1fa7cf31e7f5f89299942516':
  Added latest version of Image Magick as version to test on Travis.
  Cast size_t values to unsigned long so that printf knows the correct type.
  Added more version checks for fourier transform functions, and corrected the comparison.
  Added version check.
  Added version check for values.
  Added version check for MagickStatisticImage.

Also improved test message to avoid confusion.
This commit is contained in:
Danack
2014-07-03 17:01:27 +01:00
5 changed files with 44 additions and 12 deletions
+16 -4
View File
@@ -936,9 +936,11 @@ PHP_IMAGICK_API zend_class_entry *php_imagickpixel_get_class_entry()
ZEND_ARG_INFO(0, CHANNEL)
ZEND_END_ARG_INFO()
#if MagickLibVersion >= 0x655
ZEND_BEGIN_ARG_INFO_EX(imagick_forwardfouriertransformimage_args, 0, 0, 5)
ZEND_ARG_INFO(0, magnitude)
ZEND_END_ARG_INFO()
#endif
ZEND_BEGIN_ARG_INFO_EX(imagick_frameimage_args, 0, 0, 5)
ZEND_ARG_INFO(0, color)
@@ -1013,10 +1015,12 @@ PHP_IMAGICK_API zend_class_entry *php_imagickpixel_get_class_entry()
ZEND_ARG_INFO(0, y)
ZEND_END_ARG_INFO()
#if MagickLibVersion >= 0x658
ZEND_BEGIN_ARG_INFO_EX(imagick_inversefouriertransformimage_args, 0, 0, 3)
ZEND_ARG_INFO(0, complement)
ZEND_ARG_INFO(0, magnitude)
ZEND_END_ARG_INFO()
#endif
ZEND_BEGIN_ARG_INFO_EX(imagick_levelimage_args, 0, 0, 3)
ZEND_ARG_INFO(0, blackPoint)
@@ -1315,12 +1319,14 @@ PHP_IMAGICK_API zend_class_entry *php_imagickpixel_get_class_entry()
ZEND_ARG_INFO(0, CHANNEL)
ZEND_END_ARG_INFO()
#if MagickLibVersion >= 0x683
ZEND_BEGIN_ARG_INFO_EX(imagick_statisticimage_args, 0, 0, 3)
ZEND_ARG_INFO(0, type)
ZEND_ARG_INFO(0, width)
ZEND_ARG_INFO(0, height)
ZEND_ARG_INFO(0, CHANNEL)
ZEND_END_ARG_INFO()
#endif
ZEND_BEGIN_ARG_INFO_EX(imagick_subimagematch_args, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0)
@@ -2292,7 +2298,9 @@ static zend_function_entry php_imagick_class_methods[] =
#endif
PHP_ME(imagick, flipimage, imagick_zero_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, flopimage, imagick_zero_args, ZEND_ACC_PUBLIC)
#if MagickLibVersion >= 0x655
PHP_ME(imagick, forwardfouriertransformimage, imagick_forwardfouriertransformimage_args, ZEND_ACC_PUBLIC)
#endif
PHP_ME(imagick, frameimage, imagick_frameimage_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, fximage, imagick_fximage_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, gammaimage, imagick_gammaimage_args, ZEND_ACC_PUBLIC)
@@ -2345,7 +2353,9 @@ static zend_function_entry php_imagick_class_methods[] =
PHP_ME(imagick, getimagetotalinkdensity, imagick_zero_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, getimageregion, imagick_getimageregion_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, implodeimage, imagick_getimagetotalinkdensity_args, ZEND_ACC_PUBLIC)
#if MagickLibVersion >= 0x658
PHP_ME(imagick, inversefouriertransformimage, imagick_inversefouriertransformimage_args, ZEND_ACC_PUBLIC)
#endif
PHP_ME(imagick, levelimage, imagick_levelimage_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, magnifyimage, imagick_zero_args, ZEND_ACC_PUBLIC)
#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED)
@@ -2440,7 +2450,9 @@ static zend_function_entry php_imagick_class_methods[] =
PHP_ME(imagick, colormatriximage, imagick_colormatriximage_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, selectiveblurimage, imagick_selectiveblurimage_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, rotationalblurimage, imagick_rotationalblurimage_args, ZEND_ACC_PUBLIC)
#if MagickLibVersion >= 0x683
PHP_ME(imagick, statisticimage, imagick_statisticimage_args, ZEND_ACC_PUBLIC)
#endif
PHP_ME(imagick, subimagematch, imagick_subimagematch_args, ZEND_ACC_PUBLIC)
{ NULL, NULL, NULL }
};
@@ -2835,16 +2847,16 @@ static int checkImagickVersion()
if ((imagickVersion & imageMagickLibraryVersion & 0xfff0) != 0) {
zend_error(
E_WARNING,
"Version warning: Imagick was compiled against Image Magick version %x but version %x is loaded. Imagick will run but may behave surprisingly.",
imagickVersion,
imageMagickLibraryVersion
"Version warning: Imagick was compiled against Image Magick version %lu but version %lu is loaded. Imagick will run but may behave surprisingly.",
(unsigned long)imagickVersion,
(unsigned long)imageMagickLibraryVersion
);
return SUCCESS;
}
zend_error(
E_ERROR,
"Version error: Imagick was compiled against Image Magick version %x but version %x is loaded. Imagick will not run.",
"Version error: Imagick was compiled against Image Magick version %lu but version %lu is loaded. Imagick will not run.",
imagickVersion,
imageMagickLibraryVersion
);
+21 -7
View File
@@ -4175,9 +4175,11 @@ PHP_METHOD(imagick, implodeimage)
}
/* }}} */
#if MagickLibVersion >= 0x658
//Only stable as of 658
//http://upstream-tracker.org/compat_reports/imagemagick/6.5.7.7_to_6.5.7.8/abi_compat_report.html
/* {{{ proto bool Imagick::inversefouriertransformimage(Imagick complement, bool magnitude)
*/
PHP_METHOD(imagick, inversefouriertransformimage)
{
@@ -4206,8 +4208,7 @@ PHP_METHOD(imagick, inversefouriertransformimage)
RETURN_TRUE;
}
/* }}} */
#endif
/* {{{ proto bool Imagick::levelImage(float blackPoint, float gamma, float whitePoint[, int channel] )
Adjusts the levels of an image by scaling the colors falling between specified white and black points to the full available quantum range. The parameters provided represent the black, mid, and white points. The black point specifies the darkest color in the image. Colors darker than the black point are set to zero. Mid point specifies a gamma correction to apply to the image. White point specifies the lightest color in the image. Colors brighter than the white point are set to the maximum quantum value.
@@ -5741,6 +5742,8 @@ PHP_METHOD(imagick, evaluateimage)
/* }}} */
#if MagickLibVersion > 0x655
/* {{{ proto bool Imagick::forwardfouriertransformimage(bool magnitude)
//http://www.fftw.org/
yum install fftw-devel fftw
@@ -5748,8 +5751,7 @@ PHP_METHOD(imagick, evaluateimage)
*/
PHP_METHOD(imagick, forwardfouriertransformimage)
{
php_imagick_object *intern, *intern_complement;
zval *complement_obj;
php_imagick_object *intern;
zend_bool magnitude;
MagickBooleanType status;
@@ -5773,6 +5775,7 @@ PHP_METHOD(imagick, forwardfouriertransformimage)
}
/* }}} */
#endif
/* {{{ proto array Imagick::getImageGeometry()
@@ -10844,7 +10847,6 @@ PHP_METHOD(imagick, setprogressmonitor)
zval *user_callback;
php_imagick_object *intern;
php_imagick_rw_result_t rc;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &user_callback) == FAILURE) {
@@ -11049,6 +11051,7 @@ PHP_METHOD(imagick, brightnesscontrastimage)
/* }}} */
#if MagickLibVersion > 0x661
KernelInfo *getKernelInfo(const double *color_matrix, const size_t order)
{
@@ -11127,7 +11130,7 @@ PHP_METHOD(imagick, colormatriximage)
RETURN_TRUE;
}
/* }}} */
#endif
/* {{{ proto bool Imagick::selectiveBlurImage(float radius, float sigma, float threshold[, int channel])
Selectively blur an image within a contrast threshold. It is similar to the unsharpen mask that sharpens everything with contrast above a certain threshold.
@@ -11193,6 +11196,16 @@ PHP_METHOD(imagick, rotationalblurimage)
}
/* }}} */
#if MagickLibVersion >= 0x683
//Technically, this version is available in 0x682. However there was an incompatible
//change to the methods signature in a bug release. So only expose it for stable
//versions.
//
//6.8.2.8 - MagickStatisticImage ( MagickWand* p1, enum ChannelType const p2, enum StatisticType const p3, size_t const p4, size_t const p5 ) (6)
//6.8.2.9 - MagickStatisticImage ( MagickWand* p1, enum StatisticType const p2, size_t const p3, size_t const p4 )
/* {{{ proto bool Imagick::statisticImage(int type, float width, float height[, int channel] )
Replace each pixel with corresponding statistic from the neighborhood of the specified width and height.
*/
@@ -11224,6 +11237,7 @@ PHP_METHOD(imagick, statisticimage)
}
/* }}} */
#endif
/* {{{ proto bool Imagick::subimagematch(Imagick subimage[, array &$bestMatch[, float &similarity]])
+2
View File
@@ -1373,6 +1373,7 @@ void php_imagick_initialize_constants(TSRMLS_D)
IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_REMOVE", RemoveAlphaChannel);
#endif
#if MagickLibVersion > 0x683
IMAGICK_REGISTER_CONST_LONG("STATISTIC_GRADIENT", GradientStatistic);
IMAGICK_REGISTER_CONST_LONG("STATISTIC_MAXIMUM", MaximumStatistic);
IMAGICK_REGISTER_CONST_LONG("STATISTIC_MEAN", MeanStatistic);
@@ -1381,6 +1382,7 @@ void php_imagick_initialize_constants(TSRMLS_D)
IMAGICK_REGISTER_CONST_LONG("STATISTIC_MODE", ModeStatistic);
IMAGICK_REGISTER_CONST_LONG("STATISTIC_NONPEAK", NonpeakStatistic);
IMAGICK_REGISTER_CONST_LONG("STATISTIC_STANDARD_DEVIATION", StandardDeviationStatistic);
#endif
#undef IMAGICK_REGISTER_CONST_LONG
#undef IMAGICK_REGISTER_CONST_STRING
+4
View File
@@ -455,7 +455,9 @@ PHP_METHOD(imagick, flattenimages);
#endif
PHP_METHOD(imagick, flipimage);
PHP_METHOD(imagick, flopimage);
#if MagickLibVersion >= 0x655
PHP_METHOD(imagick, forwardfouriertransformimage);
#endif
PHP_METHOD(imagick, frameimage);
PHP_METHOD(imagick, fximage);
PHP_METHOD(imagick, gammaimage);
@@ -508,7 +510,9 @@ PHP_METHOD(imagick, getnumberimages);
PHP_METHOD(imagick, getimagetotalinkdensity);
PHP_METHOD(imagick, getimageregion);
PHP_METHOD(imagick, implodeimage);
#if MagickLibVersion >= 0x658
PHP_METHOD(imagick, inversefouriertransformimage);
#endif
PHP_METHOD(imagick, levelimage);
PHP_METHOD(imagick, magnifyimage);
#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED)
+1 -1
View File
@@ -1,5 +1,5 @@
--TEST--
Bug #66098 Segfault in zval_addref_p
Bug #66098 Check that there is no segfault from zval_addref_p
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc');
--FILE--