]> granicus.if.org Git - php/commitdiff
- Fixed bug #50791 (Compile failure: Bad logic in defining fopencookie emulation
authorPierre Joye <pajoye@php.net>
Wed, 3 Feb 2010 20:49:03 +0000 (20:49 +0000)
committerPierre Joye <pajoye@php.net>
Wed, 3 Feb 2010 20:49:03 +0000 (20:49 +0000)
ext/curl/streams.c
main/streams/cast.c

index 27f49ca313e0e3436b644e0934cfbc6bcd51e806..ce09b8ab6d64dc0bc6a097db6841a9298dd9de13 100644 (file)
@@ -280,7 +280,7 @@ php_stream *php_curl_stream_opener(php_stream_wrapper *wrapper, char *filename,
         * 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 *php_curl_stream_opener(php_stream_wrapper *wrapper, char *filename,
        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,
index 1e5472de967f79fc92bb7f2738205c0499613060..70565810f91b463f6f0ee33cdf53d18af4307091 100644 (file)
@@ -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 @@ FILE *fopencookie(void *cookie, const char *mode, COOKIE_IO_FUNCTIONS_T *funcs)
        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)
 {
@@ -80,8 +81,7 @@ static int stream_cookie_closer(void *cookie)
        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;
@@ -96,7 +96,7 @@ static ssize_t stream_cookie_writer(void *cookie, const char *buffer, size_t siz
        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();
@@ -107,13 +107,13 @@ static int stream_cookie_seeker(void *cookie, __off64_t *position, int whence)
                return -1;
        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)
 {
@@ -124,7 +124,7 @@ static int stream_cookie_closer(void *cookie)
        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 =