]> granicus.if.org Git - php/commitdiff
Fix [-Wundef] warning in streams implementation
authorGeorge Peter Banyard <girgias@php.net>
Tue, 12 May 2020 15:50:12 +0000 (17:50 +0200)
committerGeorge Peter Banyard <girgias@php.net>
Tue, 12 May 2020 20:01:20 +0000 (22:01 +0200)
main/streams/plain_wrapper.c
main/streams/xp_socket.c

index 2e9a17f0401e994954d7ef54224b7467beb6ad52..edde4121b8a50f26571b92ec395117b2e0124897 100644 (file)
@@ -133,11 +133,11 @@ typedef struct {
        int lock_flag;                  /* stores the lock state */
        zend_string *temp_name; /* if non-null, this is the path to a temporary file that
                                                         * is to be deleted when the stream is closed */
-#if HAVE_FLUSHIO
+#ifdef HAVE_FLUSHIO
        char last_op;
 #endif
 
-#if HAVE_MMAP
+#ifdef HAVE_MMAP
        char *last_mapped_addr;
        size_t last_mapped_len;
 #endif
@@ -358,7 +358,7 @@ static ssize_t php_stdiop_write(php_stream *stream, const char *buf, size_t coun
                return bytes_written;
        } else {
 
-#if HAVE_FLUSHIO
+#ifdef HAVE_FLUSHIO
                if (data->is_seekable && data->last_op == 'r') {
                        zend_fseek(data->file, 0, SEEK_CUR);
                }
@@ -433,7 +433,7 @@ static ssize_t php_stdiop_read(php_stream *stream, char *buf, size_t count)
                }
 
        } else {
-#if HAVE_FLUSHIO
+#ifdef HAVE_FLUSHIO
                if (data->is_seekable && data->last_op == 'w')
                        zend_fseek(data->file, 0, SEEK_CUR);
                data->last_op = 'r';
@@ -453,7 +453,7 @@ static int php_stdiop_close(php_stream *stream, int close_handle)
 
        assert(data != NULL);
 
-#if HAVE_MMAP
+#ifdef HAVE_MMAP
        if (data->last_mapped_addr) {
                munmap(data->last_mapped_addr, data->last_mapped_len);
                data->last_mapped_addr = NULL;
@@ -475,7 +475,7 @@ static int php_stdiop_close(php_stream *stream, int close_handle)
                                errno = 0;
                                ret = pclose(data->file);
 
-#if HAVE_SYS_WAIT_H
+#ifdef HAVE_SYS_WAIT_H
                                if (WIFEXITED(ret)) {
                                        ret = WEXITSTATUS(ret);
                                }
@@ -704,7 +704,7 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
                        break;
 
                case PHP_STREAM_OPTION_MMAP_API:
-#if HAVE_MMAP
+#ifdef HAVE_MMAP
                        {
                                php_stream_mmap_range *range = (php_stream_mmap_range*)ptrparam;
                                int prot, flags;
@@ -882,7 +882,7 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
                                                return PHP_STREAM_OPTION_RETURN_ERR;
                                        }
 
-#if defined(_WIN64)
+#ifdef _WIN64
                                        sz.QuadPart = new_size;
 #else
                                        sz.HighPart = 0;
@@ -1226,7 +1226,7 @@ static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_f
                        if (php_copy_file(url_from, url_to) == SUCCESS) {
                                if (VCWD_STAT(url_from, &sb) == 0) {
                                        success = 1;
-#  if !defined(TSRM_WIN32)
+#  ifndef TSRM_WIN32
                                        /*
                                         * Try to set user and permission info on the target.
                                         * If we're not root, then some of these may fail.
index c7cab6353f5af00324f59c4ca1a263a753561fbb..77b18fd2df6b8010f5884ee3173411b26e926c77 100644 (file)
@@ -23,7 +23,7 @@
 # undef AF_UNIX
 #endif
 
-#if defined(AF_UNIX)
+#ifdef AF_UNIX
 #include <sys/un.h>
 #endif
 
@@ -237,7 +237,7 @@ static int php_sockop_flush(php_stream *stream)
 
 static int php_sockop_stat(php_stream *stream, php_stream_statbuf *ssb)
 {
-#if ZEND_WIN32
+#ifdef ZEND_WIN32
        return 0;
 #else
        php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract;