From 829f1855fdc70b2db862f400423327b75de0bdf1 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 19 Oct 2002 13:11:48 +0000 Subject: 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. --- main/php_streams.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'main/php_streams.h') 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); -- cgit v1.2.1