cvs: php4 /ext/standard string.c /main php_streams.h streams.c

From: Date: Sun, 25 Aug 2002 10:26:58 +0000
Subject: cvs: php4 /ext/standard string.c /main php_streams.h streams.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-13655@lists.php.net to get a copy of this message
wez Sun Aug 25 06:26:58 2002 EDT Modified files: /php4/ext/standard string.c /php4/main php_streams.h streams.c Log: Add a "closing" parameter for filters to determine if a flush is the last flush before the stream is closed. This allows filters to finish a chunk and write footers etc. Index: php4/ext/standard/string.c diff -u php4/ext/standard/string.c:1.284 php4/ext/standard/string.c:1.285 --- php4/ext/standard/string.c:1.284 Fri Aug 23 21:19:28 2002 +++ php4/ext/standard/string.c Sun Aug 25 06:26:58 2002 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.284 2002/08/24 01:19:28 helly Exp $ */ +/* $Id: string.c,v 1.285 2002/08/25 10:26:58 wez Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -3964,9 +3964,9 @@ return read; } -static int strfilter_rot13_flush(php_stream *stream, php_stream_filter *thisfilter TSRMLS_DC) +static int strfilter_rot13_flush(php_stream *stream, php_stream_filter *thisfilter, int closing TSRMLS_DC) { - return php_stream_filter_flush_next(stream, thisfilter); + return php_stream_filter_flush_next(stream, thisfilter, closing); } static int strfilter_rot13_eof(php_stream *stream, php_stream_filter *thisfilter TSRMLS_DC) Index: php4/main/php_streams.h diff -u php4/main/php_streams.h:1.40 php4/main/php_streams.h:1.41 --- php4/main/php_streams.h:1.40 Sun Aug 25 06:10:23 2002 +++ php4/main/php_streams.h Sun Aug 25 06:26:58 2002 @@ -182,7 +182,7 @@ const char *buf, size_t count TSRMLS_DC); size_t (*read)(php_stream *stream, php_stream_filter *thisfilter, char *buf, size_t count TSRMLS_DC); - int (*flush)(php_stream *stream, php_stream_filter *thisfilter TSRMLS_DC); + int (*flush)(php_stream *stream, php_stream_filter *thisfilter, int closing TSRMLS_DC); int (*eof)(php_stream *stream, php_stream_filter *thisfilter TSRMLS_DC); void (*dtor)(php_stream_filter *thisfilter TSRMLS_DC); const char *label; @@ -205,8 +205,8 @@ (thisfilter)->next ? (thisfilter)->next->fops->read((stream), (thisfilter)->next, (buf), (size) TSRMLS_CC) \ : (stream)->ops->read((stream), (buf), (size) TSRMLS_CC) -#define php_stream_filter_flush_next(stream, thisfilter) \ - (thisfilter)->next ? (thisfilter)->next->fops->flush((stream), (thisfilter) TSRMLS_CC) \ +#define php_stream_filter_flush_next(stream, thisfilter, closing) \ + (thisfilter)->next ? (thisfilter)->next->fops->flush((stream), (thisfilter), (closing) TSRMLS_CC) \ : (stream)->ops->flush((stream) TSRMLS_CC) #define php_stream_filter_eof_next(stream, thisfilter) \ @@ -321,8 +321,8 @@ PHPAPI int _php_stream_putc(php_stream *stream, int c TSRMLS_DC); #define php_stream_putc(stream, c) _php_stream_putc((stream), (c) TSRMLS_CC) -PHPAPI int _php_stream_flush(php_stream *stream TSRMLS_DC); -#define php_stream_flush(stream) _php_stream_flush((stream) TSRMLS_CC) +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) Index: php4/main/streams.c diff -u php4/main/streams.c:1.68 php4/main/streams.c:1.69 --- php4/main/streams.c:1.68 Thu Aug 22 18:28:19 2002 +++ php4/main/streams.c Sun Aug 25 06:26:58 2002 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: streams.c,v 1.68 2002/08/22 22:28:19 wez Exp $ */ +/* $Id: streams.c,v 1.69 2002/08/25 10:26:58 wez Exp $ */ #define _GNU_SOURCE #include "php.h" @@ -111,7 +111,7 @@ stream->in_free++; - php_stream_flush(stream); + _php_stream_flush(stream, 1 TSRMLS_CC); if ((close_options & PHP_STREAM_FREE_RSRC_DTOR) == 0) { /* Remove entry from the resource list */ @@ -401,10 +401,10 @@ return NULL; } -PHPAPI int _php_stream_flush(php_stream *stream TSRMLS_DC) +PHPAPI int _php_stream_flush(php_stream *stream, int closing TSRMLS_DC) { if (stream->filterhead) - stream->filterhead->fops->flush(stream, stream->filterhead TSRMLS_CC); + stream->filterhead->fops->flush(stream, stream->filterhead, closing TSRMLS_CC); if (stream->ops->flush) { return stream->ops->flush(stream TSRMLS_CC); @@ -440,7 +440,7 @@ if (stream->ops->seek) { if (stream->filterhead) - stream->filterhead->fops->flush(stream, stream->filterhead TSRMLS_CC); + stream->filterhead->fops->flush(stream, stream->filterhead, 0 TSRMLS_CC); return stream->ops->seek(stream, offset, whence TSRMLS_CC); }

« previous php.cvs (#13655) next »