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.
#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
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; \
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) \
#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
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;
{
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;