Skip to content

Commit da452e3

Browse files
committed
fix some implicit 32 vs 64 bit type conversions
1 parent 06eff86 commit da452e3

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

Zend/zend_alloc.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@
2929
#include "zend_types.h"
3030

3131
#ifndef ZEND_MM_ALIGNMENT
32-
# define ZEND_MM_ALIGNMENT 8
33-
# define ZEND_MM_ALIGNMENT_LOG2 3
34-
#elif ZEND_MM_ALIGNMENT < 4
32+
# define ZEND_MM_ALIGNMENT Z_I(8)
33+
# define ZEND_MM_ALIGNMENT_LOG2 Z_I(3)
34+
#elif ZEND_MM_ALIGNMENT < Z_I(4)
3535
# undef ZEND_MM_ALIGNMENT
3636
# undef ZEND_MM_ALIGNMENT_LOG2
37-
# define ZEND_MM_ALIGNMENT 4
38-
# define ZEND_MM_ALIGNMENT_LOG2 2
37+
# define ZEND_MM_ALIGNMENT Z_I(4)
38+
# define ZEND_MM_ALIGNMENT_LOG2 Z_I(2)
3939
#endif
4040

41-
#define ZEND_MM_ALIGNMENT_MASK ~(ZEND_MM_ALIGNMENT-1)
41+
#define ZEND_MM_ALIGNMENT_MASK ~(ZEND_MM_ALIGNMENT-Z_I(1))
4242

43-
#define ZEND_MM_ALIGNED_SIZE(size) (((size) + ZEND_MM_ALIGNMENT - 1) & ZEND_MM_ALIGNMENT_MASK)
43+
#define ZEND_MM_ALIGNED_SIZE(size) (((size) + ZEND_MM_ALIGNMENT - Z_I(1)) & ZEND_MM_ALIGNMENT_MASK)
4444

4545
typedef struct _zend_leak_info {
4646
void *addr;

Zend/zend_execute.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ static zend_always_inline void *zend_vm_stack_alloc(size_t size TSRMLS_DC)
252252
EG(argument_stack)->top += ZEND_MM_ALIGNED_SIZE(sizeof(void*)) / sizeof(void*);
253253
}
254254
} else {
255-
ZEND_VM_STACK_GROW_IF_NEEDED((int)size);
255+
ZEND_VM_STACK_GROW_IF_NEEDED(size);
256256
}
257257
ret = (void*)EG(argument_stack)->top;
258258
EG(argument_stack)->top += size;
@@ -298,7 +298,7 @@ static zend_always_inline void zend_vm_stack_free(void *ptr TSRMLS_DC)
298298
static zend_always_inline void zend_vm_stack_clear_multiple(int nested TSRMLS_DC)
299299
{
300300
void **p = EG(argument_stack)->top - 1;
301-
void **end = p - (int)(zend_uintptr_t)*p;
301+
void **end = p - (ptrdiff_t)(zend_uintptr_t)*p;
302302

303303
while (p != end) {
304304
zval *q = (zval *) *(--p);
@@ -325,7 +325,7 @@ static zend_always_inline zend_size_t zend_vm_stack_get_args_count_ex(zend_execu
325325
static zend_always_inline zval** zend_vm_stack_get_arg_ex(zend_execute_data *ex, zend_size_t requested_arg)
326326
{
327327
void **p = ex->function_state.arguments;
328-
int arg_count = (int)(zend_uintptr_t) *p;
328+
zend_int_t arg_count = (zend_int_t)(zend_uintptr_t) *p;
329329

330330
if (UNEXPECTED(requested_arg > arg_count)) {
331331
return NULL;

Zend/zend_operators.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ static zend_always_inline zend_int_t zend_dval_to_ival(double d)
132132
static inline zend_uchar is_numeric_string_ex(const char *str, zend_size_t length, zend_int_t *lval, double *dval, int allow_errors, int *oflow_info)
133133
{
134134
const char *ptr;
135-
int base = 10, digits = 0, dp_or_e = 0;
135+
int base = 10, dp_or_e = 0;
136+
ptrdiff_t digits = 0;
136137
double local_dval = 0.0;
137138
zend_uchar type;
138139

Zend/zend_ptr_stack.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#define ZEND_PTR_STACK_H
2424

2525
typedef struct _zend_ptr_stack {
26-
int top, max;
26+
ptrdiff_t top, max;
2727
void **elements;
2828
void **top_element;
2929
zend_bool persistent;

0 commit comments

Comments
 (0)