From: Frank M. Kromann Date: Fri, 28 Apr 2006 19:03:58 +0000 (+0000) Subject: Remove ZSTR() from stream macros. Calling function must apply this macro X-Git-Tag: BEFORE_NEW_OUTPUT_API~353 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e6e2754439f9c74125ed9865bdc1531e797b468f;p=php Remove ZSTR() from stream macros. Calling function must apply this macro --- diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 4ccf90aed2..aa4afba832 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -1349,14 +1349,14 @@ static int spl_filesystem_file_read(spl_filesystem_object *intern, int silent TS if (intern->u.file.max_line_len > 0) { buf = emalloc((intern->u.file.max_line_len + 1) * sizeof(char)); - if (php_stream_get_line(intern->u.file.stream, buf, intern->u.file.max_line_len, &line_len) == NULL) { + if (php_stream_get_line(intern->u.file.stream, ZSTR(buf), intern->u.file.max_line_len, &line_len) == NULL) { efree(buf); buf = NULL; } else { buf[line_len] = '\0'; } } else { - buf = php_stream_get_line(intern->u.file.stream, NULL, 0, &line_len); + buf = php_stream_get_line(intern->u.file.stream, NULL_ZSTR, 0, &line_len); } if (!buf) { diff --git a/ext/standard/file.c b/ext/standard/file.c index 8989611ff7..b12f54a4ad 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1049,7 +1049,7 @@ PHPAPI PHP_FUNCTION(fgets) php_stream_from_zval(stream, &zstream); - buf.v = php_stream_get_line_ex(stream, stream->readbuf_type, NULL, 0, length, &retlen); + buf.v = php_stream_get_line_ex(stream, stream->readbuf_type, NULL_ZSTR, 0, length, &retlen); if (!buf.v) { RETURN_FALSE; } @@ -1110,7 +1110,7 @@ PHPAPI PHP_FUNCTION(fgetss) php_stream_from_zval(stream, &zstream); if (stream->readbuf_type == IS_UNICODE) { - UChar *buf = php_stream_get_line_ex(stream, IS_UNICODE, NULL, 0, length, &retlen); + UChar *buf = php_stream_get_line_ex(stream, IS_UNICODE, NULL_ZSTR, 0, length, &retlen); UChar *allowed = NULL; int allowed_len = 0; @@ -1127,7 +1127,7 @@ PHPAPI PHP_FUNCTION(fgetss) RETURN_UNICODEL(buf, retlen, 0); } else { /* IS_STRING */ - char *buf = php_stream_get_line_ex(stream, IS_STRING, NULL, 0, length, &retlen); + char *buf = php_stream_get_line_ex(stream, IS_STRING, NULL_ZSTR, 0, length, &retlen); char *allowed = NULL; int allowed_len = 0; @@ -1189,7 +1189,7 @@ PHP_FUNCTION(fscanf) } - buf = php_stream_get_line((php_stream *) what, NULL, 0, &len); + buf = php_stream_get_line((php_stream *) what, NULL_ZSTR, 0, &len); if (buf == NULL) { efree(args); RETURN_FALSE; @@ -2056,12 +2056,12 @@ PHP_FUNCTION(fgetcsv) } if (len < 0) { - if ((buf = php_stream_get_line(stream, NULL, 0, &buf_len)) == NULL) { + if ((buf = php_stream_get_line(stream, NULL_ZSTR, 0, &buf_len)) == NULL) { RETURN_FALSE; } } else { buf = emalloc(len + 1); - if (php_stream_get_line(stream, buf, len + 1, &buf_len) == NULL) { + if (php_stream_get_line(stream, ZSTR(buf), len + 1, &buf_len) == NULL) { efree(buf); RETURN_FALSE; } @@ -2153,7 +2153,7 @@ PHP_FUNCTION(fgetcsv) memcpy(tptr, line_end, line_end_len); tptr += line_end_len; - if ((new_buf = php_stream_get_line(stream, NULL, 0, &new_len)) == NULL) { + if ((new_buf = php_stream_get_line(stream, NULL_ZSTR, 0, &new_len)) == NULL) { /* we've got an unterminated enclosure, * assign all the data from the start of * the enclosure to end of data to the diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 3a0f7cbba5..6c73c0ee8a 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -232,7 +232,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, char header_line[HTTP_HEADER_BLOCK_SIZE]; /* get response header */ - while (php_stream_gets(stream, header_line, HTTP_HEADER_BLOCK_SIZE-1) != NULL) { + while (php_stream_gets(stream, ZSTR(header_line), HTTP_HEADER_BLOCK_SIZE-1) != NULL) { if (header_line[0] == '\n' || header_line[0] == '\r' || header_line[0] == '\0') { @@ -520,7 +520,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, size_t tmp_line_len; /* get response header */ - if (php_stream_get_line(stream, tmp_line, sizeof(tmp_line) - 1, &tmp_line_len) != NULL) { + if (php_stream_get_line(stream, ZSTR(tmp_line), sizeof(tmp_line) - 1, &tmp_line_len) != NULL) { zval *http_response; int response_code; @@ -574,7 +574,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, while (!body && !php_stream_eof(stream)) { size_t http_header_line_length; - if (php_stream_get_line(stream, http_header_line, HTTP_HEADER_BLOCK_SIZE, &http_header_line_length) && *http_header_line != '\n' && *http_header_line != '\r') { + if (php_stream_get_line(stream, ZSTR(http_header_line), HTTP_HEADER_BLOCK_SIZE, &http_header_line_length) && *http_header_line != '\n' && *http_header_line != '\r') { char *e = http_header_line + http_header_line_length - 1; while (*e == '\n' || *e == '\r') { e--; diff --git a/ext/standard/image.c b/ext/standard/image.c index 6d0751aea1..d23ad781ec 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -1023,7 +1023,7 @@ static int php_get_xbm(php_stream *stream, struct gfxinfo **result TSRMLS_DC) if (php_stream_rewind(stream)) { return 0; } - while ((fline=php_stream_gets(stream, NULL, 0)) != NULL) { + while ((fline=php_stream_gets(stream, NULL_ZSTR, 0)) != NULL) { iname = estrdup(fline); /* simple way to get necessary buffer of required size */ if (sscanf(fline, "#define %s %d", iname, &value) == 2) { if (!(type = strrchr(iname, '_'))) { diff --git a/main/php_streams.h b/main/php_streams.h index 54aff0daf6..e4cdee2e75 100755 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -323,12 +323,12 @@ PHPAPI int _php_stream_flush(php_stream *stream, int closing TSRMLS_DC); #define php_stream_flush(stream) _php_stream_flush((stream), 0 TSRMLS_CC) PHPAPI void *_php_stream_get_line(php_stream *stream, int buf_type, zstr buf, size_t maxlen, size_t maxchars, size_t *returned_len TSRMLS_DC); -#define php_stream_get_line(stream, buf, maxlen, retlen) _php_stream_get_line((stream), IS_STRING, ZSTR(buf), (maxlen), 0, (retlen) TSRMLS_CC) +#define php_stream_get_line(stream, buf, maxlen, retlen) _php_stream_get_line((stream), IS_STRING, buf, (maxlen), 0, (retlen) TSRMLS_CC) #define php_stream_get_line_ex(stream, buf_type, buf, maxlen, maxchars, retlen) \ - _php_stream_get_line((stream), (buf_type), ZSTR(buf), (maxlen), (maxchars), (retlen) TSRMLS_CC) -#define php_stream_gets(stream, buf, maxlen) _php_stream_get_line((stream), IS_STRING, ZSTR(buf), (maxlen), 0, NULL TSRMLS_CC) + _php_stream_get_line((stream), (buf_type), buf, (maxlen), (maxchars), (retlen) TSRMLS_CC) +#define php_stream_gets(stream, buf, maxlen) _php_stream_get_line((stream), IS_STRING, buf, (maxlen), 0, NULL TSRMLS_CC) #define php_stream_gets_ex(stream, buf_type, buf, maxlen, maxchars) \ - _php_stream_get_line((stream), (buf_type), ZSTR(buf), (maxlen), (maxchars), NULL TSRMLS_CC) + _php_stream_get_line((stream), (buf_type), buf, (maxlen), (maxchars), NULL TSRMLS_CC) PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *returned_len, char *delim, size_t delim_len TSRMLS_DC); PHPAPI UChar *php_stream_get_record_unicode(php_stream *stream, size_t maxlen, size_t maxchars, size_t *returned_len, UChar *delim, size_t delim_len TSRMLS_DC);