jani Tue, 19 Jan 2010 13:44:08 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=293732
Log:
- Fixed bug #50791 (Compile failure: Bad logic in defining fopencookie
emulation)
Bug: http://bugs.php.net/50791 (Assigned) Bad logic in defining fopencookie
emulation
Changed paths:
U php/php-src/branches/PHP_5_2/NEWS
U php/php-src/branches/PHP_5_2/ext/curl/streams.c
U php/php-src/branches/PHP_5_2/main/streams/cast.c
U php/php-src/branches/PHP_5_3/ext/curl/streams.c
U php/php-src/branches/PHP_5_3/main/streams/cast.c
U php/php-src/trunk/ext/curl/streams.c
U php/php-src/trunk/main/streams/cast.c
Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS 2010-01-19 13:28:26 UTC (rev 293731)
+++ php/php-src/branches/PHP_5_2/NEWS 2010-01-19 13:44:08 UTC (rev 293732)
@@ -13,6 +13,8 @@
- Fixed build of mysqli with MySQL 5.5.0-m2. (Andrey)
+- Fixed bug #50791 (Compile failure: Bad logic in defining fopencookie
+ emulation). (Jani)
- Fixed bug #50787 (stream_set_write_buffer() has no effect on socket
streams). (vnegrier at optilian dot com, Ilia)
- Fixed bug #50761 (system.multiCall crashes in xmlrpc extension). (hiroaki
Modified: php/php-src/branches/PHP_5_2/ext/curl/streams.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/curl/streams.c 2010-01-19 13:28:26 UTC (rev 293731)
+++ php/php-src/branches/PHP_5_2/ext/curl/streams.c 2010-01-19 13:44:08 UTC (rev 293732)
@@ -277,7 +277,7 @@
* have a FILE* associated with it.
* Otherwise, use the "smart" memory stream that will turn itself into a file
* when it gets large */
-#if !HAVE_FOPENCOOKIE
+#ifndef HAVE_FOPENCOOKIE
if (options & STREAM_WILL_CAST) {
curlstream->readbuffer.buf = php_stream_fopen_tmpfile();
} else
@@ -442,7 +442,7 @@
php_stream_to_zval(curlstream->readbuffer.buf, tmp);
add_assoc_zval(stream->wrapperdata, "readbuf", tmp);
-#if !HAVE_FOPENCOOKIE
+#ifndef HAVE_FOPENCOOKIE
if (options & STREAM_WILL_CAST) {
/* we will need to download the whole resource now,
* since we cannot get the actual FD for the download,
Modified: php/php-src/branches/PHP_5_2/main/streams/cast.c
===================================================================
--- php/php-src/branches/PHP_5_2/main/streams/cast.c 2010-01-19 13:28:26 UTC (rev 293731)
+++ php/php-src/branches/PHP_5_2/main/streams/cast.c 2010-01-19 13:44:08 UTC (rev 293732)
@@ -30,7 +30,7 @@
#include "php_streams_int.h"
/* Under BSD, emulate fopencookie using funopen */
-#if HAVE_FUNOPEN
+#if defined(HAVE_FUNOPEN) && !defined(HAVE_FOPENCOOKIE)
typedef struct {
int (*reader)(void *, char *, int);
int (*writer)(void *, const char *, int);
@@ -43,13 +43,14 @@
return funopen(cookie, funcs->reader, funcs->writer, funcs->seeker, funcs->closer);
}
# define HAVE_FOPENCOOKIE 1
+# define PHP_EMULATE_FOPENCOOKIE 1
# define PHP_STREAM_COOKIE_FUNCTIONS &stream_cookie_functions
-#elif HAVE_FOPENCOOKIE
+#elif defined(HAVE_FOPENCOOKIE)
# define PHP_STREAM_COOKIE_FUNCTIONS stream_cookie_functions
#endif
/* {{{ STDIO with fopencookie */
-#if HAVE_FUNOPEN
+#if defined(PHP_EMULATE_FOPENCOOKIE)
/* use our fopencookie emulation */
static int stream_cookie_reader(void *cookie, char *buffer, int size)
{
@@ -83,8 +84,7 @@
stream->fclose_stdiocast = PHP_STREAM_FCLOSE_NONE;
return php_stream_close(stream);
}
-
-#elif HAVE_FOPENCOOKIE
+#elif defined(HAVE_FOPENCOOKIE)
static ssize_t stream_cookie_reader(void *cookie, char *buffer, size_t size)
{
ssize_t ret;
@@ -101,7 +101,7 @@
return php_stream_write(((php_stream *)cookie), (char *)buffer, size);
}
-#ifdef COOKIE_SEEKER_USES_OFF64_T
+# ifdef COOKIE_SEEKER_USES_OFF64_T
static int stream_cookie_seeker(void *cookie, __off64_t *position, int whence)
{
TSRMLS_FETCH();
@@ -113,14 +113,14 @@
}
return 0;
}
-#else
+# else
static int stream_cookie_seeker(void *cookie, off_t position, int whence)
{
TSRMLS_FETCH();
return php_stream_seek((php_stream *)cookie, position, whence);
}
-#endif
+# endif
static int stream_cookie_closer(void *cookie)
{
@@ -131,7 +131,7 @@
stream->fclose_stdiocast = PHP_STREAM_FCLOSE_NONE;
return php_stream_close(stream);
}
-#endif /* elif HAVE_FOPENCOOKIE */
+#endif /* elif defined(HAVE_FOPENCOOKIE) */
#if HAVE_FOPENCOOKIE
static COOKIE_IO_FUNCTIONS_T stream_cookie_functions =
Modified: php/php-src/branches/PHP_5_3/ext/curl/streams.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/curl/streams.c 2010-01-19 13:28:26 UTC (rev 293731)
+++ php/php-src/branches/PHP_5_3/ext/curl/streams.c 2010-01-19 13:44:08 UTC (rev 293732)
@@ -280,7 +280,7 @@
* have a FILE* associated with it.
* Otherwise, use the "smart" memory stream that will turn itself into a file
* when it gets large */
-#if !HAVE_FOPENCOOKIE
+#ifndef HAVE_FOPENCOOKIE
if (options & STREAM_WILL_CAST) {
curlstream->readbuffer.buf = php_stream_fopen_tmpfile();
} else
@@ -445,7 +445,7 @@
php_stream_to_zval(curlstream->readbuffer.buf, tmp);
add_assoc_zval(stream->wrapperdata, "readbuf", tmp);
-#if !HAVE_FOPENCOOKIE
+#ifndef HAVE_FOPENCOOKIE
if (options & STREAM_WILL_CAST) {
/* we will need to download the whole resource now,
* since we cannot get the actual FD for the download,
Modified: php/php-src/branches/PHP_5_3/main/streams/cast.c
===================================================================
--- php/php-src/branches/PHP_5_3/main/streams/cast.c 2010-01-19 13:28:26 UTC (rev 293731)
+++ php/php-src/branches/PHP_5_3/main/streams/cast.c 2010-01-19 13:44:08 UTC (rev 293732)
@@ -30,7 +30,7 @@
#include "php_streams_int.h"
/* Under BSD, emulate fopencookie using funopen */
-#if HAVE_FUNOPEN
+#if defined(HAVE_FUNOPEN) && !defined(HAVE_FOPENCOOKIE)
typedef struct {
int (*reader)(void *, char *, int);
int (*writer)(void *, const char *, int);
@@ -43,13 +43,14 @@
return funopen(cookie, funcs->reader, funcs->writer, funcs->seeker, funcs->closer);
}
# define HAVE_FOPENCOOKIE 1
+# define PHP_EMULATE_FOPENCOOKIE 1
# define PHP_STREAM_COOKIE_FUNCTIONS &stream_cookie_functions
-#elif HAVE_FOPENCOOKIE
+#elif defined(HAVE_FOPENCOOKIE)
# define PHP_STREAM_COOKIE_FUNCTIONS stream_cookie_functions
#endif
/* {{{ STDIO with fopencookie */
-#if HAVE_FUNOPEN
+#if defined(PHP_EMULATE_FOPENCOOKIE)
/* use our fopencookie emulation */
static int stream_cookie_reader(void *cookie, char *buffer, int size)
{
@@ -83,8 +84,7 @@
stream->fclose_stdiocast = PHP_STREAM_FCLOSE_NONE;
return php_stream_close(stream);
}
-
-#elif HAVE_FOPENCOOKIE
+#elif defined(HAVE_FOPENCOOKIE)
static ssize_t stream_cookie_reader(void *cookie, char *buffer, size_t size)
{
ssize_t ret;
@@ -101,7 +101,7 @@
return php_stream_write(((php_stream *)cookie), (char *)buffer, size);
}
-#ifdef COOKIE_SEEKER_USES_OFF64_T
+# ifdef COOKIE_SEEKER_USES_OFF64_T
static int stream_cookie_seeker(void *cookie, __off64_t *position, int whence)
{
TSRMLS_FETCH();
@@ -113,14 +113,14 @@
}
return 0;
}
-#else
+# else
static int stream_cookie_seeker(void *cookie, off_t position, int whence)
{
TSRMLS_FETCH();
return php_stream_seek((php_stream *)cookie, position, whence);
}
-#endif
+# endif
static int stream_cookie_closer(void *cookie)
{
@@ -131,7 +131,7 @@
stream->fclose_stdiocast = PHP_STREAM_FCLOSE_NONE;
return php_stream_close(stream);
}
-#endif /* elif HAVE_FOPENCOOKIE */
+#endif /* elif defined(HAVE_FOPENCOOKIE) */
#if HAVE_FOPENCOOKIE
static COOKIE_IO_FUNCTIONS_T stream_cookie_functions =
Modified: php/php-src/trunk/ext/curl/streams.c
===================================================================
--- php/php-src/trunk/ext/curl/streams.c 2010-01-19 13:28:26 UTC (rev 293731)
+++ php/php-src/trunk/ext/curl/streams.c 2010-01-19 13:44:08 UTC (rev 293732)
@@ -280,7 +280,7 @@
* have a FILE* associated with it.
* Otherwise, use the "smart" memory stream that will turn itself into a file
* when it gets large */
-#if !HAVE_FOPENCOOKIE
+#ifndef HAVE_FOPENCOOKIE
if (options & STREAM_WILL_CAST) {
curlstream->readbuffer.buf = php_stream_fopen_tmpfile();
} else
@@ -445,7 +445,7 @@
php_stream_to_zval(curlstream->readbuffer.buf, tmp);
add_assoc_zval(stream->wrapperdata, "readbuf", tmp);
-#if !HAVE_FOPENCOOKIE
+#ifndef HAVE_FOPENCOOKIE
if (options & STREAM_WILL_CAST) {
/* we will need to download the whole resource now,
* since we cannot get the actual FD for the download,
Modified: php/php-src/trunk/main/streams/cast.c
===================================================================
--- php/php-src/trunk/main/streams/cast.c 2010-01-19 13:28:26 UTC (rev 293731)
+++ php/php-src/trunk/main/streams/cast.c 2010-01-19 13:44:08 UTC (rev 293732)
@@ -30,7 +30,7 @@
#include "php_streams_int.h"
/* Under BSD, emulate fopencookie using funopen */
-#if HAVE_FUNOPEN
+#if defined(HAVE_FUNOPEN) && !defined(HAVE_FOPENCOOKIE)
typedef struct {
int (*reader)(void *, char *, int);
int (*writer)(void *, const char *, int);
@@ -43,13 +43,14 @@
return funopen(cookie, funcs->reader, funcs->writer, funcs->seeker, funcs->closer);
}
# define HAVE_FOPENCOOKIE 1
+# define PHP_EMULATE_FOPENCOOKIE 1
# define PHP_STREAM_COOKIE_FUNCTIONS &stream_cookie_functions
-#elif HAVE_FOPENCOOKIE
+#elif defined(HAVE_FOPENCOOKIE)
# define PHP_STREAM_COOKIE_FUNCTIONS stream_cookie_functions
#endif
/* {{{ STDIO with fopencookie */
-#if HAVE_FUNOPEN
+#if defined(PHP_EMULATE_FOPENCOOKIE)
/* use our fopencookie emulation */
static int stream_cookie_reader(void *cookie, char *buffer, int size)
{
@@ -83,8 +84,7 @@
stream->fclose_stdiocast = PHP_STREAM_FCLOSE_NONE;
return php_stream_close(stream);
}
-
-#elif HAVE_FOPENCOOKIE
+#elif defined(HAVE_FOPENCOOKIE)
static ssize_t stream_cookie_reader(void *cookie, char *buffer, size_t size)
{
ssize_t ret;
@@ -101,7 +101,7 @@
return php_stream_write(((php_stream *)cookie), (char *)buffer, size);
}
-#ifdef COOKIE_SEEKER_USES_OFF64_T
+# ifdef COOKIE_SEEKER_USES_OFF64_T
static int stream_cookie_seeker(void *cookie, __off64_t *position, int whence)
{
TSRMLS_FETCH();
@@ -113,14 +113,14 @@
}
return 0;
}
-#else
+# else
static int stream_cookie_seeker(void *cookie, off_t position, int whence)
{
TSRMLS_FETCH();
return php_stream_seek((php_stream *)cookie, position, whence);
}
-#endif
+# endif
static int stream_cookie_closer(void *cookie)
{
@@ -131,7 +131,7 @@
stream->fclose_stdiocast = PHP_STREAM_FCLOSE_NONE;
return php_stream_close(stream);
}
-#endif /* elif HAVE_FOPENCOOKIE */
+#endif /* elif defined(HAVE_FOPENCOOKIE) */
#if HAVE_FOPENCOOKIE
static COOKIE_IO_FUNCTIONS_T stream_cookie_functions =
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php