com php-src: Fix Gd usages of ZEND_WRONG_PARAM_COUNT, add usage note: Zend/zend_API.h ext/gd/gd.c
| From: | Dmitry Stogov | Date: | Tue, 10 Feb 2015 15:48:09 +0000 |
| Subject: | com php-src: Fix Gd usages of ZEND_WRONG_PARAM_COUNT, add usage note: Zend/zend_API.h ext/gd/gd.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-85712@lists.php.net to get a copy of this message | ||
Commit: 44ed070a9afed6f45165769f959c1122e765ad35
Author: Andrea Faulds <ajf@ajf.me> Sun, 1 Feb 2015 16:40:57 +0000
Parents: 6b6b2b4b7cc2f463c7add85fd1ccd1ba89b004cf
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=44ed070a9afed6f45165769f959c1122e765ad35
Log:
Fix Gd usages of ZEND_WRONG_PARAM_COUNT, add usage note
Changed paths:
M Zend/zend_API.h
M ext/gd/gd.c
Diff:
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index 0855f81..4f12834 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -353,12 +353,15 @@ ZEND_API char *zend_get_type_by_const(int type);
#define getThis() (Z_OBJ(EX(This)) ? &EX(This) : NULL)
#define ZEND_IS_METHOD_CALL() (EX(func)->common.scope != NULL)
-#define WRONG_PARAM_COUNT ZEND_WRONG_PARAM_COUNT((ZEND_CALL_INFO(EG(current_execute_data))
& ZEND_CALL_STRICT_TYPEHINTS) ? 1 : 0)
-#define
WRONG_PARAM_COUNT_WITH_RETVAL(ret) ZEND_WRONG_PARAM_COUNT_WITH_RETVAL((ZEND_CALL_INFO(EG(current_execute_data))
& ZEND_CALL_STRICT_TYPEHINTS) ? 1 : 0, ret)
+#define WRONG_PARAM_COUNT _ZEND_WRONG_PARAM_COUNT((ZEND_CALL_INFO(EG(current_execute_data))
& ZEND_CALL_STRICT_TYPEHINTS) ? 1 : 0)
+#define
WRONG_PARAM_COUNT_WITH_RETVAL(ret) _ZEND_WRONG_PARAM_COUNT_WITH_RETVAL((ZEND_CALL_INFO(EG(current_execute_data))
& ZEND_CALL_STRICT_TYPEHINTS) ? 1 : 0, ret)
#define ARG_COUNT(dummy) EX_NUM_ARGS()
#define ZEND_NUM_ARGS() EX_NUM_ARGS()
-#define ZEND_WRONG_PARAM_COUNT(strict) { _zend_wrong_param_count(strict); return; }
-#define ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(strict, ret) { _zend_wrong_param_count(strict); return
ret; }
+/* These are prefixed with underscores for a reason: don't use them directly
+ * Use WRONG_PARAM_COUNT;
+ */
+#define _ZEND_WRONG_PARAM_COUNT(strict) { _zend_wrong_param_count(strict); return; }
+#define _ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(strict, ret) { _zend_wrong_param_count(strict); return
ret; }
#ifndef ZEND_WIN32
#define DLEXPORT
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 61050ba..ebd4500 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -3940,13 +3940,13 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode,
int
if (mode == TTFTEXT_BBOX) {
if (argc < 4 || argc > ((extended) ? 5 : 4)) {
- ZEND_WRONG_PARAM_COUNT();
+ WRONG_PARAM_COUNT;
} else if (zend_parse_parameters(argc, "ddss|a", &ptsize, &angle,
&fontname, &fontname_len, &str, &str_len, &EXT) == FAILURE) {
RETURN_FALSE;
}
} else {
if (argc < 8 || argc > ((extended) ? 9 : 8)) {
- ZEND_WRONG_PARAM_COUNT();
+ WRONG_PARAM_COUNT;
} else if (zend_parse_parameters(argc, "rddlllss|a", &IM, &ptsize, &angle,
&x, &y, &col, &fontname, &fontname_len, &str, &str_len, &EXT) ==
FAILURE) {
RETURN_FALSE;
}
@@ -4395,7 +4395,7 @@ PHP_FUNCTION(imagepsbbox)
BBox char_bbox, str_bbox = {0, 0, 0, 0};
if (argc != 3 && argc != 6) {
- ZEND_WRONG_PARAM_COUNT();
+ WRONG_PARAM_COUNT;
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Srl|lld", &str, &fnt, &sz,
&sp, &wd, &angle) == FAILURE) {