Skip to content

Commit 0cfb476

Browse files
committed
Fixed compilation warnings
1 parent 0ac5144 commit 0cfb476

File tree

15 files changed

+40
-48
lines changed

15 files changed

+40
-48
lines changed

Zend/zend_alloc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2374,7 +2374,7 @@ ZEND_API void ZEND_FASTCALL _efree_large(void *ptr, size_t size)
23742374
size_t page_offset = ZEND_MM_ALIGNED_OFFSET(ptr, ZEND_MM_CHUNK_SIZE);
23752375
zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE);
23762376
int page_num = page_offset / ZEND_MM_PAGE_SIZE;
2377-
int pages_count = ZEND_MM_ALIGNED_SIZE_EX(size, ZEND_MM_PAGE_SIZE) / ZEND_MM_PAGE_SIZE;
2377+
uint32_t pages_count = ZEND_MM_ALIGNED_SIZE_EX(size, ZEND_MM_PAGE_SIZE) / ZEND_MM_PAGE_SIZE;
23782378

23792379
ZEND_MM_CHECK(chunk->heap == AG(mm_heap) && ZEND_MM_ALIGNED_OFFSET(page_offset, ZEND_MM_PAGE_SIZE) == 0, "zend_mm_heap corrupted");
23802380
ZEND_ASSERT(chunk->map[page_num] & ZEND_MM_IS_LRUN);

Zend/zend_builtin_functions.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ ZEND_FUNCTION(each)
767767
Return the current error_reporting level, and if an argument was passed - change to the new level */
768768
ZEND_FUNCTION(error_reporting)
769769
{
770-
zval *err;
770+
zval *err = NULL;
771771
int old_error_reporting;
772772

773773
#ifndef FAST_ZPP

ext/date/php_date.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -3100,7 +3100,7 @@ PHP_METHOD(DateTimeImmutable, modify)
31003100
RETURN_FALSE;
31013101
}
31023102

3103-
ZVAL_COPY_VALUE(return_value, &new_object);
3103+
ZVAL_OBJ(return_value, Z_OBJ(new_object));
31043104
}
31053105
/* }}} */
31063106

@@ -3151,7 +3151,7 @@ PHP_METHOD(DateTimeImmutable, add)
31513151
date_clone_immutable(object, &new_object);
31523152
php_date_add(&new_object, interval, return_value);
31533153

3154-
ZVAL_COPY_VALUE(return_value, &new_object);
3154+
ZVAL_OBJ(return_value, Z_OBJ(new_object));
31553155
}
31563156
/* }}} */
31573157

@@ -3207,7 +3207,7 @@ PHP_METHOD(DateTimeImmutable, sub)
32073207
date_clone_immutable(object, &new_object);
32083208
php_date_sub(&new_object, interval, return_value);
32093209

3210-
ZVAL_COPY_VALUE(return_value, &new_object);
3210+
ZVAL_OBJ(return_value, Z_OBJ(new_object));
32113211
}
32123212
/* }}} */
32133213

@@ -3311,7 +3311,7 @@ PHP_METHOD(DateTimeImmutable, setTimezone)
33113311
date_clone_immutable(object, &new_object);
33123312
php_date_timezone_set(&new_object, timezone_object, return_value);
33133313

3314-
ZVAL_COPY_VALUE(return_value, &new_object);
3314+
ZVAL_OBJ(return_value, Z_OBJ(new_object));
33153315
}
33163316
/* }}} */
33173317

@@ -3395,7 +3395,7 @@ PHP_METHOD(DateTimeImmutable, setTime)
33953395
date_clone_immutable(object, &new_object);
33963396
php_date_time_set(&new_object, h, i, s, return_value);
33973397

3398-
ZVAL_COPY_VALUE(return_value, &new_object);
3398+
ZVAL_OBJ(return_value, Z_OBJ(new_object));
33993399
}
34003400
/* }}} */
34013401

@@ -3444,7 +3444,7 @@ PHP_METHOD(DateTimeImmutable, setDate)
34443444
date_clone_immutable(object, &new_object);
34453445
php_date_date_set(&new_object, y, m, d, return_value);
34463446

3447-
ZVAL_COPY_VALUE(return_value, &new_object);
3447+
ZVAL_OBJ(return_value, Z_OBJ(new_object));
34483448
}
34493449
/* }}} */
34503450

@@ -3497,7 +3497,7 @@ PHP_METHOD(DateTimeImmutable, setISODate)
34973497
date_clone_immutable(object, &new_object);
34983498
php_date_isodate_set(&new_object, y, w, d, return_value);
34993499

3500-
ZVAL_COPY_VALUE(return_value, &new_object);
3500+
ZVAL_OBJ(return_value, Z_OBJ(new_object));
35013501
}
35023502
/* }}} */
35033503

@@ -3544,7 +3544,7 @@ PHP_METHOD(DateTimeImmutable, setTimestamp)
35443544
date_clone_immutable(object, &new_object);
35453545
php_date_timestamp_set(&new_object, timestamp, return_value);
35463546

3547-
ZVAL_COPY_VALUE(return_value, &new_object);
3547+
ZVAL_OBJ(return_value, Z_OBJ(new_object));
35483548
}
35493549
/* }}} */
35503550

ext/dom/php_dom.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp) /* {{{ *
420420
*std_props;
421421
zend_string *string_key;
422422
dom_prop_handler *entry;
423-
zval object_value;
423+
zend_string *object_str;
424424

425425
*is_temp = 1;
426426

@@ -431,7 +431,7 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp) /* {{{ *
431431
return debug_info;
432432
}
433433

434-
ZVAL_STRING(&object_value, "(object value omitted)");
434+
object_str = zend_string_init("(object value omitted)", sizeof("(object value omitted)")-1, 0);
435435

436436
ZEND_HASH_FOREACH_STR_KEY_PTR(prop_handlers, string_key, entry) {
437437
zval value;
@@ -442,13 +442,14 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp) /* {{{ *
442442

443443
if (Z_TYPE(value) == IS_OBJECT) {
444444
zval_dtor(&value);
445-
ZVAL_COPY(&value, &object_value);
445+
ZVAL_NEW_STR(&value, object_str);
446+
zend_string_addref(object_str);
446447
}
447448

448449
zend_hash_add(debug_info, string_key, &value);
449450
} ZEND_HASH_FOREACH_END();
450451

451-
zval_dtor(&object_value);
452+
zend_string_release(object_str);
452453

453454
return debug_info;
454455
}

ext/intl/transliterator/transliterator_class.c

-9
Original file line numberDiff line numberDiff line change
@@ -311,20 +311,11 @@ ZEND_BEGIN_ARG_INFO_EX( ainfo_trans_create_from_rules, 0, 0, 1 )
311311
ZEND_ARG_INFO( 0, direction )
312312
ZEND_END_ARG_INFO()
313313

314-
ZEND_BEGIN_ARG_INFO_EX( ainfo_trans_create_inverse, 0, 0, 1 )
315-
ZEND_ARG_OBJ_INFO( 0, orig_trans, Transliterator, 0 )
316-
ZEND_END_ARG_INFO()
317-
318314
ZEND_BEGIN_ARG_INFO_EX( ainfo_trans_me_transliterate, 0, 0, 1 )
319315
ZEND_ARG_INFO( 0, subject )
320316
ZEND_ARG_INFO( 0, start )
321317
ZEND_ARG_INFO( 0, end )
322318
ZEND_END_ARG_INFO()
323-
324-
ZEND_BEGIN_ARG_INFO_EX( ainfo_trans_error, 0, 0, 1 )
325-
ZEND_ARG_OBJ_INFO( 0, trans, Transliterator, 0 )
326-
ZEND_END_ARG_INFO()
327-
328319
/* }}} */
329320

330321
/* {{{ Transliterator_class_functions

ext/mysqli/mysqli_fe.c

-4
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_class_mysqli_stmt_bind_param, 0)
6363
ZEND_ARG_VARIADIC_INFO(1, vars)
6464
ZEND_END_ARG_INFO()
6565

66-
ZEND_BEGIN_ARG_INFO(all_args_force_by_ref, 0)
67-
ZEND_ARG_VARIADIC_INFO(1, vars)
68-
ZEND_END_ARG_INFO()
69-
7066
ZEND_BEGIN_ARG_INFO_EX(arginfo_mysqli_poll, 0, 0, 4)
7167
ZEND_ARG_ARRAY_INFO(1, read, 1)
7268
ZEND_ARG_ARRAY_INFO(1, write, 1)

ext/openssl/openssl.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -5733,7 +5733,7 @@ PHP_FUNCTION(openssl_get_curve_names)
57335733
{
57345734
EC_builtin_curve *curves = NULL;
57355735
const char *sname;
5736-
int i;
5736+
size_t i;
57375737
size_t len = EC_get_builtin_curves(NULL, 0);
57385738

57395739
curves = emalloc(sizeof(EC_builtin_curve) * len);

ext/readline/readline.c

+2
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,11 @@ ZEND_END_ARG_INFO()
122122
ZEND_BEGIN_ARG_INFO(arginfo_readline_redisplay, 0)
123123
ZEND_END_ARG_INFO()
124124

125+
#if HAVE_RL_ON_NEW_LINE
125126
ZEND_BEGIN_ARG_INFO(arginfo_readline_on_new_line, 0)
126127
ZEND_END_ARG_INFO()
127128
#endif
129+
#endif
128130
/* }}} */
129131

130132
/* {{{ module stuff */

ext/reflection/php_reflection.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,6 @@ static void reflection_class_constant_factory(zend_class_entry *ce, zend_string
13981398
static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *ce_ptr, int ctor_argc)
13991399
{
14001400
zval reflector;
1401-
zval output, *output_ptr = &output;
14021401
zval *argument_ptr, *argument2_ptr;
14031402
zval retval, params[2];
14041403
int result;
@@ -1455,9 +1454,8 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
14551454
}
14561455

14571456
/* Call static reflection::export */
1458-
ZVAL_BOOL(&output, return_output);
14591457
ZVAL_COPY_VALUE(&params[0], &reflector);
1460-
ZVAL_COPY_VALUE(&params[1], output_ptr);
1458+
ZVAL_BOOL(&params[1], return_output);
14611459

14621460
ZVAL_STRINGL(&fci.function_name, "reflection::export", sizeof("reflection::export") - 1);
14631461
fci.object = NULL;

ext/spl/spl_directory.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1851,7 +1851,7 @@ static int spl_filesystem_object_cast(zval *readobj, zval *writeobj, int type)
18511851

18521852
ZVAL_STRINGL(retval_ptr, intern->file_name, intern->file_name_len);
18531853
zval_ptr_dtor(readobj);
1854-
ZVAL_COPY_VALUE(writeobj, retval_ptr);
1854+
ZVAL_NEW_STR(writeobj, Z_STR_P(retval_ptr));
18551855
} else {
18561856
ZVAL_STRINGL(writeobj, intern->file_name, intern->file_name_len);
18571857
}
@@ -1863,7 +1863,7 @@ static int spl_filesystem_object_cast(zval *readobj, zval *writeobj, int type)
18631863

18641864
ZVAL_STRING(retval_ptr, intern->u.dir.entry.d_name);
18651865
zval_ptr_dtor(readobj);
1866-
ZVAL_COPY_VALUE(writeobj, retval_ptr);
1866+
ZVAL_NEW_STR(writeobj, Z_STR_P(retval_ptr));
18671867
} else {
18681868
ZVAL_STRING(writeobj, intern->u.dir.entry.d_name);
18691869
}

ext/standard/basic_functions.c

+2
Original file line numberDiff line numberDiff line change
@@ -2676,6 +2676,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_version_compare, 0, 0, 2)
26762676
ZEND_END_ARG_INFO()
26772677
/* }}} */
26782678
/* {{{ win32/codepage.c */
2679+
#ifdef PHP_WIN32
26792680
ZEND_BEGIN_ARG_INFO_EX(arginfo_sapi_windows_cp_set, 0, 0, 1)
26802681
ZEND_ARG_TYPE_INFO(0, code_page, IS_LONG, 0)
26812682
ZEND_END_ARG_INFO()
@@ -2691,6 +2692,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_sapi_windows_cp_conv, 0, 0, 3)
26912692
ZEND_ARG_INFO(0, out_codepage)
26922693
ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
26932694
ZEND_END_ARG_INFO()
2695+
#endif
26942696
/* }}} */
26952697
/* }}} */
26962698

main/fastcgi.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -1081,11 +1081,14 @@ static int fcgi_read_request(fcgi_request *req)
10811081
req->id = (hdr.requestIdB1 << 8) + hdr.requestIdB0;
10821082

10831083
if (hdr.type == FCGI_BEGIN_REQUEST && len == sizeof(fcgi_begin_request)) {
1084+
fcgi_begin_request *b;
1085+
10841086
if (safe_read(req, buf, len+padding) != len+padding) {
10851087
return 0;
10861088
}
10871089

1088-
req->keep = (((fcgi_begin_request*)buf)->flags & FCGI_KEEP_CONN);
1090+
b = (fcgi_begin_request*)buf;
1091+
req->keep = (b->flags & FCGI_KEEP_CONN);
10891092
#ifdef TCP_NODELAY
10901093
if (req->keep && req->tcp && !req->nodelay) {
10911094
# ifdef _WIN32
@@ -1098,7 +1101,7 @@ static int fcgi_read_request(fcgi_request *req)
10981101
req->nodelay = 1;
10991102
}
11001103
#endif
1101-
switch ((((fcgi_begin_request*)buf)->roleB1 << 8) + ((fcgi_begin_request*)buf)->roleB0) {
1104+
switch ((b->roleB1 << 8) + b->roleB0) {
11021105
case FCGI_RESPONDER:
11031106
fcgi_hash_set(&req->env, FCGI_HASH_FUNC("FCGI_ROLE", sizeof("FCGI_ROLE")-1), "FCGI_ROLE", sizeof("FCGI_ROLE")-1, "RESPONDER", sizeof("RESPONDER")-1);
11041107
break;

sapi/cgi/cgi_main.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,9 @@ static int print_extension_info(zend_extension *ext, void *arg)
276276

277277
static int extension_name_cmp(const zend_llist_element **f, const zend_llist_element **s)
278278
{
279-
return strcmp( ((zend_extension *)(*f)->data)->name,
280-
((zend_extension *)(*s)->data)->name);
279+
zend_extension *fe = (zend_extension*)(*f)->data;
280+
zend_extension *se = (zend_extension*)(*s)->data;
281+
return strcmp(fe->name, se->name);
281282
}
282283

283284
static void print_extensions(void)

sapi/cli/php_cli.c

+6-9
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,9 @@ static int print_extension_info(zend_extension *ext, void *arg) /* {{{ */
222222

223223
static int extension_name_cmp(const zend_llist_element **f, const zend_llist_element **s) /* {{{ */
224224
{
225-
return strcmp(((zend_extension *)(*f)->data)->name,
226-
((zend_extension *)(*s)->data)->name);
225+
zend_extension *fe = (zend_extension*)(*f)->data;
226+
zend_extension *se = (zend_extension*)(*s)->data;
227+
return strcmp(fe->name, se->name);
227228
}
228229
/* }}} */
229230

@@ -557,7 +558,6 @@ static php_stream *s_in_process = NULL;
557558

558559
static void cli_register_file_handles(void) /* {{{ */
559560
{
560-
zval zin, zout, zerr;
561561
php_stream *s_in, *s_out, *s_err;
562562
php_stream_context *sc_in=NULL, *sc_out=NULL, *sc_err=NULL;
563563
zend_constant ic, oc, ec;
@@ -581,23 +581,20 @@ static void cli_register_file_handles(void) /* {{{ */
581581

582582
s_in_process = s_in;
583583

584-
php_stream_to_zval(s_in, &zin);
585-
php_stream_to_zval(s_out, &zout);
586-
php_stream_to_zval(s_err, &zerr);
584+
php_stream_to_zval(s_in, &ic.value);
585+
php_stream_to_zval(s_out, &oc.value);
586+
php_stream_to_zval(s_err, &ec.value);
587587

588-
ZVAL_COPY_VALUE(&ic.value, &zin);
589588
ic.flags = CONST_CS;
590589
ic.name = zend_string_init("STDIN", sizeof("STDIN")-1, 1);
591590
ic.module_number = 0;
592591
zend_register_constant(&ic);
593592

594-
ZVAL_COPY_VALUE(&oc.value, &zout);
595593
oc.flags = CONST_CS;
596594
oc.name = zend_string_init("STDOUT", sizeof("STDOUT")-1, 1);
597595
oc.module_number = 0;
598596
zend_register_constant(&oc);
599597

600-
ZVAL_COPY_VALUE(&ec.value, &zerr);
601598
ec.flags = CONST_CS;
602599
ec.name = zend_string_init("STDERR", sizeof("STDERR")-1, 1);
603600
ec.module_number = 0;

sapi/fpm/fpm/fpm_main.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,9 @@ static int print_extension_info(zend_extension *ext, void *arg) /* {{{ */
258258

259259
static int extension_name_cmp(const zend_llist_element **f, const zend_llist_element **s) /* {{{ */
260260
{
261-
return strcmp( ((zend_extension *)(*f)->data)->name,
262-
((zend_extension *)(*s)->data)->name);
261+
zend_extension *fe = (zend_extension*)(*f)->data;
262+
zend_extension *se = (zend_extension*)(*s)->data;
263+
return strcmp(fe->name, se->name);
263264
}
264265
/* }}} */
265266

0 commit comments

Comments
 (0)