wez Tue Mar 18 10:15:10 2003 EDT Modified files: /php4/ext/openssl xp_ssl.c /php4/main/streams xp_socket.c Log: avoid unsigned issues. Index: php4/ext/openssl/xp_ssl.c diff -u php4/ext/openssl/xp_ssl.c:1.4 php4/ext/openssl/xp_ssl.c:1.5 --- php4/ext/openssl/xp_ssl.c:1.4 Fri Feb 28 14:53:20 2003 +++ php4/ext/openssl/xp_ssl.c Tue Mar 18 10:15:09 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xp_ssl.c,v 1.4 2003/02/28 19:53:20 wez Exp $ */ +/* $Id: xp_ssl.c,v 1.5 2003/03/18 15:15:09 wez Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -122,7 +122,7 @@ static size_t php_openssl_sockop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) { php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; - size_t didwrite; + int didwrite; if (sslsock->ssl_active) { int retry = 1; @@ -141,9 +141,14 @@ didwrite = php_stream_socket_ops.write(stream, buf, count TSRMLS_CC); } - if (didwrite > 0) + if (didwrite > 0) { php_stream_notify_progress_increment(stream->context, didwrite, 0); + } + if (didwrite < 0) { + didwrite = 0; + } + return didwrite; } @@ -174,8 +179,13 @@ nr_bytes = php_stream_socket_ops.read(stream, buf, count TSRMLS_CC); } - if (nr_bytes > 0) + if (nr_bytes > 0) { php_stream_notify_progress_increment(stream->context, nr_bytes, 0); + } + + if (nr_bytes < 0) { + nr_bytes = 0; + } return nr_bytes; } Index: php4/main/streams/xp_socket.c diff -u php4/main/streams/xp_socket.c:1.8 php4/main/streams/xp_socket.c:1.9 --- php4/main/streams/xp_socket.c:1.8 Sat Mar 15 08:29:56 2003 +++ php4/main/streams/xp_socket.c Tue Mar 18 10:15:10 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xp_socket.c,v 1.8 2003/03/15 13:29:56 wez Exp $ */ +/* $Id: xp_socket.c,v 1.9 2003/03/18 15:15:10 wez Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -46,7 +46,7 @@ static size_t php_sockop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) { php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; - size_t didwrite; + int didwrite; if (sock->socket == -1) { return 0; @@ -66,6 +66,10 @@ php_stream_notify_progress_increment(stream->context, didwrite, 0); } + if (didwrite < 0) { + didwrite = 0; + } + return didwrite; } @@ -124,8 +128,13 @@ stream->eof = 1; } - if (nr_bytes > 0) + if (nr_bytes > 0) { php_stream_notify_progress_increment(stream->context, nr_bytes, 0); + } + + if (nr_bytes < 0) { + nr_bytes = 0; + } return nr_bytes; }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php