]> granicus.if.org Git - php/commitdiff
WIN64 support
authorDmitry Stogov <dmitry@php.net>
Mon, 16 Apr 2007 09:43:53 +0000 (09:43 +0000)
committerDmitry Stogov <dmitry@php.net>
Mon, 16 Apr 2007 09:43:53 +0000 (09:43 +0000)
24 files changed:
TSRM/TSRM.h
TSRM/tsrm_win32.c
Zend/zend_API.c
Zend/zend_API.h
Zend/zend_alloc.c
Zend/zend_builtin_functions.c
Zend/zend_compile.c
Zend/zend_execute.c
Zend/zend_execute.h
Zend/zend_execute_API.c
Zend/zend_ini.c
Zend/zend_opcode.c
Zend/zend_types.h
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
ext/standard/file.c
ext/standard/ftp_fopen_wrapper.c
ext/standard/proc_open.c
main/SAPI.c
main/main.c
main/php_ini.c
main/streams/plain_wrapper.c
win32/build/config.w32
win32/select.c

index 5e3411b8f7500920698a4e1ae772cdca2b4a3bed..db24798be1eaf8875bb1afbea3825a4469082aed 100644 (file)
 #      define TSRM_API
 #endif
 
+#ifdef _WIN64
+typedef unsigned __int64 tsrm_intptr_t;
+typedef __int64 tsrm_uintptr_t;
+#else
+typedef long tsrm_intptr_t;
+typedef unsigned long tsrm_uintptr_t;
+#endif
+
 /* Only compile multi-threading functions if we're in ZTS mode */
 #ifdef ZTS
 
index ae9ea312f2450f0f729e86a81ecf569fb8d32fb5..f6d0c790102d8fa25d5a652454df70b4f3d73a61 100644 (file)
@@ -228,10 +228,10 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
        proc = process_get(NULL TSRMLS_CC);
 
        if (read) {
-               fno = _open_osfhandle((long)in, _O_RDONLY | mode);
+               fno = _open_osfhandle((tsrm_intptr_t)in, _O_RDONLY | mode);
                CloseHandle(out);
        } else {
-               fno = _open_osfhandle((long)out, _O_WRONLY | mode);
+               fno = _open_osfhandle((tsrm_intptr_t)out, _O_WRONLY | mode);
                CloseHandle(in);
        }
 
index 0d0825edde32fbe99226d7b242e386a0548fa071..3d46f5cb8e3a83b38814ecb2a043ff922b3bc353 100644 (file)
@@ -44,7 +44,7 @@ ZEND_API int zend_get_parameters(int ht, int param_count, ...)
        TSRMLS_FETCH();
 
        p = EG(argument_stack).top_element-2;
-       arg_count = (ulong) *p;
+       arg_count = (int)(zend_uintptr_t) *p;
 
        if (param_count>arg_count) {
                return FAILURE;
@@ -82,7 +82,7 @@ ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument
        zval *param_ptr;
 
        p = EG(argument_stack).top_element-2;
-       arg_count = (ulong) *p;
+       arg_count = (int)(zend_uintptr_t) *p;
 
        if (param_count>arg_count) {
                return FAILURE;
@@ -122,7 +122,7 @@ ZEND_API int zend_get_parameters_ex(int param_count, ...)
        TSRMLS_FETCH();
 
        p = EG(argument_stack).top_element-2;
-       arg_count = (ulong) *p;
+       arg_count = (int)(zend_uintptr_t) *p;
 
        if (param_count>arg_count) {
                return FAILURE;
@@ -145,7 +145,7 @@ ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_arr
        int arg_count;
 
        p = EG(argument_stack).top_element-2;
-       arg_count = (ulong) *p;
+       arg_count = (int)(zend_uintptr_t) *p;
 
        if (param_count>arg_count) {
                return FAILURE;
@@ -168,7 +168,7 @@ ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array TS
        int arg_count;
 
        p = EG(argument_stack).top_element-2;
-       arg_count = (ulong) *p;
+       arg_count = (int)(zend_uintptr_t) *p;
 
        if (param_count>arg_count) {
                return FAILURE;
@@ -957,7 +957,7 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl
                return FAILURE;
        }
 
-       arg_count = (ulong) *(EG(argument_stack).top_element-2);
+       arg_count = (int)(zend_uintptr_t) *(EG(argument_stack).top_element-2);
 
        if (num_args > arg_count) {
                zend_error(E_WARNING, "%v(): could not obtain parameters for parsing",
@@ -1238,7 +1238,7 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC
                                zend_update_class_constants(class_type->parent TSRMLS_CC);
                        }
 #if ZTS
-                       ALLOC_HASHTABLE(CG(static_members)[(long)(class_type->static_members)]);
+                       ALLOC_HASHTABLE(CG(static_members)[(zend_intptr_t)(class_type->static_members)]);
 #else
                        ALLOC_HASHTABLE(class_type->static_members);
 #endif
index 88c73fc1084e14ec8699862362de169870379913..ec164a9954fa47aefc79debf5379aab5d1b59a3d 100644 (file)
@@ -170,7 +170,7 @@ typedef struct _zend_function_entry {
        INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, sizeof(class_name)-1, functions, handle_fcall, handle_propget, handle_propset, NULL, NULL)
 
 #ifdef ZTS
-#      define CE_STATIC_MEMBERS(ce) (((ce)->type==ZEND_USER_CLASS)?(ce)->static_members:CG(static_members)[(long)(ce)->static_members])
+#      define CE_STATIC_MEMBERS(ce) (((ce)->type==ZEND_USER_CLASS)?(ce)->static_members:CG(static_members)[(zend_intptr_t)(ce)->static_members])
 #else
 #      define CE_STATIC_MEMBERS(ce) ((ce)->static_members)
 #endif
index 35d4839b08d327691e102f80227af0a2424da476..6fce6d704ac54b656cb6affdfd543f5577476309 100644 (file)
 # define ZEND_MM_COOKIES ZEND_DEBUG
 #endif
 
+#ifdef _WIN64
+# define PTR_FMT "0x%0.16I64x"
+/*
+#elif sizeof(long) == 8
+# define PTR_FMT "0x%0.16lx"
+*/
+#else
+# define PTR_FMT "0x%0.8lx"
+#endif
+
 #if ZEND_DEBUG
 void zend_debug_alloc_output(char *format, ...)
 {
@@ -1178,7 +1188,7 @@ static void zend_mm_check_leaks(zend_mm_heap *heap)
                                repeated = zend_mm_find_leaks(segment, p);
                                total += 1 + repeated;
                                if (repeated) {
-                                       zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)repeated);
+                                       zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated);
                                }
 #if ZEND_MM_CACHE
                        } else if (p->magic == MEM_BLOCK_CACHED) {
@@ -1219,7 +1229,7 @@ static int zend_mm_check_ptr(zend_mm_heap *heap, void *ptr, int silent ZEND_FILE
        if (!silent) {
                zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL);
                zend_debug_alloc_output("---------------------------------------\n");
-               zend_debug_alloc_output("%s(%d) : Block 0x%0.8lX status:\n" ZEND_FILE_LINE_RELAY_CC, (long) ptr);
+               zend_debug_alloc_output("%s(%d) : Block "PTR_FMT" status:\n" ZEND_FILE_LINE_RELAY_CC, ptr);
                if (__zend_orig_filename) {
                        zend_debug_alloc_output("%s(%d) : Actual location (location was relayed)\n" ZEND_FILE_LINE_ORIG_RELAY_CC);
                }
@@ -1251,7 +1261,7 @@ static int zend_mm_check_ptr(zend_mm_heap *heap, void *ptr, int silent ZEND_FILE
 
        if (p->info._size != ZEND_MM_NEXT_BLOCK(p)->info._prev) {
                if (!silent) {
-                       zend_debug_alloc_output("Invalid pointer: ((size=0x%0.8X) != (next.prev=0x%0.8X))\n", p->info._size, ZEND_MM_NEXT_BLOCK(p)->info._prev);
+                       zend_debug_alloc_output("Invalid pointer: ((size="PTR_FMT") != (next.prev="PTR_FMT"))\n", p->info._size, ZEND_MM_NEXT_BLOCK(p)->info._prev);
                        had_problems = 1;
                } else {
                        return zend_mm_check_ptr(heap, ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
@@ -1260,7 +1270,7 @@ static int zend_mm_check_ptr(zend_mm_heap *heap, void *ptr, int silent ZEND_FILE
        if (p->info._prev != ZEND_MM_GUARD_BLOCK &&
            ZEND_MM_PREV_BLOCK(p)->info._size != p->info._prev) {
                if (!silent) {
-                       zend_debug_alloc_output("Invalid pointer: ((prev=0x%0.8X) != (prev.size=0x%0.8X))\n", p->info._prev, ZEND_MM_PREV_BLOCK(p)->info._size);
+                       zend_debug_alloc_output("Invalid pointer: ((prev="PTR_FMT") != (prev.size="PTR_FMT"))\n", p->info._prev, ZEND_MM_PREV_BLOCK(p)->info._size);
                        had_problems = 1;
                } else {
                        return zend_mm_check_ptr(heap, ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
index 80b842b46facfa78f5a61e4efad9cc57ed422f9a..97fedfa18e3adbcd70c877f5fed2f430e8de2297 100644 (file)
@@ -171,14 +171,14 @@ ZEND_FUNCTION(func_num_args)
        int arg_count;
 
        p = EG(argument_stack).top_element-1-1;
-       arg_count = (ulong) *p;         /* this is the amount of arguments passed to func_num_args(); */
+       arg_count = (int)(zend_uintptr_t) *p;           /* this is the amount of arguments passed to func_num_args(); */
        p -= 1+arg_count;
        if (*p) {
                zend_error(E_ERROR, "func_num_args(): Can't be used as a function parameter");
        }
        --p;
        if (p>=EG(argument_stack).elements) {
-               RETURN_LONG((ulong) *p);
+               RETURN_LONG((long)(zend_uintptr_t) *p);
        } else {
                zend_error(E_WARNING, "func_num_args():  Called from the global scope - no function context");
                RETURN_LONG(-1);
@@ -209,7 +209,7 @@ ZEND_FUNCTION(func_get_arg)
        }
 
        p = EG(argument_stack).top_element-1-1;
-       arg_count = (ulong) *p;         /* this is the amount of arguments passed to func_get_arg(); */
+       arg_count = (int)(zend_uintptr_t) *p;           /* this is the amount of arguments passed to func_get_arg(); */
        p -= 1+arg_count;
        if (*p) {
                zend_error(E_ERROR, "func_get_arg(): Can't be used as a function parameter");
@@ -219,7 +219,7 @@ ZEND_FUNCTION(func_get_arg)
                zend_error(E_WARNING, "func_get_arg():  Called from the global scope - no function context");
                RETURN_FALSE;
        }
-       arg_count = (ulong) *p;
+       arg_count = (int)(zend_uintptr_t) *p;
 
        if (requested_offset>=arg_count) {
                zend_error(E_WARNING, "func_get_arg():  Argument %ld not passed to function", requested_offset);
@@ -243,7 +243,7 @@ ZEND_FUNCTION(func_get_args)
        int i;
 
        p = EG(argument_stack).top_element-1-1;
-       arg_count = (ulong) *p;         /* this is the amount of arguments passed to func_get_args(); */
+       arg_count = (int)(zend_uintptr_t) *p;           /* this is the amount of arguments passed to func_get_args(); */
        p -= 1+arg_count;
        if (*p) {
                zend_error(E_ERROR, "func_get_args(): Can't be used as a function parameter");
@@ -254,7 +254,7 @@ ZEND_FUNCTION(func_get_args)
                zend_error(E_WARNING, "func_get_args():  Called from the global scope - no function context");
                RETURN_FALSE;
        }
-       arg_count = (ulong) *p;
+       arg_count = (int)(zend_uintptr_t) *p;
 
 
        array_init(return_value);
@@ -1786,7 +1786,7 @@ static zval *debug_backtrace_get_args(void ***curpos TSRMLS_DC)
 {
        void **p = *curpos - 2;
        zval *arg_array, **arg;
-       int arg_count = (ulong) *p;
+       int arg_count = (int)(zend_uintptr_t) *p;
 
        *curpos -= (arg_count+2);
 
index 4191d059a618ff79911762c1e18739db9e8c1abb..40da0a4c58669058c418a4c3a8cc7c459dce8069 100644 (file)
@@ -4476,7 +4476,7 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify
                        CG(static_members) = realloc(CG(static_members), (n+1)*sizeof(HashTable*));
                        CG(static_members)[n] = NULL;
                }
-               ce->static_members = (HashTable*)n;
+               ce->static_members = (HashTable*)(zend_intptr_t)n;
 #else
                ce->static_members = NULL;
 #endif
index 901385e56f76fdcfa72463ba32a23c22ec2388f7..934a7898da93a37a50b443efa785b477e295a742 100644 (file)
@@ -105,15 +105,15 @@ static inline void zend_pzval_unlock_free_func(zval *z)
 
 #define FREE_OP(should_free) \
        if (should_free.var) { \
-               if ((long)should_free.var & 1L) { \
-                       zval_dtor((zval*)((long)should_free.var & ~1L)); \
+               if ((zend_uintptr_t)should_free.var & 1L) { \
+                       zval_dtor((zval*)((zend_uintptr_t)should_free.var & ~1L)); \
                } else { \
                        zval_ptr_dtor(&should_free.var); \
                } \
        }
 
 #define FREE_OP_IF_VAR(should_free) \
-       if (should_free.var != NULL && (((long)should_free.var & 1L) == 0)) { \
+       if (should_free.var != NULL && (((zend_uintptr_t)should_free.var & 1L) == 0)) { \
                zval_ptr_dtor(&should_free.var); \
        }
 
@@ -122,9 +122,9 @@ static inline void zend_pzval_unlock_free_func(zval *z)
                zval_ptr_dtor(&should_free.var); \
        }
 
-#define TMP_FREE(z) (zval*)(((long)(z)) | 1L)
+#define TMP_FREE(z) (zval*)(((zend_uintptr_t)(z)) | 1L)
 
-#define IS_TMP_FREE(should_free) ((long)should_free.var & 1L)
+#define IS_TMP_FREE(should_free) ((zend_uintptr_t)should_free.var & 1L)
 
 #define INIT_PZVAL_COPY(z,v) \
        (z)->value = (v)->value; \
index e9c0c398f9013ddf2b571733f4d886e0d281b8b2..0c23dee2129b56d8aaf2eca066e2174a601656ca 100644 (file)
@@ -156,7 +156,7 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco
 static inline void zend_ptr_stack_clear_multiple(TSRMLS_D)
 {
        void **p = EG(argument_stack).top_element-2;
-       int delete_count = (ulong) *p;
+       int delete_count = (int)(zend_uintptr_t) *p;
 
        EG(argument_stack).top -= (delete_count+2);
        while (--delete_count>=0) {
@@ -170,7 +170,7 @@ static inline void zend_ptr_stack_clear_multiple(TSRMLS_D)
 static inline int zend_ptr_stack_get_arg(int requested_arg, void **data TSRMLS_DC)
 {
        void **p = EG(argument_stack).top_element-2;
-       int arg_count = (ulong) *p;
+       int arg_count = (int)(zend_uintptr_t) *p;
 
        if (requested_arg>arg_count) {
                return FAILURE;
index f33b99d1cf4d3275295b8995a7d258a7e40bccd3..5e3bd2922698c9a0c62771b4624f03fbe4227e7c 100644 (file)
@@ -472,7 +472,7 @@ ZEND_API int zend_is_true(zval *op)
 ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC)
 {
        zval *p = *pp;
-       zend_bool inline_change = (zend_bool) (unsigned long) arg;
+       zend_bool inline_change = (zend_bool) (zend_uintptr_t) arg;
        zval const_value;
 
        if (Z_TYPE_P(p) == IS_CONSTANT) {
@@ -933,7 +933,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
                                if (fci->no_separation) {
                                        if(i) {
                                                /* hack to clean up the stack */
-                                               zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) (long) i, NULL);
+                                               zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) (zend_uintptr_t) i, NULL);
                                                zend_ptr_stack_clear_multiple(TSRMLS_C);
                                        }
                                        if (old_func_name) {
@@ -979,7 +979,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
                fci->param_count = 2;
        }
 
-       zend_ptr_stack_2_push(&EG(argument_stack), (void *) (long) fci->param_count, NULL);
+       zend_ptr_stack_2_push(&EG(argument_stack), (void *) (zend_uintptr_t) fci->param_count, NULL);
 
        original_function_state_ptr = EG(function_state_ptr);
        EG(function_state_ptr) = &EX(function_state);
index 962f9660bf5565a695a030ce0dd929809c1b59a2..c4915d6cd6fc051077fb31db40b78455d5f683df 100644 (file)
@@ -226,7 +226,7 @@ static int zend_ini_refresh_cache(zend_ini_entry *p, int stage TSRMLS_DC)
 
 ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC)
 {
-       zend_hash_apply_with_argument(EG(ini_directives), (apply_func_arg_t) zend_ini_refresh_cache, (void *)(long) stage TSRMLS_CC);
+       zend_hash_apply_with_argument(EG(ini_directives), (apply_func_arg_t) zend_ini_refresh_cache, (void *)(zend_uintptr_t) stage TSRMLS_CC);
 }
 #endif
 
index 4b57ed1657a5e9b301892150ea14d4caa247cc84..8455b16ab15cdd1d02ba304ea4f52e4c413327f8 100644 (file)
@@ -189,7 +189,7 @@ ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC)
                zend_hash_destroy(CE_STATIC_MEMBERS(*pce));
                FREE_HASHTABLE(CE_STATIC_MEMBERS(*pce));
 #ifdef ZTS
-               CG(static_members)[(long)((*pce)->static_members)] = NULL;
+               CG(static_members)[(zend_intptr_t)((*pce)->static_members)] = NULL;
 #else
                (*pce)->static_members = NULL;
 #endif
index b357a2075f3cc4d85d80c6610fd0f6d8de29e9e0..dad27860099256cb9d384f0183e9645f9707aaff 100644 (file)
@@ -28,6 +28,14 @@ typedef unsigned int zend_uint;
 typedef unsigned long zend_ulong;
 typedef unsigned short zend_ushort;
 
+#ifdef _WIN64
+typedef unsigned __int64 zend_intptr_t;
+typedef __int64 zend_uintptr_t;
+#else
+typedef long zend_intptr_t;
+typedef unsigned long zend_uintptr_t;
+#endif
+
 typedef unsigned int zend_object_handle;
 typedef struct _zend_object_handlers zend_object_handlers;
 
index f8ce0c186a4eac243aa22575097dbbe92b4a1f15..409f589f05566d316c52d95228b478b419023176 100644 (file)
@@ -1909,7 +1909,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
                }
        }
 
-       zend_ptr_stack_2_push(&EG(argument_stack), (void *) opline->extended_value, NULL);
+       zend_ptr_stack_2_push(&EG(argument_stack), (void *)(zend_uintptr_t)opline->extended_value, NULL);
 
        EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
 
@@ -1953,7 +1953,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
                        ulong arg_count;
 
                        p = (zval **) EG(argument_stack).top_element-2;
-                       arg_count = (ulong) *p;
+                       arg_count = (ulong)(zend_uintptr_t) *p;
 
                        while (arg_count>0) {
                                zend_verify_arg_type(EX(function_state).function, ++i, *(p-arg_count) TSRMLS_CC);
index 3f757c3c1b239ca25f4e64ed3ca2ee165a3acd29..7effc06f90d7c5b8b5cd41f021f8d00b1476fb18 100644 (file)
@@ -153,7 +153,7 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
                }
        }
 
-       zend_ptr_stack_2_push(&EG(argument_stack), (void *) opline->extended_value, NULL);
+       zend_ptr_stack_2_push(&EG(argument_stack), (void *)(zend_uintptr_t)opline->extended_value, NULL);
 
        EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
 
@@ -197,7 +197,7 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
                        ulong arg_count;
 
                        p = (zval **) EG(argument_stack).top_element-2;
-                       arg_count = (ulong) *p;
+                       arg_count = (ulong)(zend_uintptr_t) *p;
 
                        while (arg_count>0) {
                                zend_verify_arg_type(EX(function_state).function, ++i, *(p-arg_count) TSRMLS_CC);
index bdd4ccb1e04ed4134339ddace17538824043405b..f567fa89c10bc5279475d60244c97459c32b0e2e 100644 (file)
@@ -2087,7 +2087,8 @@ PHP_FUNCTION(fgetcsv)
        int delimiter_len = 1, enclosure_len = 1, escape_len = 1;
        long len = -1;
        zstr buf;
-       int buf_len, argc = ZEND_NUM_ARGS();
+       size_t buf_len;
+       int argc = ZEND_NUM_ARGS();
        php_stream *stream;
        zval *zstream;
        zend_uchar delimiter_free = 0, enclosure_free = 0, escape_free = 0;
@@ -2366,7 +2367,7 @@ with_enc:
                                /* Hungry? */
                                if (((e - p) < enclosure_len) && stream) {
                                        /* Feed me! */
-                                       int new_len;
+                                       size_t new_len;
                                        char *new_buf = php_stream_get_line(stream, NULL_ZSTR, 0, &new_len);
 
                                        if (new_buf) {
@@ -2577,7 +2578,7 @@ with_enc:
                                /* Hungry? */
                                if (((e - p) < enclosure_len) && stream) {
                                        /* Feed me! */
-                                       int new_len;
+                                       size_t new_len;
                                        UChar *new_buf = (UChar*)php_stream_get_line_ex(stream, IS_UNICODE, NULL_ZSTR, 0, 0, &new_len);
 
                                        if (new_buf) {
index f4b443a6451bd39adf1e045e0ceccbe30c5d0f00..0a2d818abf0d83539117c13533ba130f95caa0fb 100644 (file)
@@ -585,7 +585,7 @@ static size_t php_ftp_dirstream_read(php_stream *stream, char *buf, size_t count
        php_stream *innerstream = (php_stream *)stream->abstract;
        size_t tmp_len;
        char *basename;
-       size_t basename_len;
+       int basename_len;
 
        if (count != sizeof(php_stream_dirent)) {
                return 0;
index fe1f28c50ad3be17d8796c640f831dc924af7ab5..d7d483961892ca09789172bdcf3216a951142f10 100644 (file)
@@ -945,7 +945,7 @@ PHP_FUNCTION(proc_open)
                                                break;
                                }
 #ifdef PHP_WIN32
-                               stream = php_stream_fopen_from_fd(_open_osfhandle((long)descriptors[i].parentend,
+                               stream = php_stream_fopen_from_fd(_open_osfhandle((zend_intptr_t)descriptors[i].parentend,
                                                        descriptors[i].mode_flags), mode_string, NULL);
 #else
                                stream = php_stream_fopen_from_fd(descriptors[i].parentend, mode_string, NULL);
index 8a53194a1dbf2dd4035db2e2a738ccd767644411..3b75fcdc7e42ebef571d74353a8fbc425fb6ea15 100644 (file)
@@ -567,7 +567,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
 
        switch (op) {
        case SAPI_HEADER_SET_STATUS:
-               sapi_update_response_code((long) arg TSRMLS_CC);
+               sapi_update_response_code((int)(zend_intptr_t) arg TSRMLS_CC);
                return SUCCESS;
 
        case SAPI_HEADER_REPLACE:
index e2899d112fff77dfcaceefc68416fcec657fbce7..e67b5953fe8b07dc5533317f850739f50d061cd7 100644 (file)
@@ -1087,7 +1087,7 @@ static void php_message_handler_for_zend(long message, void *data)
                                if (message==ZMSG_MEMORY_LEAK_DETECTED) {
                                        zend_leak_info *t = (zend_leak_info *) data;
 
-                                       snprintf(memory_leak_buf, 512, "%s(%d) :  Freeing 0x%.8lX (%zu bytes), script=%s\n", t->filename, t->lineno, (unsigned long)t->addr, t->size, SAFE_FILENAME(SG(request_info).path_translated));
+                                       snprintf(memory_leak_buf, 512, "%s(%d) :  Freeing 0x%.8lX (%zu bytes), script=%s\n", t->filename, t->lineno, (zend_uintptr_t)t->addr, t->size, SAFE_FILENAME(SG(request_info).path_translated));
                                        if (t->orig_filename) {
                                                char relay_buf[512];
 
@@ -1095,7 +1095,7 @@ static void php_message_handler_for_zend(long message, void *data)
                                                strlcat(memory_leak_buf, relay_buf, sizeof(memory_leak_buf));
                                        }
                                } else {
-                                       unsigned long leak_count = (unsigned long) data;
+                                       unsigned long leak_count = (zend_uintptr_t) data;
 
                                        snprintf(memory_leak_buf, 512, "Last leak repeated %ld time%s\n", leak_count, (leak_count>1?"s":""));
                                }
index 00774a688305b972c9dc79a85988faf88ddd250c..f705996ba1a38a788fafb6f12763cc10017afcf8 100644 (file)
@@ -142,7 +142,7 @@ PHPAPI void display_ini_entries(zend_module_entry *module)
        }
        php_info_print_table_start();
        php_info_print_table_header(3, "Directive", "Local Value", "Master Value");
-       zend_hash_apply_with_argument(EG(ini_directives), (apply_func_arg_t) php_ini_displayer, (void *) (long) module_number TSRMLS_CC);
+       zend_hash_apply_with_argument(EG(ini_directives), (apply_func_arg_t) php_ini_displayer, (void *) (zend_intptr_t) module_number TSRMLS_CC);
        php_info_print_table_end();
 }
 /* }}} */
@@ -586,7 +586,7 @@ PHPAPI int cfg_get_long(char *varname, long *result)
        zval *tmp, var;
        
        if (zend_hash_find(&configuration_hash, varname, strlen(varname) + 1, (void **) &tmp) == FAILURE) {
-               *result = (long) NULL;
+               *result = 0;
                return FAILURE;
        }
        var = *tmp;
index d3524a7d39894ebaf7560befe26323b663f905c6..c809db4c2e0f9456aae72f655ff17b68e49bfa43 100644 (file)
@@ -223,9 +223,9 @@ PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode, const cha
                }
 #elif defined(PHP_WIN32)
                {
-                       long handle = _get_osfhandle(self->fd);
+                       zend_uintptr_t handle = _get_osfhandle(self->fd);
 
-                       if (handle != 0xFFFFFFFF) {
+                       if (handle != (zend_uintptr_t)INVALID_HANDLE_VALUE) {
                                self->is_pipe = GetFileType((HANDLE)handle) == FILE_TYPE_PIPE;
                        }
                }
@@ -262,9 +262,9 @@ PHPAPI php_stream *_php_stream_fopen_from_file(FILE *file, const char *mode STRE
                }
 #elif defined(PHP_WIN32)
                {
-                       long handle = _get_osfhandle(self->fd);
+                       zend_uintptr_t handle = _get_osfhandle(self->fd);
 
-                       if (handle != 0xFFFFFFFF) {
+                       if (handle != (zend_uintptr_t)INVALID_HANDLE_VALUE) {
                                self->is_pipe = GetFileType((HANDLE)handle) == FILE_TYPE_PIPE;
                        }
                }
@@ -605,7 +605,7 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
                                return -1;
                        }
 
-                       if ((long) ptrparam == PHP_STREAM_LOCK_SUPPORTED) {
+                       if ((zend_uintptr_t) ptrparam == PHP_STREAM_LOCK_SUPPORTED) {
                                return 0;
                        }
 
index 4f4be915d716ab7233245b6ff53257777b9bc5c4..3bb093dd8177054a5765bfc598a22dff40a7d29b 100644 (file)
@@ -124,8 +124,7 @@ if (VCVERS >= 14) {
        // fun stuff: MS deprecated ANSI stdio and similar functions
        // disable annoying warnings
        if (X64) {
-               ADD_FLAG('CFLAGS', ' /wd4996 ');
-//             ADD_FLAG('CFLAGS', ' /wd4996 /Wp64 ');
+               ADD_FLAG('CFLAGS', ' /wd4996 /Wp64 ');
        } else {
                ADD_FLAG('CFLAGS', ' /wd4996 ');
        }
index 276535af853318bb40200bcb898d2e0a6bd9e2be..82da1dd15716ec4720fadd9b79e465b41f07f7dd 100644 (file)
@@ -63,8 +63,8 @@ PHPAPI int php_select(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *efds, stru
        /* build an array of handles for non-sockets */
        for (i = 0; i < max_fd; i++) {
                if (SAFE_FD_ISSET(i, rfds) || SAFE_FD_ISSET(i, wfds) || SAFE_FD_ISSET(i, efds)) {
-                       handles[n_handles] = (HANDLE)_get_osfhandle(i);
-                       if ((DWORD)handles[n_handles] == 0xffffffff) {
+                       handles[n_handles] = (HANDLE)(zend_uintptr_t)_get_osfhandle(i);
+                       if (handles[n_handles] == INVALID_HANDLE_VALUE) {
                                /* socket */
                                if (SAFE_FD_ISSET(i, rfds)) {
                                        FD_SET(i, &sock_read);