]> granicus.if.org Git - php/commitdiff
Fixes for x32 ABI
authorNikita Popov <nikic@php.net>
Sat, 23 May 2015 19:15:11 +0000 (21:15 +0200)
committerNikita Popov <nikic@php.net>
Sat, 23 May 2015 19:18:33 +0000 (21:18 +0200)
I'm assuming that we want to have 64bit zend_longs on x32 here.

This fixes two typos in __x86_64__ macros and adds sign-extension
when assigning STREAM_COPY_ALL to zend_long.

Zend/zend_long.h
Zend/zend_types.h
ext/date/lib/timelib_structs.h
ext/standard/file.c
ext/standard/streamsfuncs.c

index 1acd2cfb08738afe1fb5d9c69fc486f5fb067f3c..4c811054382bd7479b99aa006304d398e6c52706 100644 (file)
@@ -25,7 +25,7 @@
 #include "main/php_stdint.h"
 
 /* This is the heart of the whole int64 enablement in zval. */
-#if defined(__X86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)
+#if defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)
 # define ZEND_ENABLE_ZVAL_LONG64 1
 #endif
 
index d66da1eade513461f763d37b7c4964208376a693..3834835f86a40f3f68893511b7fab0a9428c2304 100644 (file)
@@ -802,7 +802,7 @@ static zend_always_inline uint32_t zval_delref_p(zval* pz) {
        return --GC_REFCOUNT(Z_COUNTED_P(pz));
 }
 
-#if SIZEOF_ZEND_LONG == 4
+#if SIZEOF_SIZE_T == 4
 # define ZVAL_COPY_VALUE_EX(z, v, gc, t)                               \
        do {                                                                                            \
                uint32_t _w2 = v->value.ww.w2;                                  \
@@ -810,14 +810,14 @@ static zend_always_inline uint32_t zval_delref_p(zval* pz) {
                z->value.ww.w2 = _w2;                                                   \
                Z_TYPE_INFO_P(z) = t;                                                   \
        } while (0)
-#elif SIZEOF_ZEND_LONG == 8
+#elif SIZEOF_SIZE_T == 8
 # define ZVAL_COPY_VALUE_EX(z, v, gc, t)                               \
        do {                                                                                            \
                Z_COUNTED_P(z) = gc;                                                    \
                Z_TYPE_INFO_P(z) = t;                                                   \
        } while (0)
 #else
-# error "Unknbown SIZEOF_ZEND_LONG"
+# error "Unknown SIZEOF_SIZE_T"
 #endif
 
 #define ZVAL_COPY_VALUE(z, v)                                                  \
index d68fbc1f281f5891bcd638c931b1bcff29fd77cd..33e9fce88cf23c658c7cd992ef610d25e95f9757 100644 (file)
@@ -121,7 +121,7 @@ typedef unsigned __int64  uint64_t;
 #include <strings.h>
 #endif
 
-#if defined(__X86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)
+#if defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)
 typedef int64_t timelib_long;
 typedef uint64_t timelib_ulong;
 # define TIMELIB_LONG_MAX INT64_MAX
index 7aa1ce7a853e85a65f4d120e07f389baa0c460ef..01c043f0ad5ac58838adc6ca0ada614848514b38 100644 (file)
@@ -522,7 +522,7 @@ PHP_FUNCTION(file_get_contents)
        zend_bool use_include_path = 0;
        php_stream *stream;
        zend_long offset = -1;
-       zend_long maxlen = PHP_STREAM_COPY_ALL;
+       zend_long maxlen = (ssize_t) PHP_STREAM_COPY_ALL;
        zval *zcontext = NULL;
        php_stream_context *context = NULL;
        zend_string *contents;
index fa9758b06cc7a0029d27b431f420253d9b815235..965bd67071453ac1e5a36aa68f3eab99b0bb7e2a 100644 (file)
@@ -397,7 +397,7 @@ PHP_FUNCTION(stream_get_contents)
 {
        php_stream      *stream;
        zval            *zsrc;
-       zend_long               maxlen          = PHP_STREAM_COPY_ALL,
+       zend_long               maxlen          = (ssize_t) PHP_STREAM_COPY_ALL,
                                desiredpos      = -1L;
        zend_string *contents;