From d08f2e889725608c9ab2a97496bb5dcb9be41d33 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Thu, 31 Aug 2006 14:41:15 +0000 Subject: [PATCH] more z/Z fixes --- ext/standard/basic_functions.c | 18 +++++++++--------- ext/standard/streamsfuncs.c | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 9d2d25808b..7f4d06b62e 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -5365,16 +5365,16 @@ ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highl Syntax highlight a source file */ PHP_FUNCTION(highlight_file) { - zval *filename; + char *filename; + int filename_len; zend_syntax_highlighter_ini syntax_highlighter_ini; zend_bool i = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &filename, &i) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &filename, &filename_len, &i) == FAILURE) { RETURN_FALSE; } - convert_to_string(filename); - if (php_check_open_basedir(Z_STRVAL_P(filename) TSRMLS_CC)) { + if (php_check_open_basedir(filename TSRMLS_CC)) { RETURN_FALSE; } @@ -5384,7 +5384,7 @@ PHP_FUNCTION(highlight_file) php_get_highlight_struct(&syntax_highlighter_ini); - if (highlight_file(Z_STRVAL_P(filename), &syntax_highlighter_ini TSRMLS_CC) == FAILURE) { + if (highlight_file(filename, &syntax_highlighter_ini TSRMLS_CC) == FAILURE) { RETURN_FALSE; } @@ -5437,16 +5437,16 @@ PHP_FUNCTION(php_strip_whitespace) Syntax highlight a string or optionally return it */ PHP_FUNCTION(highlight_string) { - zval *expr; + zval **expr; zend_syntax_highlighter_ini syntax_highlighter_ini; char *hicompiled_string_description; zend_bool i = 0; int old_error_reporting = EG(error_reporting); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &expr, &i) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|b", &expr, &i) == FAILURE) { RETURN_FALSE; } - convert_to_string(expr); + convert_to_string_ex(expr); if (i) { php_output_start_default(TSRMLS_C); @@ -5458,7 +5458,7 @@ PHP_FUNCTION(highlight_string) hicompiled_string_description = zend_make_compiled_string_description("highlighted code" TSRMLS_CC); - if (highlight_string(expr, &syntax_highlighter_ini, hicompiled_string_description TSRMLS_CC) == FAILURE) { + if (highlight_string(*expr, &syntax_highlighter_ini, hicompiled_string_description TSRMLS_CC) == FAILURE) { efree(hicompiled_string_description); RETURN_FALSE; } diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 05f92f315e..e815a8b157 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -711,7 +711,7 @@ static int stream_array_emulate_read_fd_set(zval *stream_array TSRMLS_DC) Runs the select() system call on the sets of streams with a timeout specified by tv_sec and tv_usec */ PHP_FUNCTION(stream_select) { - zval *r_array, *w_array, *e_array, *sec = NULL; + zval *r_array, *w_array, *e_array, **sec = NULL; struct timeval tv; struct timeval *tv_p = NULL; fd_set rfds, wfds, efds; @@ -720,7 +720,7 @@ PHP_FUNCTION(stream_select) long usec = 0; int set_count, max_set_count = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!a!a!z!|l", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!a!a!Z!|l", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE) return; FD_ZERO(&rfds); @@ -757,9 +757,9 @@ PHP_FUNCTION(stream_select) /* If seconds is not set to null, build the timeval, else we wait indefinitely */ if (sec != NULL) { - convert_to_long(sec); + convert_to_long_ex(sec); - if (Z_LVAL_P(sec) < 0) { + if (Z_LVAL_PP(sec) < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The seconds parameter must be greater than 0."); RETURN_FALSE; } else if (usec < 0) { @@ -769,10 +769,10 @@ PHP_FUNCTION(stream_select) /* Solaris + BSD do not like microsecond values which are >= 1 sec */ if (usec > 999999) { - tv.tv_sec = Z_LVAL_P(sec) + (usec / 1000000); + tv.tv_sec = Z_LVAL_PP(sec) + (usec / 1000000); tv.tv_usec = usec % 1000000; } else { - tv.tv_sec = Z_LVAL_P(sec); + tv.tv_sec = Z_LVAL_PP(sec); tv.tv_usec = usec; } -- 2.40.0