summaryrefslogtreecommitdiff
path: root/main/streams
diff options
context:
space:
mode:
Diffstat (limited to 'main/streams')
-rw-r--r--main/streams/cast.c18
-rw-r--r--main/streams/filter.c4
-rwxr-xr-xmain/streams/glob_wrapper.c4
-rw-r--r--main/streams/memory.c4
-rw-r--r--main/streams/mmap.c4
-rw-r--r--main/streams/php_stream_context.h4
-rw-r--r--main/streams/php_stream_filter_api.h4
-rwxr-xr-xmain/streams/php_stream_glob_wrapper.h4
-rw-r--r--main/streams/php_stream_mmap.h4
-rw-r--r--main/streams/php_stream_plain_wrapper.h4
-rw-r--r--main/streams/php_stream_transport.h4
-rw-r--r--main/streams/php_stream_userspace.h4
-rw-r--r--main/streams/php_streams_int.h4
-rw-r--r--main/streams/plain_wrapper.c4
-rwxr-xr-xmain/streams/streams.c9
-rw-r--r--main/streams/transports.c4
-rw-r--r--main/streams/userspace.c5
-rw-r--r--main/streams/xp_socket.c4
18 files changed, 47 insertions, 45 deletions
diff --git a/main/streams/cast.c b/main/streams/cast.c
index 1dcfba00c..e7bb4308a 100644
--- a/main/streams/cast.c
+++ b/main/streams/cast.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cast.c 307611 2011-01-20 06:32:59Z pajoye $ */
+/* $Id: cast.c 321634 2012-01-01 13:15:04Z felipe $ */
#define _GNU_SOURCE
#include "php.h"
@@ -271,15 +271,15 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show
newstream = php_stream_fopen_tmpfile();
if (newstream) {
- int retval = php_stream_copy_to_stream_ex(stream, newstream, PHP_STREAM_COPY_ALL, NULL);
+ size_t retcopy = php_stream_copy_to_stream_ex(stream, newstream, PHP_STREAM_COPY_ALL, NULL);
- if (ret != SUCCESS) {
+ if (retcopy != SUCCESS) {
php_stream_close(newstream);
} else {
- int retcode = php_stream_cast(newstream, castas | flags, (void **)ret, show_err);
+ int retcast = php_stream_cast(newstream, castas | flags, (void **)ret, show_err);
- if (retcode == SUCCESS) {
- rewind(*(FILE**)retval);
+ if (retcast == SUCCESS) {
+ rewind(*(FILE**)ret);
}
/* do some specialized cleanup */
@@ -287,7 +287,9 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show
php_stream_free(stream, PHP_STREAM_FREE_CLOSE_CASTED);
}
- return retcode;
+ /* TODO: we probably should be setting .stdiocast and .fclose_stdiocast or
+ * we may be leaking the FILE*. Needs investigation, though. */
+ return retcast;
}
}
}
diff --git a/main/streams/filter.c b/main/streams/filter.c
index 90cebf659..8c4f0a03d 100644
--- a/main/streams/filter.c
+++ b/main/streams/filter.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: filter.c 314641 2011-08-09 12:16:58Z laruence $ */
+/* $Id: filter.c 321634 2012-01-01 13:15:04Z felipe $ */
#include "php.h"
#include "php_globals.h"
diff --git a/main/streams/glob_wrapper.c b/main/streams/glob_wrapper.c
index 67bceb2ca..a43397498 100755
--- a/main/streams/glob_wrapper.c
+++ b/main/streams/glob_wrapper.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: glob_wrapper.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: glob_wrapper.c 321634 2012-01-01 13:15:04Z felipe $ */
#include "php.h"
#include "php_streams_int.h"
diff --git a/main/streams/memory.c b/main/streams/memory.c
index aa338da2e..09820af86 100644
--- a/main/streams/memory.c
+++ b/main/streams/memory.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: memory.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: memory.c 321634 2012-01-01 13:15:04Z felipe $ */
#define _GNU_SOURCE
#include "php.h"
diff --git a/main/streams/mmap.c b/main/streams/mmap.c
index de8a3d2eb..58aa06f9f 100644
--- a/main/streams/mmap.c
+++ b/main/streams/mmap.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mmap.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: mmap.c 321634 2012-01-01 13:15:04Z felipe $ */
/* Memory Mapping interface for streams */
#include "php.h"
diff --git a/main/streams/php_stream_context.h b/main/streams/php_stream_context.h
index 10f5a7906..5bc4aeb90 100644
--- a/main/streams/php_stream_context.h
+++ b/main/streams/php_stream_context.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_stream_context.h 309927 2011-04-03 21:46:52Z pierrick $ */
+/* $Id: php_stream_context.h 321634 2012-01-01 13:15:04Z felipe $ */
/* Stream context and status notification related definitions */
diff --git a/main/streams/php_stream_filter_api.h b/main/streams/php_stream_filter_api.h
index ef3e73ee3..21bdda4b3 100644
--- a/main/streams/php_stream_filter_api.h
+++ b/main/streams/php_stream_filter_api.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_stream_filter_api.h 309927 2011-04-03 21:46:52Z pierrick $ */
+/* $Id: php_stream_filter_api.h 321634 2012-01-01 13:15:04Z felipe $ */
/* The filter API works on the principle of "Bucket-Brigades". This is
* partially inspired by the Apache 2 method of doing things, although
diff --git a/main/streams/php_stream_glob_wrapper.h b/main/streams/php_stream_glob_wrapper.h
index f55245bb0..18178286b 100755
--- a/main/streams/php_stream_glob_wrapper.h
+++ b/main/streams/php_stream_glob_wrapper.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_stream_glob_wrapper.h 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: php_stream_glob_wrapper.h 321634 2012-01-01 13:15:04Z felipe $ */
PHPAPI extern php_stream_wrapper php_glob_stream_wrapper;
PHPAPI extern php_stream_ops php_glob_stream_ops;
diff --git a/main/streams/php_stream_mmap.h b/main/streams/php_stream_mmap.h
index 242b43e05..6d9ee869a 100644
--- a/main/streams/php_stream_mmap.h
+++ b/main/streams/php_stream_mmap.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_stream_mmap.h 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: php_stream_mmap.h 321634 2012-01-01 13:15:04Z felipe $ */
/* Memory Mapping interface for streams.
* The intention is to provide a uniform interface over the most common
diff --git a/main/streams/php_stream_plain_wrapper.h b/main/streams/php_stream_plain_wrapper.h
index 2d64fec19..2074f5b22 100644
--- a/main/streams/php_stream_plain_wrapper.h
+++ b/main/streams/php_stream_plain_wrapper.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_stream_plain_wrapper.h 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: php_stream_plain_wrapper.h 321634 2012-01-01 13:15:04Z felipe $ */
/* definitions for the plain files wrapper */
diff --git a/main/streams/php_stream_transport.h b/main/streams/php_stream_transport.h
index e14ac1023..6d79c97a4 100644
--- a/main/streams/php_stream_transport.h
+++ b/main/streams/php_stream_transport.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_stream_transport.h 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: php_stream_transport.h 321634 2012-01-01 13:15:04Z felipe $ */
#ifdef PHP_WIN32
#include "config.w32.h"
#include <Ws2tcpip.h>
diff --git a/main/streams/php_stream_userspace.h b/main/streams/php_stream_userspace.h
index 08a66e50e..ff54d08db 100644
--- a/main/streams/php_stream_userspace.h
+++ b/main/streams/php_stream_userspace.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_stream_userspace.h 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: php_stream_userspace.h 321634 2012-01-01 13:15:04Z felipe $ */
/* for user-space streams */
diff --git a/main/streams/php_streams_int.h b/main/streams/php_streams_int.h
index 168614ea1..cd58a0701 100644
--- a/main/streams/php_streams_int.h
+++ b/main/streams/php_streams_int.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_streams_int.h 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: php_streams_int.h 321634 2012-01-01 13:15:04Z felipe $ */
#if ZEND_DEBUG
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index 01fb7111c..c4fb17252 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: plain_wrapper.c 308011 2011-02-04 10:47:41Z aharvey $ */
+/* $Id: plain_wrapper.c 321634 2012-01-01 13:15:04Z felipe $ */
#include "php.h"
#include "php_globals.h"
diff --git a/main/streams/streams.c b/main/streams/streams.c
index be2745cb8..3638dff74 100755
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streams.c 312937 2011-07-05 16:09:06Z cataphract $ */
+/* $Id: streams.c 321634 2012-01-01 13:15:04Z felipe $ */
#define _GNU_SOURCE
#include "php.h"
@@ -918,9 +918,8 @@ PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *re
just_read = (stream->writepos - stream->readpos) - len;
len += just_read;
- /* read operation have less data than request; assume the stream is
- * temporarily or permanently out of data */
- if (just_read < toread) {
+ /* Assume the stream is temporarily or permanently out of data */
+ if (just_read == 0) {
break;
}
}
diff --git a/main/streams/transports.c b/main/streams/transports.c
index 3c75bde80..9431f6a39 100644
--- a/main/streams/transports.c
+++ b/main/streams/transports.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: transports.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: transports.c 321634 2012-01-01 13:15:04Z felipe $ */
#include "php.h"
#include "php_streams_int.h"
diff --git a/main/streams/userspace.c b/main/streams/userspace.c
index 98371ea64..bc9ff71ba 100644
--- a/main/streams/userspace.c
+++ b/main/streams/userspace.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: userspace.c 307934 2011-02-01 22:55:17Z cataphract $ */
+/* $Id: userspace.c 321634 2012-01-01 13:15:04Z felipe $ */
#include "php.h"
#include "php_globals.h"
@@ -863,6 +863,7 @@ static int statbuf_from_array(zval *array, php_stream_statbuf *ssb TSRMLS_DC)
#define STAT_PROP_ENTRY(name) STAT_PROP_ENTRY_EX(name,name)
+ memset(ssb, 0, sizeof(php_stream_statbuf));
STAT_PROP_ENTRY(dev);
STAT_PROP_ENTRY(ino);
STAT_PROP_ENTRY(mode);
diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c
index 9d0859d5a..bfd05011e 100644
--- a/main/streams/xp_socket.c
+++ b/main/streams/xp_socket.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xp_socket.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: xp_socket.c 321634 2012-01-01 13:15:04Z felipe $ */
#include "php.h"
#include "ext/standard/file.h"