]> granicus.if.org Git - php/commitdiff
Remove ZSTR() from stream macros. Calling function must apply this macro
authorFrank M. Kromann <fmk@php.net>
Fri, 28 Apr 2006 19:03:58 +0000 (19:03 +0000)
committerFrank M. Kromann <fmk@php.net>
Fri, 28 Apr 2006 19:03:58 +0000 (19:03 +0000)
ext/spl/spl_directory.c
ext/standard/file.c
ext/standard/http_fopen_wrapper.c
ext/standard/image.c
main/php_streams.h

index 4ccf90aed26fba307284235d61a3a1c588e8d2f2..aa4afba832e7f0df50a02e9a4243306aeb7812df 100755 (executable)
@@ -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) {
index 8989611ff7d0663663d421d0aa144d589a039a8e..b12f54a4ad2cb5184384e5ef271bfad738c46608 100644 (file)
@@ -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
index 3a0f7cbba53b91155e2929cb925f7bb7513b4712..6c73c0ee8a0c15f0252abd7fcc5f9c49cfaa4acd 100644 (file)
@@ -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--;
index 6d0751aea1b1babfdf86d52895d40c783c0d4ee3..d23ad781ec453f3b8143432994bf81454851ffe7 100644 (file)
@@ -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, '_'))) {
index 54aff0daf6e0ac0780ebf8efb83ba848f76e5b8f..e4cdee2e75cf2f2ca8fc75095a6e1f12e2811f4f 100755 (executable)
@@ -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);