summaryrefslogtreecommitdiff
path: root/main/php_streams.h
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2002-10-19 13:11:48 +0000
committerWez Furlong <wez@php.net>2002-10-19 13:11:48 +0000
commit829f1855fdc70b2db862f400423327b75de0bdf1 (patch)
tree0596c78c4425d717f0a15fb3b925a0d029a80860 /main/php_streams.h
parent8998bce403f1f9e91e043a4fa9b18c0a70248978 (diff)
downloadphp-git-829f1855fdc70b2db862f400423327b75de0bdf1.tar.gz
made fgets() binary safe.
php_stream_gets is now a macro which calls php_stream_get_line. The latter has an option argument to return the number of bytes in the line. Functions like fgetcsv(), fgetss() can be made binary safe by calling php_stream_get_line directly. # HEADS UP: You will need to make clean after updating your CVS, as the # binary signature has changed.
Diffstat (limited to 'main/php_streams.h')
-rwxr-xr-xmain/php_streams.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/main/php_streams.h b/main/php_streams.h
index 0f85166ef6..6861671360 100755
--- a/main/php_streams.h
+++ b/main/php_streams.h
@@ -359,8 +359,10 @@ PHPAPI int _php_stream_putc(php_stream *stream, int c TSRMLS_DC);
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 char *_php_stream_gets(php_stream *stream, char *buf, size_t maxlen TSRMLS_DC);
-#define php_stream_gets(stream, buf, maxlen) _php_stream_gets((stream), (buf), (maxlen) TSRMLS_CC)
+PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen, size_t *returned_len TSRMLS_DC);
+#define php_stream_gets(stream, buf, maxlen) _php_stream_get_line((stream), (buf), (maxlen), NULL TSRMLS_CC)
+
+#define php_stream_get_line(stream, buf, maxlen, retlen) _php_stream_get_line((stream), (buf), (maxlen), (retlen) TSRMLS_CC)
/* CAREFUL! this is equivalent to puts NOT fputs! */
PHPAPI int _php_stream_puts(php_stream *stream, char *buf TSRMLS_DC);