cvs: php-src / NEWS /ext/standard streamsfuncs.c

From: Date: Fri, 17 Jun 2005 23:29:21 +0000
Subject: cvs: php-src / NEWS /ext/standard streamsfuncs.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-32358@lists.php.net to get a copy of this message
iliaa Fri Jun 17 19:29:21 2005 EDT Modified files: /php-src NEWS /php-src/ext/standard streamsfuncs.c Log: Added offset parameter to the stream_copy_to_stream() function. http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1927&r2=1.1928&ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1927 php-src/NEWS:1.1928 --- php-src/NEWS:1.1927 Fri Jun 17 12:24:01 2005 +++ php-src/NEWS Fri Jun 17 19:29:19 2005 @@ -9,6 +9,7 @@ - Rewrote strtotime() with support for timezones and tons of new formats. (Derick) - Added bindto socket context option. (Ilia) +- Added offset parameter to the stream_copy_to_stream() function. (Ilia) - Fixed PDO shutdown problem (possible inifite loop running rollback on shutdown). (Wez) - Fixed PECL bug #3714 (beginTransaction doesn't work if you're in http://cvs.php.net/diff.php/php-src/ext/standard/streamsfuncs.c?r1=1.55&r2=1.56&ty=u Index: php-src/ext/standard/streamsfuncs.c diff -u php-src/ext/standard/streamsfuncs.c:1.55 php-src/ext/standard/streamsfuncs.c:1.56 --- php-src/ext/standard/streamsfuncs.c:1.55 Mon Mar 28 23:02:03 2005 +++ php-src/ext/standard/streamsfuncs.c Fri Jun 17 19:29:20 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: streamsfuncs.c,v 1.55 2005/03/29 04:02:03 pollita Exp $ */ +/* $Id: streamsfuncs.c,v 1.56 2005/06/17 23:29:20 iliaa Exp $ */ #include "php.h" #include "php_globals.h" @@ -422,21 +422,26 @@ } /* }}} */ -/* {{{ proto long stream_copy_to_stream(resource source, resource dest [, long maxlen ]) +/* {{{ proto long stream_copy_to_stream(resource source, resource dest [, long maxlen [, long pos]]) Reads up to maxlen bytes from source stream and writes them to dest stream. */ PHP_FUNCTION(stream_copy_to_stream) { php_stream *src, *dest; zval *zsrc, *zdest; - long maxlen = PHP_STREAM_COPY_ALL; + long maxlen = PHP_STREAM_COPY_ALL, pos = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|l", &zsrc, &zdest, &maxlen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|ll", &zsrc, &zdest, &maxlen, &pos) == FAILURE) { RETURN_FALSE; } php_stream_from_zval(src, &zsrc); php_stream_from_zval(dest, &zdest); + if (pos > 0 && php_stream_seek(src, pos, SEEK_SET) < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to %ld position in the stream.", pos); + RETURN_FALSE; + } + RETURN_LONG(php_stream_copy_to_stream(src, dest, maxlen)); } /* }}} */

« previous php.cvs (#32358) next »