more z/Z fixes

This commit is contained in:
Antony Dovgal 2006-08-31 14:41:24 +00:00
parent 0c482b5c64
commit c2a38c607b
2 changed files with 19 additions and 19 deletions

View file

@ -5379,20 +5379,20 @@ 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) {
RETURN_FALSE;
}
convert_to_string(filename);
if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_P(filename), NULL, CHECKUID_ALLOW_ONLY_FILE))) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &filename, &filename_len, &i) == FAILURE) {
RETURN_FALSE;
}
if (php_check_open_basedir(Z_STRVAL_P(filename) TSRMLS_CC)) {
if (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_ALLOW_ONLY_FILE))) {
RETURN_FALSE;
}
if (php_check_open_basedir(filename TSRMLS_CC)) {
RETURN_FALSE;
}
@ -5402,7 +5402,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;
}
@ -5455,16 +5455,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_start_ob_buffer (NULL, 0, 1 TSRMLS_CC);
@ -5476,7 +5476,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;
}

View file

@ -706,7 +706,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;
@ -715,7 +715,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);
@ -752,9 +752,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) {
@ -764,10 +764,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;
}