cvs: pecl /newt newt.c
| From: | Michael Spector | Date: | Sun, 15 Aug 2004 20:12:37 +0000 |
| Subject: | cvs: pecl /newt newt.c | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-1669@lists.php.net to get a copy of this message | ||
michael Sun Aug 15 16:12:37 2004 EDT
Modified files:
/pecl/newt newt.c
Log:
* added some argument checks
http://cvs.php.net/diff.php/pecl/newt/newt.c?r1=1.9&r2=1.10&ty=u
Index: pecl/newt/newt.c
diff -u pecl/newt/newt.c:1.9 pecl/newt/newt.c:1.10
--- pecl/newt/newt.c:1.9 Sun Aug 15 12:31:22 2004
+++ pecl/newt/newt.c Sun Aug 15 16:12:36 2004
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: newt.c,v 1.9 2004/08/15 16:31:22 michael Exp $ */
+/* $Id: newt.c,v 1.10 2004/08/15 20:12:36 michael Exp $ */
#include <newt.h>
@@ -3216,14 +3216,18 @@
return;
}
+ if (Z_TYPE_PP(args[0]) != IS_STRING) {
+ php_error_docref (NULL TSRMLS_CC, E_ERROR, "First argument must be string");
+ }
title = Z_STRVAL_PP(args[0]);
+ if (Z_TYPE_PP(args[1]) != IS_STRING) {
+ php_error_docref (NULL TSRMLS_CC, E_ERROR, "Second argument must be string");
+ }
button_text = Z_STRVAL_PP(args[1]);
newt_call_php_function (INTERNAL_FUNCTION_PARAM_PASSTHRU, "sprintf", &z_text,
argc-2, args+2);
+ text = Z_STRVAL_P(z_text);
- if(z_text) {
- text = Z_STRVAL_P(z_text);
- }
newtWinMessage (title, button_text, text);
efree (args);
}
@@ -3244,14 +3248,18 @@
return;
}
+ if (Z_TYPE_PP(args[0]) != IS_STRING) {
+ php_error_docref (NULL TSRMLS_CC, E_ERROR, "First argument must be string");
+ }
title = Z_STRVAL_PP(args[0]);
+ if (Z_TYPE_PP(args[1]) != IS_STRING) {
+ php_error_docref (NULL TSRMLS_CC, E_ERROR, "Second argument must be string");
+ }
button_text = Z_STRVAL_PP(args[1]);
newt_call_php_function (INTERNAL_FUNCTION_PARAM_PASSTHRU, "vsprintf", &z_text,
argc-2, args+2);
+ text = Z_STRVAL_P(z_text);
- if(z_text) {
- text = Z_STRVAL_P(z_text);
- }
newtWinMessage (title, button_text, text);
}
/* }}} */
@@ -3274,15 +3282,22 @@
return;
}
+ if (Z_TYPE_PP(args[0]) != IS_STRING) {
+ php_error_docref (NULL TSRMLS_CC, E_ERROR, "First argument must be string");
+ }
title = Z_STRVAL_PP(args[0]);
+ if (Z_TYPE_PP(args[1]) != IS_STRING) {
+ php_error_docref (NULL TSRMLS_CC, E_ERROR, "Second argument must be string");
+ }
button1_text = Z_STRVAL_PP(args[1]);
+ if (Z_TYPE_PP(args[2]) != IS_STRING) {
+ php_error_docref (NULL TSRMLS_CC, E_ERROR, "Third argument must be string");
+ }
button2_text = Z_STRVAL_PP(args[2]);
newt_call_php_function (INTERNAL_FUNCTION_PARAM_PASSTHRU, "sprintf", &z_text,
argc-3, args+3);
-
- if(z_text) {
- text = Z_STRVAL_P(z_text);
- }
+ text = Z_STRVAL_P(z_text);
+
button_id = newtWinChoice (title, button1_text, button2_text, text);
efree (args);
@@ -3308,16 +3323,26 @@
return;
}
+ if (Z_TYPE_PP(args[0]) != IS_STRING) {
+ php_error_docref (NULL TSRMLS_CC, E_ERROR, "First argument must be string");
+ }
title = Z_STRVAL_PP(args[0]);
+ if (Z_TYPE_PP(args[1]) != IS_STRING) {
+ php_error_docref (NULL TSRMLS_CC, E_ERROR, "Second argument must be string");
+ }
button1_text = Z_STRVAL_PP(args[1]);
+ if (Z_TYPE_PP(args[2]) != IS_STRING) {
+ php_error_docref (NULL TSRMLS_CC, E_ERROR, "Third argument must be string");
+ }
button2_text = Z_STRVAL_PP(args[2]);
+ if (Z_TYPE_PP(args[3]) != IS_STRING) {
+ php_error_docref (NULL TSRMLS_CC, E_ERROR, "Fourth argument must be string");
+ }
button3_text = Z_STRVAL_PP(args[3]);
newt_call_php_function (INTERNAL_FUNCTION_PARAM_PASSTHRU, "sprintf", &z_text,
argc-4, args+4);
-
- if(z_text) {
- text = Z_STRVAL_P(z_text);
- }
+ text = Z_STRVAL_P(z_text);
+
button_id = newtWinTernary (title, button1_text, button2_text, button3_text, text);
efree (args);