Skip to content

Commit

Permalink
Fixed compilation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed Jun 28, 2016
1 parent 0ac5144 commit 0cfb476
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 48 deletions.
2 changes: 1 addition & 1 deletion Zend/zend_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2374,7 +2374,7 @@ ZEND_API void ZEND_FASTCALL _efree_large(void *ptr, size_t size)
size_t page_offset = ZEND_MM_ALIGNED_OFFSET(ptr, ZEND_MM_CHUNK_SIZE);
zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE);
int page_num = page_offset / ZEND_MM_PAGE_SIZE;
int pages_count = ZEND_MM_ALIGNED_SIZE_EX(size, ZEND_MM_PAGE_SIZE) / ZEND_MM_PAGE_SIZE;
uint32_t pages_count = ZEND_MM_ALIGNED_SIZE_EX(size, ZEND_MM_PAGE_SIZE) / ZEND_MM_PAGE_SIZE;

ZEND_MM_CHECK(chunk->heap == AG(mm_heap) && ZEND_MM_ALIGNED_OFFSET(page_offset, ZEND_MM_PAGE_SIZE) == 0, "zend_mm_heap corrupted");
ZEND_ASSERT(chunk->map[page_num] & ZEND_MM_IS_LRUN);
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_builtin_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ ZEND_FUNCTION(each)
Return the current error_reporting level, and if an argument was passed - change to the new level */
ZEND_FUNCTION(error_reporting)
{
zval *err;
zval *err = NULL;
int old_error_reporting;

#ifndef FAST_ZPP
Expand Down
16 changes: 8 additions & 8 deletions ext/date/php_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -3100,7 +3100,7 @@ PHP_METHOD(DateTimeImmutable, modify)
RETURN_FALSE;
}

ZVAL_COPY_VALUE(return_value, &new_object);
ZVAL_OBJ(return_value, Z_OBJ(new_object));
}
/* }}} */

Expand Down Expand Up @@ -3151,7 +3151,7 @@ PHP_METHOD(DateTimeImmutable, add)
date_clone_immutable(object, &new_object);
php_date_add(&new_object, interval, return_value);

ZVAL_COPY_VALUE(return_value, &new_object);
ZVAL_OBJ(return_value, Z_OBJ(new_object));
}
/* }}} */

Expand Down Expand Up @@ -3207,7 +3207,7 @@ PHP_METHOD(DateTimeImmutable, sub)
date_clone_immutable(object, &new_object);
php_date_sub(&new_object, interval, return_value);

ZVAL_COPY_VALUE(return_value, &new_object);
ZVAL_OBJ(return_value, Z_OBJ(new_object));
}
/* }}} */

Expand Down Expand Up @@ -3311,7 +3311,7 @@ PHP_METHOD(DateTimeImmutable, setTimezone)
date_clone_immutable(object, &new_object);
php_date_timezone_set(&new_object, timezone_object, return_value);

ZVAL_COPY_VALUE(return_value, &new_object);
ZVAL_OBJ(return_value, Z_OBJ(new_object));
}
/* }}} */

Expand Down Expand Up @@ -3395,7 +3395,7 @@ PHP_METHOD(DateTimeImmutable, setTime)
date_clone_immutable(object, &new_object);
php_date_time_set(&new_object, h, i, s, return_value);

ZVAL_COPY_VALUE(return_value, &new_object);
ZVAL_OBJ(return_value, Z_OBJ(new_object));
}
/* }}} */

Expand Down Expand Up @@ -3444,7 +3444,7 @@ PHP_METHOD(DateTimeImmutable, setDate)
date_clone_immutable(object, &new_object);
php_date_date_set(&new_object, y, m, d, return_value);

ZVAL_COPY_VALUE(return_value, &new_object);
ZVAL_OBJ(return_value, Z_OBJ(new_object));
}
/* }}} */

Expand Down Expand Up @@ -3497,7 +3497,7 @@ PHP_METHOD(DateTimeImmutable, setISODate)
date_clone_immutable(object, &new_object);
php_date_isodate_set(&new_object, y, w, d, return_value);

ZVAL_COPY_VALUE(return_value, &new_object);
ZVAL_OBJ(return_value, Z_OBJ(new_object));
}
/* }}} */

Expand Down Expand Up @@ -3544,7 +3544,7 @@ PHP_METHOD(DateTimeImmutable, setTimestamp)
date_clone_immutable(object, &new_object);
php_date_timestamp_set(&new_object, timestamp, return_value);

ZVAL_COPY_VALUE(return_value, &new_object);
ZVAL_OBJ(return_value, Z_OBJ(new_object));
}
/* }}} */

Expand Down
9 changes: 5 additions & 4 deletions ext/dom/php_dom.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp) /* {{{ *
*std_props;
zend_string *string_key;
dom_prop_handler *entry;
zval object_value;
zend_string *object_str;

*is_temp = 1;

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

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

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

if (Z_TYPE(value) == IS_OBJECT) {
zval_dtor(&value);
ZVAL_COPY(&value, &object_value);
ZVAL_NEW_STR(&value, object_str);
zend_string_addref(object_str);
}

zend_hash_add(debug_info, string_key, &value);
} ZEND_HASH_FOREACH_END();

zval_dtor(&object_value);
zend_string_release(object_str);

return debug_info;
}
Expand Down
9 changes: 0 additions & 9 deletions ext/intl/transliterator/transliterator_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,20 +311,11 @@ ZEND_BEGIN_ARG_INFO_EX( ainfo_trans_create_from_rules, 0, 0, 1 )
ZEND_ARG_INFO( 0, direction )
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX( ainfo_trans_create_inverse, 0, 0, 1 )
ZEND_ARG_OBJ_INFO( 0, orig_trans, Transliterator, 0 )
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX( ainfo_trans_me_transliterate, 0, 0, 1 )
ZEND_ARG_INFO( 0, subject )
ZEND_ARG_INFO( 0, start )
ZEND_ARG_INFO( 0, end )
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX( ainfo_trans_error, 0, 0, 1 )
ZEND_ARG_OBJ_INFO( 0, trans, Transliterator, 0 )
ZEND_END_ARG_INFO()

/* }}} */

/* {{{ Transliterator_class_functions
Expand Down
4 changes: 0 additions & 4 deletions ext/mysqli/mysqli_fe.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_class_mysqli_stmt_bind_param, 0)
ZEND_ARG_VARIADIC_INFO(1, vars)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO(all_args_force_by_ref, 0)
ZEND_ARG_VARIADIC_INFO(1, vars)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_mysqli_poll, 0, 0, 4)
ZEND_ARG_ARRAY_INFO(1, read, 1)
ZEND_ARG_ARRAY_INFO(1, write, 1)
Expand Down
2 changes: 1 addition & 1 deletion ext/openssl/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -5733,7 +5733,7 @@ PHP_FUNCTION(openssl_get_curve_names)
{
EC_builtin_curve *curves = NULL;
const char *sname;
int i;
size_t i;
size_t len = EC_get_builtin_curves(NULL, 0);

curves = emalloc(sizeof(EC_builtin_curve) * len);
Expand Down
2 changes: 2 additions & 0 deletions ext/readline/readline.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO(arginfo_readline_redisplay, 0)
ZEND_END_ARG_INFO()

#if HAVE_RL_ON_NEW_LINE
ZEND_BEGIN_ARG_INFO(arginfo_readline_on_new_line, 0)
ZEND_END_ARG_INFO()
#endif
#endif
/* }}} */

/* {{{ module stuff */
Expand Down
4 changes: 1 addition & 3 deletions ext/reflection/php_reflection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,6 @@ static void reflection_class_constant_factory(zend_class_entry *ce, zend_string
static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *ce_ptr, int ctor_argc)
{
zval reflector;
zval output, *output_ptr = &output;
zval *argument_ptr, *argument2_ptr;
zval retval, params[2];
int result;
Expand Down Expand Up @@ -1455,9 +1454,8 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
}

/* Call static reflection::export */
ZVAL_BOOL(&output, return_output);
ZVAL_COPY_VALUE(&params[0], &reflector);
ZVAL_COPY_VALUE(&params[1], output_ptr);
ZVAL_BOOL(&params[1], return_output);

ZVAL_STRINGL(&fci.function_name, "reflection::export", sizeof("reflection::export") - 1);
fci.object = NULL;
Expand Down
4 changes: 2 additions & 2 deletions ext/spl/spl_directory.c
Original file line number Diff line number Diff line change
Expand Up @@ -1851,7 +1851,7 @@ static int spl_filesystem_object_cast(zval *readobj, zval *writeobj, int type)

ZVAL_STRINGL(retval_ptr, intern->file_name, intern->file_name_len);
zval_ptr_dtor(readobj);
ZVAL_COPY_VALUE(writeobj, retval_ptr);
ZVAL_NEW_STR(writeobj, Z_STR_P(retval_ptr));
} else {
ZVAL_STRINGL(writeobj, intern->file_name, intern->file_name_len);
}
Expand All @@ -1863,7 +1863,7 @@ static int spl_filesystem_object_cast(zval *readobj, zval *writeobj, int type)

ZVAL_STRING(retval_ptr, intern->u.dir.entry.d_name);
zval_ptr_dtor(readobj);
ZVAL_COPY_VALUE(writeobj, retval_ptr);
ZVAL_NEW_STR(writeobj, Z_STR_P(retval_ptr));
} else {
ZVAL_STRING(writeobj, intern->u.dir.entry.d_name);
}
Expand Down
2 changes: 2 additions & 0 deletions ext/standard/basic_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -2676,6 +2676,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_version_compare, 0, 0, 2)
ZEND_END_ARG_INFO()
/* }}} */
/* {{{ win32/codepage.c */
#ifdef PHP_WIN32
ZEND_BEGIN_ARG_INFO_EX(arginfo_sapi_windows_cp_set, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, code_page, IS_LONG, 0)
ZEND_END_ARG_INFO()
Expand All @@ -2691,6 +2692,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_sapi_windows_cp_conv, 0, 0, 3)
ZEND_ARG_INFO(0, out_codepage)
ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
ZEND_END_ARG_INFO()
#endif
/* }}} */
/* }}} */

Expand Down
7 changes: 5 additions & 2 deletions main/fastcgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1081,11 +1081,14 @@ static int fcgi_read_request(fcgi_request *req)
req->id = (hdr.requestIdB1 << 8) + hdr.requestIdB0;

if (hdr.type == FCGI_BEGIN_REQUEST && len == sizeof(fcgi_begin_request)) {
fcgi_begin_request *b;

if (safe_read(req, buf, len+padding) != len+padding) {
return 0;
}

req->keep = (((fcgi_begin_request*)buf)->flags & FCGI_KEEP_CONN);
b = (fcgi_begin_request*)buf;
req->keep = (b->flags & FCGI_KEEP_CONN);
#ifdef TCP_NODELAY
if (req->keep && req->tcp && !req->nodelay) {
# ifdef _WIN32
Expand All @@ -1098,7 +1101,7 @@ static int fcgi_read_request(fcgi_request *req)
req->nodelay = 1;
}
#endif
switch ((((fcgi_begin_request*)buf)->roleB1 << 8) + ((fcgi_begin_request*)buf)->roleB0) {
switch ((b->roleB1 << 8) + b->roleB0) {
case FCGI_RESPONDER:
fcgi_hash_set(&req->env, FCGI_HASH_FUNC("FCGI_ROLE", sizeof("FCGI_ROLE")-1), "FCGI_ROLE", sizeof("FCGI_ROLE")-1, "RESPONDER", sizeof("RESPONDER")-1);
break;
Expand Down
5 changes: 3 additions & 2 deletions sapi/cgi/cgi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,9 @@ static int print_extension_info(zend_extension *ext, void *arg)

static int extension_name_cmp(const zend_llist_element **f, const zend_llist_element **s)
{
return strcmp( ((zend_extension *)(*f)->data)->name,
((zend_extension *)(*s)->data)->name);
zend_extension *fe = (zend_extension*)(*f)->data;
zend_extension *se = (zend_extension*)(*s)->data;
return strcmp(fe->name, se->name);
}

static void print_extensions(void)
Expand Down
15 changes: 6 additions & 9 deletions sapi/cli/php_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,9 @@ static int print_extension_info(zend_extension *ext, void *arg) /* {{{ */

static int extension_name_cmp(const zend_llist_element **f, const zend_llist_element **s) /* {{{ */
{
return strcmp(((zend_extension *)(*f)->data)->name,
((zend_extension *)(*s)->data)->name);
zend_extension *fe = (zend_extension*)(*f)->data;
zend_extension *se = (zend_extension*)(*s)->data;
return strcmp(fe->name, se->name);
}
/* }}} */

Expand Down Expand Up @@ -557,7 +558,6 @@ static php_stream *s_in_process = NULL;

static void cli_register_file_handles(void) /* {{{ */
{
zval zin, zout, zerr;
php_stream *s_in, *s_out, *s_err;
php_stream_context *sc_in=NULL, *sc_out=NULL, *sc_err=NULL;
zend_constant ic, oc, ec;
Expand All @@ -581,23 +581,20 @@ static void cli_register_file_handles(void) /* {{{ */

s_in_process = s_in;

php_stream_to_zval(s_in, &zin);
php_stream_to_zval(s_out, &zout);
php_stream_to_zval(s_err, &zerr);
php_stream_to_zval(s_in, &ic.value);
php_stream_to_zval(s_out, &oc.value);
php_stream_to_zval(s_err, &ec.value);

ZVAL_COPY_VALUE(&ic.value, &zin);
ic.flags = CONST_CS;
ic.name = zend_string_init("STDIN", sizeof("STDIN")-1, 1);
ic.module_number = 0;
zend_register_constant(&ic);

ZVAL_COPY_VALUE(&oc.value, &zout);
oc.flags = CONST_CS;
oc.name = zend_string_init("STDOUT", sizeof("STDOUT")-1, 1);
oc.module_number = 0;
zend_register_constant(&oc);

ZVAL_COPY_VALUE(&ec.value, &zerr);
ec.flags = CONST_CS;
ec.name = zend_string_init("STDERR", sizeof("STDERR")-1, 1);
ec.module_number = 0;
Expand Down
5 changes: 3 additions & 2 deletions sapi/fpm/fpm/fpm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,9 @@ static int print_extension_info(zend_extension *ext, void *arg) /* {{{ */

static int extension_name_cmp(const zend_llist_element **f, const zend_llist_element **s) /* {{{ */
{
return strcmp( ((zend_extension *)(*f)->data)->name,
((zend_extension *)(*s)->data)->name);
zend_extension *fe = (zend_extension*)(*f)->data;
zend_extension *se = (zend_extension*)(*s)->data;
return strcmp(fe->name, se->name);
}
/* }}} */

Expand Down

0 comments on commit 0cfb476

Please sign in to comment.