diff --git a/.gdbinit b/.gdbinit index 61179226210..d3b456239e3 100644 --- a/.gdbinit +++ b/.gdbinit @@ -482,7 +482,7 @@ end define print_pi set $pi = (zend_property_info *)$arg0 - set $initial_offset = ((uint32_t)(zend_uintptr_t)(&((zend_object*)0)->properties_table[(0)])) + set $initial_offset = ((uint32_t)(uintptr_t)(&((zend_object*)0)->properties_table[(0)])) set $ptr_to_val = (zval*)((char*)$pi->ce->default_properties_table + $pi->offset - $initial_offset) printf "[%p] {\n", $pi printf " offset = %p\n", $pi->offset diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 905687a00b9..11c00f7732c 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2764,7 +2764,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend internal_function->arg_info = (zend_internal_arg_info*)ptr->arg_info+1; internal_function->num_args = ptr->num_args; /* Currently you cannot denote that the function can accept less arguments than num_args */ - if (info->required_num_args == (zend_uintptr_t)-1) { + if (info->required_num_args == (uintptr_t)-1) { internal_function->required_num_args = ptr->num_args; } else { internal_function->required_num_args = info->required_num_args; diff --git a/Zend/zend_API.h b/Zend/zend_API.h index f8197060acf..ca33e96656b 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -156,7 +156,7 @@ typedef struct _zend_fcall_info_cache { #define ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX2(name, return_reference, required_num_args, class_name, allow_null, is_tentative_return_type) \ static const zend_internal_arg_info name[] = { \ - { (const char*)(zend_uintptr_t)(required_num_args), \ + { (const char*)(uintptr_t)(required_num_args), \ ZEND_TYPE_INIT_CLASS_CONST(#class_name, allow_null, _ZEND_ARG_INFO_FLAGS(return_reference, 0, is_tentative_return_type)), NULL }, #define ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(name, return_reference, required_num_args, class_name, allow_null) \ @@ -170,7 +170,7 @@ typedef struct _zend_fcall_info_cache { #define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX2(name, return_reference, required_num_args, type, is_tentative_return_type) \ static const zend_internal_arg_info name[] = { \ - { (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_MASK(type | _ZEND_ARG_INFO_FLAGS(return_reference, 0, is_tentative_return_type)), NULL }, + { (const char*)(uintptr_t)(required_num_args), ZEND_TYPE_INIT_MASK(type | _ZEND_ARG_INFO_FLAGS(return_reference, 0, is_tentative_return_type)), NULL }, #define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(name, return_reference, required_num_args, type) \ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX2(name, return_reference, required_num_args, type, 0) @@ -180,7 +180,7 @@ typedef struct _zend_fcall_info_cache { #define ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX2(name, return_reference, required_num_args, class_name, type, is_tentative_return_type) \ static const zend_internal_arg_info name[] = { \ - { (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_CLASS_CONST_MASK(#class_name, type | _ZEND_ARG_INFO_FLAGS(return_reference, 0, is_tentative_return_type)), NULL }, + { (const char*)(uintptr_t)(required_num_args), ZEND_TYPE_INIT_CLASS_CONST_MASK(#class_name, type | _ZEND_ARG_INFO_FLAGS(return_reference, 0, is_tentative_return_type)), NULL }, #define ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(name, return_reference, required_num_args, class_name, type) \ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX2(name, return_reference, required_num_args, class_name, type, 0) @@ -190,7 +190,7 @@ typedef struct _zend_fcall_info_cache { #define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX2(name, return_reference, required_num_args, type, allow_null, is_tentative_return_type) \ static const zend_internal_arg_info name[] = { \ - { (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_CODE(type, allow_null, _ZEND_ARG_INFO_FLAGS(return_reference, 0, is_tentative_return_type)), NULL }, + { (const char*)(uintptr_t)(required_num_args), ZEND_TYPE_INIT_CODE(type, allow_null, _ZEND_ARG_INFO_FLAGS(return_reference, 0, is_tentative_return_type)), NULL }, #define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX2(name, return_reference, required_num_args, type, allow_null, 0) @@ -203,7 +203,7 @@ typedef struct _zend_fcall_info_cache { #define ZEND_BEGIN_ARG_INFO_EX(name, _unused, return_reference, required_num_args) \ static const zend_internal_arg_info name[] = { \ - { (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_NONE(_ZEND_ARG_INFO_FLAGS(return_reference, 0, 0)), NULL }, + { (const char*)(uintptr_t)(required_num_args), ZEND_TYPE_INIT_NONE(_ZEND_ARG_INFO_FLAGS(return_reference, 0, 0)), NULL }, #define ZEND_BEGIN_ARG_INFO(name, _unused) \ ZEND_BEGIN_ARG_INFO_EX(name, {}, ZEND_RETURN_VALUE, -1) #define ZEND_END_ARG_INFO() }; diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 5f11f49b071..c09ce622eca 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -774,7 +774,7 @@ static void *zend_mm_chunk_alloc(zend_mm_heap *heap, size_t size, size_t alignme #if ZEND_MM_STORAGE if (UNEXPECTED(heap->storage)) { void *ptr = heap->storage->handlers.chunk_alloc(heap->storage, size, alignment); - ZEND_ASSERT(((zend_uintptr_t)((char*)ptr + (alignment-1)) & (alignment-1)) == (zend_uintptr_t)ptr); + ZEND_ASSERT(((uintptr_t)((char*)ptr + (alignment-1)) & (alignment-1)) == (uintptr_t)ptr); return ptr; } #endif @@ -2171,7 +2171,7 @@ static void zend_mm_check_leaks(zend_mm_heap *heap) repeated = zend_mm_find_leaks_huge(heap, list); total += 1 + repeated; if (repeated) { - zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated); + zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(uintptr_t)repeated); } heap->huge_list = list = list->next; @@ -2210,7 +2210,7 @@ static void zend_mm_check_leaks(zend_mm_heap *heap) zend_mm_find_leaks(heap, p, i + bin_pages[bin_num], &leak); total += 1 + repeated; if (repeated) { - zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated); + zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(uintptr_t)repeated); } } dbg = (zend_mm_debug_info*)((char*)dbg + bin_data_size[bin_num]); @@ -2236,7 +2236,7 @@ static void zend_mm_check_leaks(zend_mm_heap *heap) repeated = zend_mm_find_leaks(heap, p, i + pages_count, &leak); total += 1 + repeated; if (repeated) { - zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated); + zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(uintptr_t)repeated); } i += pages_count; } diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 97b11cdb303..0f54d8cd4f4 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -431,7 +431,7 @@ typedef struct _zend_arg_info { * It's also used for the return type. */ typedef struct _zend_internal_function_info { - zend_uintptr_t required_num_args; + uintptr_t required_num_args; zend_type type; const char *default_value; } zend_internal_function_info; diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index dcbb6a7ffba..51d68294ec5 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -4804,7 +4804,7 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_array(zend_ar } /* }}} */ -#define ZEND_FAKE_OP_ARRAY ((zend_op_array*)(zend_intptr_t)-1) +#define ZEND_FAKE_OP_ARRAY ((zend_op_array*)(intptr_t)-1) static zend_never_inline zend_op_array* ZEND_FASTCALL zend_include_or_eval(zval *inc_filename_zv, int type) /* {{{ */ { diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 17c3caae214..efdebc6498a 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1141,7 +1141,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string * ALLOC_HASHTABLE(CG(unlinked_uses)); zend_hash_init(CG(unlinked_uses), 0, NULL, NULL, 0); } - zend_hash_index_add_empty_element(CG(unlinked_uses), (zend_long)(zend_uintptr_t)ce); + zend_hash_index_add_empty_element(CG(unlinked_uses), (zend_long)(uintptr_t)ce); return ce; } return NULL; diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index 93b9f0d4530..d9210d07318 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -298,7 +298,7 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t ZEND_API void ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort_func, bucket_compare_func_t compare_func, bool renumber); ZEND_API zval* ZEND_FASTCALL zend_hash_minmax(const HashTable *ht, compare_func_t compar, uint32_t flag); -static zend_always_inline void ZEND_FASTCALL zend_hash_sort(HashTable *ht, bucket_compare_func_t compare_func, zend_bool renumber) { +static zend_always_inline void ZEND_FASTCALL zend_hash_sort(HashTable *ht, bucket_compare_func_t compare_func, bool renumber) { zend_hash_sort_ex(ht, zend_sort, compare_func, renumber); } diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 0f030d14217..61b1e06e7cb 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -2682,7 +2682,7 @@ static void check_unrecoverable_load_failure(zend_class_entry *ce) { * a dependence on the inheritance hierarchy of this specific class. Instead we fall back to * a fatal error, as would happen if we did not allow exceptions in the first place. */ if (CG(unlinked_uses) - && zend_hash_index_del(CG(unlinked_uses), (zend_long)(zend_uintptr_t)ce) == SUCCESS) { + && zend_hash_index_del(CG(unlinked_uses), (zend_long)(uintptr_t)ce) == SUCCESS) { zend_exception_uncaught_error( "During inheritance of %s with variance dependencies", ZSTR_VAL(ce->name)); } @@ -2957,7 +2957,7 @@ ZEND_API zend_class_entry *zend_do_link_class(zend_class_entry *ce, zend_string } if (CG(unlinked_uses)) { - zend_hash_index_del(CG(unlinked_uses), (zend_long)(zend_uintptr_t) ce); + zend_hash_index_del(CG(unlinked_uses), (zend_long)(uintptr_t) ce); } orig_linking_class = CG(current_linking_class); diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 6e0373d4f96..20d773e1d37 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -536,7 +536,7 @@ ZEND_API zend_result zend_check_property_access(const zend_object *zobj, zend_st static void zend_property_guard_dtor(zval *el) /* {{{ */ { uint32_t *ptr = (uint32_t*)Z_PTR_P(el); - if (EXPECTED(!(((zend_uintptr_t)ptr) & 1))) { + if (EXPECTED(!(((uintptr_t)ptr) & 1))) { efree_size(ptr, sizeof(uint32_t)); } } @@ -565,7 +565,7 @@ ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *membe zend_hash_init(guards, 8, NULL, zend_property_guard_dtor, 0); /* mark pointer as "special" using low bit */ zend_hash_add_new_ptr(guards, str, - (void*)(((zend_uintptr_t)&Z_PROPERTY_GUARD_P(zv)) | 1)); + (void*)(((uintptr_t)&Z_PROPERTY_GUARD_P(zv)) | 1)); zval_ptr_dtor_str(zv); ZVAL_ARR(zv, guards); } @@ -574,7 +574,7 @@ ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *membe ZEND_ASSERT(guards != NULL); zv = zend_hash_find(guards, member); if (zv != NULL) { - return (uint32_t*)(((zend_uintptr_t)Z_PTR_P(zv)) & ~1); + return (uint32_t*)(((uintptr_t)Z_PTR_P(zv)) & ~1); } } else { ZEND_ASSERT(Z_TYPE_P(zv) == IS_UNDEF); diff --git a/Zend/zend_objects_API.h b/Zend/zend_objects_API.h index 7a9a3a00082..422bf6a53e2 100644 --- a/Zend/zend_objects_API.h +++ b/Zend/zend_objects_API.h @@ -25,14 +25,14 @@ #define OBJ_BUCKET_INVALID (1<<0) -#define IS_OBJ_VALID(o) (!(((zend_uintptr_t)(o)) & OBJ_BUCKET_INVALID)) +#define IS_OBJ_VALID(o) (!(((uintptr_t)(o)) & OBJ_BUCKET_INVALID)) -#define SET_OBJ_INVALID(o) ((zend_object*)((((zend_uintptr_t)(o)) | OBJ_BUCKET_INVALID))) +#define SET_OBJ_INVALID(o) ((zend_object*)((((uintptr_t)(o)) | OBJ_BUCKET_INVALID))) -#define GET_OBJ_BUCKET_NUMBER(o) (((zend_intptr_t)(o)) >> 1) +#define GET_OBJ_BUCKET_NUMBER(o) (((intptr_t)(o)) >> 1) #define SET_OBJ_BUCKET_NUMBER(o, n) do { \ - (o) = (zend_object*)((((zend_uintptr_t)(n)) << 1) | OBJ_BUCKET_INVALID); \ + (o) = (zend_object*)((((uintptr_t)(n)) << 1) | OBJ_BUCKET_INVALID); \ } while (0) #define ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST(h) do { \ diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h index cb480e1f4d8..8f9b7fd4a9e 100644 --- a/Zend/zend_portability.h +++ b/Zend/zend_portability.h @@ -701,7 +701,7 @@ extern "C++" { # define ZEND_SET_ALIGNED(alignment, decl) decl #endif -#define ZEND_SLIDE_TO_ALIGNED(alignment, ptr) (((zend_uintptr_t)(ptr) + ((alignment)-1)) & ~((alignment)-1)) +#define ZEND_SLIDE_TO_ALIGNED(alignment, ptr) (((uintptr_t)(ptr) + ((alignment)-1)) & ~((alignment)-1)) #define ZEND_SLIDE_TO_ALIGNED16(ptr) ZEND_SLIDE_TO_ALIGNED(Z_UL(16), ptr) #ifdef ZEND_WIN32 diff --git a/Zend/zend_types.h b/Zend/zend_types.h index e6505d8b62a..7bcb5c1d738 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -47,7 +47,6 @@ # define ZEND_ENDIAN_LOHI_C_4(a, b, c, d) a, b, c, d #endif -typedef bool zend_bool; typedef unsigned char zend_uchar; typedef enum { @@ -71,9 +70,6 @@ typedef ZEND_RESULT_CODE zend_result; # endif #endif -typedef intptr_t zend_intptr_t; -typedef uintptr_t zend_uintptr_t; - #ifdef ZTS #define ZEND_TLS static TSRM_TLS #define ZEND_EXT_TLS TSRM_TLS diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 0e3720b1203..3768d869dc3 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -64706,7 +64706,7 @@ static void init_opcode_serialiser(void) Z_TYPE_INFO(tmp) = IS_LONG; for (i = 0; i < zend_handlers_count; i++) { Z_LVAL(tmp) = i; - zend_hash_index_add(zend_handlers_table, (zend_long)(zend_uintptr_t)zend_opcode_handlers[i], &tmp); + zend_hash_index_add(zend_handlers_table, (zend_long)(uintptr_t)zend_opcode_handlers[i], &tmp); } } @@ -64717,14 +64717,14 @@ ZEND_API void ZEND_FASTCALL zend_serialize_opcode_handler(zend_op *op) if (!zend_handlers_table) { init_opcode_serialiser(); } - zv = zend_hash_index_find(zend_handlers_table, (zend_long)(zend_uintptr_t)op->handler); + zv = zend_hash_index_find(zend_handlers_table, (zend_long)(uintptr_t)op->handler); ZEND_ASSERT(zv != NULL); - op->handler = (const void *)(zend_uintptr_t)Z_LVAL_P(zv); + op->handler = (const void *)(uintptr_t)Z_LVAL_P(zv); } ZEND_API void ZEND_FASTCALL zend_deserialize_opcode_handler(zend_op *op) { - op->handler = zend_opcode_handlers[(zend_uintptr_t)op->handler]; + op->handler = zend_opcode_handlers[(uintptr_t)op->handler]; } ZEND_API const void* ZEND_FASTCALL zend_get_opcode_handler_func(const zend_op *op) @@ -64737,7 +64737,7 @@ ZEND_API const void* ZEND_FASTCALL zend_get_opcode_handler_func(const zend_op *o if (!zend_handlers_table) { init_opcode_serialiser(); } - zv = zend_hash_index_find(zend_handlers_table, (zend_long)(zend_uintptr_t)op->handler); + zv = zend_hash_index_find(zend_handlers_table, (zend_long)(uintptr_t)op->handler); ZEND_ASSERT(zv != NULL); return zend_opcode_handler_funcs[Z_LVAL_P(zv)]; #else diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl index a131eead572..717d4ffd3e8 100644 --- a/Zend/zend_vm_execute.skl +++ b/Zend/zend_vm_execute.skl @@ -102,7 +102,7 @@ static void init_opcode_serialiser(void) Z_TYPE_INFO(tmp) = IS_LONG; for (i = 0; i < zend_handlers_count; i++) { Z_LVAL(tmp) = i; - zend_hash_index_add(zend_handlers_table, (zend_long)(zend_uintptr_t)zend_opcode_handlers[i], &tmp); + zend_hash_index_add(zend_handlers_table, (zend_long)(uintptr_t)zend_opcode_handlers[i], &tmp); } } @@ -113,14 +113,14 @@ ZEND_API void ZEND_FASTCALL zend_serialize_opcode_handler(zend_op *op) if (!zend_handlers_table) { init_opcode_serialiser(); } - zv = zend_hash_index_find(zend_handlers_table, (zend_long)(zend_uintptr_t)op->handler); + zv = zend_hash_index_find(zend_handlers_table, (zend_long)(uintptr_t)op->handler); ZEND_ASSERT(zv != NULL); - op->handler = (const void *)(zend_uintptr_t)Z_LVAL_P(zv); + op->handler = (const void *)(uintptr_t)Z_LVAL_P(zv); } ZEND_API void ZEND_FASTCALL zend_deserialize_opcode_handler(zend_op *op) { - op->handler = zend_opcode_handlers[(zend_uintptr_t)op->handler]; + op->handler = zend_opcode_handlers[(uintptr_t)op->handler]; } ZEND_API const void* ZEND_FASTCALL zend_get_opcode_handler_func(const zend_op *op) @@ -133,7 +133,7 @@ ZEND_API const void* ZEND_FASTCALL zend_get_opcode_handler_func(const zend_op *o if (!zend_handlers_table) { init_opcode_serialiser(); } - zv = zend_hash_index_find(zend_handlers_table, (zend_long)(zend_uintptr_t)op->handler); + zv = zend_hash_index_find(zend_handlers_table, (zend_long)(uintptr_t)op->handler); ZEND_ASSERT(zv != NULL); return zend_opcode_handler_funcs[Z_LVAL_P(zv)]; #else diff --git a/docs/parameter-parsing-api.md b/docs/parameter-parsing-api.md index 76c571068d7..a5a405e6a24 100644 --- a/docs/parameter-parsing-api.md +++ b/docs/parameter-parsing-api.md @@ -67,7 +67,7 @@ on input and is used to verify the PHP parameter is an instance of that class. ```txt a - array (zval*) A - array or object (zval*) -b - boolean (zend_bool) +b - boolean (bool) C - class (zend_class_entry*) d - double (double) f - function or array containing php method call info (returned as @@ -97,9 +97,9 @@ The following characters also have a meaning in the specifier string: * `!` - the parameter it follows can be of specified type or NULL. If NULL is passed, and the output for such type is a pointer, then the output pointer is set to a native NULL pointer. For 'b', 'l' and 'd', an extra argument of type - zend_bool* must be passed after the corresponding bool*, zend_long* or + bool* must be passed after the corresponding bool*, zend_long* or double* arguments, respectively. A non-zero value will be written to the - zend_bool if a PHP NULL is passed. + bool if a PHP NULL is passed. For `f` use the ``ZEND_FCI_INITIALIZED(fci)`` macro to check if a callable has been provided and ``!ZEND_FCI_INITIALIZED(fci)`` to check if a PHP NULL is passed. diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 0c1c59c8c7b..cd06a8fb545 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2145,7 +2145,7 @@ static void date_interval_object_to_hash(php_interval_obj *intervalobj, HashTabl /* Records whether this is a special relative interval that needs to be recreated from a string */ if (intervalobj->from_string) { - ZVAL_BOOL(&zv, (zend_bool)intervalobj->from_string); + ZVAL_BOOL(&zv, (bool)intervalobj->from_string); zend_hash_str_update(props, "from_string", strlen("from_string"), &zv); ZVAL_STR_COPY(&zv, intervalobj->date_string); zend_hash_str_update(props, "date_string", strlen("date_string"), &zv); @@ -2171,7 +2171,7 @@ static void date_interval_object_to_hash(php_interval_obj *intervalobj, HashTabl ZVAL_FALSE(&zv); zend_hash_str_update(props, "days", sizeof("days")-1, &zv); } - ZVAL_BOOL(&zv, (zend_bool)intervalobj->from_string); + ZVAL_BOOL(&zv, (bool)intervalobj->from_string); zend_hash_str_update(props, "from_string", strlen("from_string"), &zv); #undef PHP_DATE_INTERVAL_ADD_PROPERTY diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 4d68bc3191c..1887f289f2f 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -1507,11 +1507,11 @@ static zend_persistent_script *store_script_in_file_cache(zend_persistent_script #if defined(__AVX__) || defined(__SSE2__) /* Align to 64-byte boundary */ ZCG(mem) = zend_arena_alloc(&CG(arena), memory_used + 64); - ZCG(mem) = (void*)(((zend_uintptr_t)ZCG(mem) + 63L) & ~63L); + ZCG(mem) = (void*)(((uintptr_t)ZCG(mem) + 63L) & ~63L); #elif ZEND_MM_NEED_EIGHT_BYTE_REALIGNMENT /* Align to 8-byte boundary */ ZCG(mem) = zend_arena_alloc(&CG(arena), memory_used + 8); - ZCG(mem) = (void*)(((zend_uintptr_t)ZCG(mem) + 7L) & ~7L); + ZCG(mem) = (void*)(((uintptr_t)ZCG(mem) + 7L) & ~7L); #else ZCG(mem) = zend_arena_alloc(&CG(arena), memory_used); #endif @@ -2410,7 +2410,7 @@ static zend_class_entry* zend_accel_inheritance_cache_add(zend_class_entry *ce, #if ZEND_MM_NEED_EIGHT_BYTE_REALIGNMENT /* Align to 8-byte boundary */ - ZCG(mem) = (void*)(((zend_uintptr_t)ZCG(mem) + 7L) & ~7L); + ZCG(mem) = (void*)(((uintptr_t)ZCG(mem) + 7L) & ~7L); #endif memset(ZCG(mem), 0, size); diff --git a/ext/opcache/jit/zend_jit_disasm.c b/ext/opcache/jit/zend_jit_disasm.c index 8ce35f198c0..a9ac28308a5 100644 --- a/ext/opcache/jit/zend_jit_disasm.c +++ b/ext/opcache/jit/zend_jit_disasm.c @@ -262,7 +262,7 @@ static const char* zend_jit_disasm_resolver( ((void)ud); # endif const char *name; - void *a = (void*)(zend_uintptr_t)(addr); + void *a = (void*)(uintptr_t)(addr); Dl_info info; name = zend_jit_disasm_find_symbol(addr, offset); diff --git a/ext/opcache/jit/zend_jit_oprofile.c b/ext/opcache/jit/zend_jit_oprofile.c index a83b8056e03..36081064b54 100644 --- a/ext/opcache/jit/zend_jit_oprofile.c +++ b/ext/opcache/jit/zend_jit_oprofile.c @@ -27,7 +27,7 @@ static void zend_jit_oprofile_register(const char *name, size_t size) { if (op_agent) { - op_write_native_code(op_agent, name, (uint64_t)(zend_uintptr_t)start, start, size); + op_write_native_code(op_agent, name, (uint64_t)(uintptr_t)start, start, size); } } diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c index 39429a31685..ce7bb137444 100644 --- a/ext/opcache/jit/zend_jit_trace.c +++ b/ext/opcache/jit/zend_jit_trace.c @@ -46,7 +46,7 @@ static zend_always_inline const char *zend_jit_trace_star_desc(uint8_t trace_fla } } -static int zend_jit_trace_startup(zend_bool reattached) +static int zend_jit_trace_startup(bool reattached) { if (!reattached) { zend_jit_traces = (zend_jit_trace_info*)zend_shared_alloc(sizeof(zend_jit_trace_info) * JIT_G(max_root_traces)); diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c index 1cd639403f6..e1307c8ead0 100644 --- a/ext/opcache/zend_file_cache.c +++ b/ext/opcache/zend_file_cache.c @@ -1098,7 +1098,7 @@ int zend_file_cache_script_store(zend_persistent_script *script, bool in_shm) #if defined(__AVX__) || defined(__SSE2__) /* Align to 64-byte boundary */ mem = emalloc(script->size + 64); - buf = (void*)(((zend_uintptr_t)mem + 63L) & ~63L); + buf = (void*)(((uintptr_t)mem + 63L) & ~63L); #else mem = buf = emalloc(script->size); #endif @@ -1834,7 +1834,7 @@ zend_persistent_script *zend_file_cache_script_load(zend_file_handle *file_handl #if defined(__AVX__) || defined(__SSE2__) /* Align to 64-byte boundary */ mem = zend_arena_alloc(&CG(arena), info.mem_size + info.str_size + 64); - mem = (void*)(((zend_uintptr_t)mem + 63L) & ~63L); + mem = (void*)(((uintptr_t)mem + 63L) & ~63L); #else mem = zend_arena_alloc(&CG(arena), info.mem_size + info.str_size); #endif diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index 7bc95b71110..9698d584e80 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -136,7 +136,7 @@ static void zend_hash_persist(HashTable *ht) hash_size >>= 1; } ht->nTableMask = (uint32_t)(-(int32_t)hash_size); - ZEND_ASSERT(((zend_uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */ + ZEND_ASSERT(((uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */ HT_SET_DATA_ADDR(ht, ZCG(mem)); ZCG(mem) = (void*)((char*)ZCG(mem) + ZEND_ALIGNED_SIZE((hash_size * sizeof(uint32_t)) + (ht->nNumUsed * sizeof(Bucket)))); HT_HASH_RESET(ht); @@ -157,7 +157,7 @@ static void zend_hash_persist(HashTable *ht) void *data = ZCG(mem); void *old_data = HT_GET_DATA_ADDR(ht); - ZEND_ASSERT(((zend_uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */ + ZEND_ASSERT(((uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */ ZCG(mem) = (void*)((char*)data + ZEND_ALIGNED_SIZE(HT_USED_SIZE(ht))); memcpy(data, old_data, HT_USED_SIZE(ht)); if (!(GC_FLAGS(ht) & IS_ARRAY_IMMUTABLE)) { @@ -1308,7 +1308,7 @@ zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script script->mem = ZCG(mem); - ZEND_ASSERT(((zend_uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */ + ZEND_ASSERT(((uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */ script = zend_shared_memdup_free(script, sizeof(zend_persistent_script)); script->corrupted = false; @@ -1323,9 +1323,9 @@ zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script #if defined(__AVX__) || defined(__SSE2__) /* Align to 64-byte boundary */ - ZCG(mem) = (void*)(((zend_uintptr_t)ZCG(mem) + 63L) & ~63L); + ZCG(mem) = (void*)(((uintptr_t)ZCG(mem) + 63L) & ~63L); #else - ZEND_ASSERT(((zend_uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */ + ZEND_ASSERT(((uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */ #endif #ifdef HAVE_JIT diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c index f32f8c46eae..cdb1ebfeb81 100644 --- a/ext/opcache/zend_shared_alloc.c +++ b/ext/opcache/zend_shared_alloc.c @@ -355,7 +355,7 @@ void *zend_shared_alloc(size_t size) ZSMMG(shared_segments)[i]->pos += block_size; ZSMMG(shared_free) -= block_size; - ZEND_ASSERT(((zend_uintptr_t)retval & 0x7) == 0); /* should be 8 byte aligned */ + ZEND_ASSERT(((uintptr_t)retval & 0x7) == 0); /* should be 8 byte aligned */ return retval; } } diff --git a/ext/opcache/zend_shared_alloc.h b/ext/opcache/zend_shared_alloc.h index 7c52997f18a..2c62f878cbe 100644 --- a/ext/opcache/zend_shared_alloc.h +++ b/ext/opcache/zend_shared_alloc.h @@ -141,7 +141,7 @@ static inline void *zend_shared_alloc_aligned(size_t size) { #if defined(__AVX__) || defined(__SSE2__) /* Align to 64-byte boundary */ void *p = zend_shared_alloc(size + 64); - return (void *)(((zend_uintptr_t)p + 63L) & ~63L); + return (void *)(((uintptr_t)p + 63L) & ~63L); #else return zend_shared_alloc(size); #endif diff --git a/ext/standard/base64.c b/ext/standard/base64.c index 54c987405a7..4257a76ce5b 100644 --- a/ext/standard/base64.c +++ b/ext/standard/base64.c @@ -382,11 +382,11 @@ fail: # if BASE64_INTRIN_AVX512_FUNC_PROTO || BASE64_INTRIN_AVX512_FUNC_PTR ZEND_INTRIN_AVX512_FUNC_DECL(zend_string *php_base64_encode_avx512(const unsigned char *str, size_t length)); -ZEND_INTRIN_AVX512_FUNC_DECL(zend_string *php_base64_decode_ex_avx512(const unsigned char *str, size_t length, zend_bool strict)); +ZEND_INTRIN_AVX512_FUNC_DECL(zend_string *php_base64_decode_ex_avx512(const unsigned char *str, size_t length, bool strict)); # endif # if BASE64_INTRIN_AVX512_VBMI_FUNC_PROTO || BASE64_INTRIN_AVX512_VBMI_FUNC_PTR ZEND_INTRIN_AVX512_VBMI_FUNC_DECL(zend_string *php_base64_encode_avx512_vbmi(const unsigned char *str, size_t length)); -ZEND_INTRIN_AVX512_VBMI_FUNC_DECL(zend_string *php_base64_decode_ex_avx512_vbmi(const unsigned char *str, size_t length, zend_bool strict)); +ZEND_INTRIN_AVX512_VBMI_FUNC_DECL(zend_string *php_base64_decode_ex_avx512_vbmi(const unsigned char *str, size_t length, bool strict)); # endif # if ZEND_INTRIN_AVX2_RESOLVER @@ -552,7 +552,7 @@ zend_string *php_base64_encode_avx512_vbmi(const unsigned char *str, size_t leng return result; } -zend_string *php_base64_decode_ex_avx512_vbmi(const unsigned char *str, size_t length, zend_bool strict) +zend_string *php_base64_decode_ex_avx512_vbmi(const unsigned char *str, size_t length, bool strict) { const unsigned char *c = str; unsigned char *o; @@ -680,7 +680,7 @@ zend_string *php_base64_encode_avx512(const unsigned char *str, size_t length) _mm512_setr4_epi32(build_dword(b0, b1, b2, b3), build_dword(b4, b5, b6, b7), \ build_dword(b8, b9, b10, b11), build_dword(b12, b13, b14, b15)) -zend_string *php_base64_decode_ex_avx512(const unsigned char *str, size_t length, zend_bool strict) +zend_string *php_base64_decode_ex_avx512(const unsigned char *str, size_t length, bool strict) { const unsigned char *c = str; unsigned char *o; diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 613cc48644c..3f1d5e5db99 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -1282,7 +1282,7 @@ PHP_FUNCTION(proc_open) } #ifdef PHP_WIN32 - stream = php_stream_fopen_from_fd(_open_osfhandle((zend_intptr_t)descriptors[i].parentend, + stream = php_stream_fopen_from_fd(_open_osfhandle((intptr_t)descriptors[i].parentend, descriptors[i].mode_flags), mode_string, NULL); php_stream_set_option(stream, PHP_STREAM_OPTION_PIPE_BLOCKING, blocking_pipes, NULL); #else diff --git a/ext/standard/var.c b/ext/standard/var.c index e98cb99cf58..e8145ab2271 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -680,7 +680,7 @@ static inline zend_long php_add_var_hash(php_serialize_data_t data, zval *var) / /* Index for the variable is stored using the numeric value of the pointer to * the zend_refcounted struct */ - key = (zend_ulong) (zend_uintptr_t) Z_COUNTED_P(var); + key = (zend_ulong) (uintptr_t) Z_COUNTED_P(var); zv = zend_hash_index_find(&data->ht, key); if (zv) { @@ -1148,7 +1148,7 @@ again: } else { /* Mark this value in the var_hash, to avoid creating references to it. */ zval *var_idx = zend_hash_index_find(&var_hash->ht, - (zend_ulong) (zend_uintptr_t) Z_COUNTED_P(struc)); + (zend_ulong) (uintptr_t) Z_COUNTED_P(struc)); if (var_idx) { ZVAL_LONG(var_idx, -1); } diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re index 62f9aa43639..a050fb5f74a 100644 --- a/ext/standard/var_unserializer.re +++ b/ext/standard/var_unserializer.re @@ -616,7 +616,7 @@ declared_property: if ((*var_hash)->ref_props) { /* Remove old entry from ref_props table, if it exists. */ zend_hash_index_del( - (*var_hash)->ref_props, (zend_uintptr_t) data); + (*var_hash)->ref_props, (uintptr_t) data); } } /* We may override default property value, but they are usually immutable */ @@ -705,7 +705,7 @@ second_try: zend_hash_init((*var_hash)->ref_props, 8, NULL, NULL, 0); } zend_hash_index_update_ptr( - (*var_hash)->ref_props, (zend_uintptr_t) data, info); + (*var_hash)->ref_props, (uintptr_t) data, info); } } @@ -915,7 +915,7 @@ static int php_var_unserialize_internal(UNSERIALIZE_PARAMETER) if (!Z_ISREF_P(rval_ref)) { zend_property_info *info = NULL; if ((*var_hash)->ref_props) { - info = zend_hash_index_find_ptr((*var_hash)->ref_props, (zend_uintptr_t) rval_ref); + info = zend_hash_index_find_ptr((*var_hash)->ref_props, (uintptr_t) rval_ref); } ZVAL_NEW_REF(rval_ref, rval_ref); if (info) { diff --git a/main/SAPI.c b/main/SAPI.c index 019de09782d..e71cba0fb1d 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -683,7 +683,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg) switch (op) { case SAPI_HEADER_SET_STATUS: - sapi_update_response_code((int)(zend_intptr_t) arg); + sapi_update_response_code((int)(intptr_t) arg); return SUCCESS; case SAPI_HEADER_ADD: diff --git a/main/main.c b/main/main.c index 99dbe341b6f..65d7d4a03df 100644 --- a/main/main.c +++ b/main/main.c @@ -1627,7 +1627,7 @@ static ZEND_COLD void php_message_handler_for_zend(zend_long message, const void strlcat(memory_leak_buf, relay_buf, sizeof(memory_leak_buf)); } } else { - unsigned long leak_count = (zend_uintptr_t) data; + unsigned long leak_count = (uintptr_t) data; snprintf(memory_leak_buf, 512, "Last leak repeated %lu time%s\n", leak_count, (leak_count>1?"s":"")); } diff --git a/main/php.h b/main/php.h index b7101ed22f0..3385fb79992 100644 --- a/main/php.h +++ b/main/php.h @@ -434,4 +434,10 @@ END_EXTERN_C() #include "php_reentrancy.h" +/* the following typedefs are deprecated and will be removed in PHP + * 9.0; use the standard C99 types instead */ +typedef bool zend_bool; +typedef intptr_t zend_intptr_t; +typedef uintptr_t zend_uintptr_t; + #endif diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index e9a30f33340..3a6b2ccf28d 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -258,9 +258,9 @@ static void detect_is_seekable(php_stdio_stream_data *self) { self->is_pipe = S_ISFIFO(self->sb.st_mode); } #elif defined(PHP_WIN32) - zend_uintptr_t handle = _get_osfhandle(self->fd); + uintptr_t handle = _get_osfhandle(self->fd); - if (handle != (zend_uintptr_t)INVALID_HANDLE_VALUE) { + if (handle != (uintptr_t)INVALID_HANDLE_VALUE) { DWORD file_type = GetFileType((HANDLE)handle); self->is_seekable = !(file_type == FILE_TYPE_PIPE || file_type == FILE_TYPE_CHAR); @@ -733,7 +733,7 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void return -1; } - if ((zend_uintptr_t) ptrparam == PHP_STREAM_LOCK_SUPPORTED) { + if ((uintptr_t) ptrparam == PHP_STREAM_LOCK_SUPPORTED) { return 0; } diff --git a/win32/build/cppcheck_x64.cfg b/win32/build/cppcheck_x64.cfg index 4c221a6fcd3..6003d5dc7af 100644 --- a/win32/build/cppcheck_x64.cfg +++ b/win32/build/cppcheck_x64.cfg @@ -2,11 +2,8 @@ - - -