diff options
author | Nikita Popov <nikic@php.net> | 2015-07-17 20:18:25 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2015-07-17 20:18:25 +0200 |
commit | 5c95226d50e565b43d9e7f2d4ff4deeaf7ec8942 (patch) | |
tree | 309a2e9430f04fda13e808e1ea00b8b27f388116 | |
parent | 90d9adccec42559d08487ae144e947df30ab820e (diff) | |
download | php-git-5c95226d50e565b43d9e7f2d4ff4deeaf7ec8942.tar.gz |
Various warning fixes
-rw-r--r-- | ext/dom/documenttype.c | 2 | ||||
-rw-r--r-- | ext/gd/gd.c | 3 | ||||
-rw-r--r-- | ext/intl/collator/collator_sort.c | 2 | ||||
-rw-r--r-- | ext/intl/msgformat/msgformat_format.c | 3 | ||||
-rw-r--r-- | ext/intl/msgformat/msgformat_parse.c | 3 | ||||
-rw-r--r-- | ext/mbstring/php_mbregex.c | 6 | ||||
-rw-r--r-- | ext/pdo_mysql/php_pdo_mysql_int.h | 7 | ||||
-rw-r--r-- | ext/pdo_sqlite/sqlite_statement.c | 2 | ||||
-rw-r--r-- | ext/pgsql/pgsql.c | 9 | ||||
-rw-r--r-- | ext/readline/readline_cli.c | 2 |
10 files changed, 20 insertions, 19 deletions
diff --git a/ext/dom/documenttype.c b/ext/dom/documenttype.c index c65902e759..30fd590536 100644 --- a/ext/dom/documenttype.c +++ b/ext/dom/documenttype.c @@ -193,7 +193,7 @@ int dom_documenttype_internal_subset_read(dom_object *obj, zval *retval) #ifdef LIBXML2_NEW_BUFFER smart_str_appendl(&ret_buf, (const char *) xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff)); #else - smart_str_appendl(&ret_buf, buff->buffer->content, buff->buffer->use); + smart_str_appendl(&ret_buf, (char *) buff->buffer->content, buff->buffer->use); #endif (void)xmlOutputBufferClose(buff); diff --git a/ext/gd/gd.c b/ext/gd/gd.c index abd7b75c09..7eaa9552d4 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -3857,10 +3857,9 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int if (extended && EXT) { /* parse extended info */ zval *item; zend_string *key; - zend_ulong num_key; /* walk the assoc array */ - ZEND_HASH_FOREACH_KEY_VAL(HASH_OF(EXT), num_key, key, item) { + ZEND_HASH_FOREACH_STR_KEY_VAL(HASH_OF(EXT), key, item) { if (key == NULL) { continue; } diff --git a/ext/intl/collator/collator_sort.c b/ext/intl/collator/collator_sort.c index 8727c1d8ab..ca4b7ea785 100644 --- a/ext/intl/collator/collator_sort.c +++ b/ext/intl/collator/collator_sort.c @@ -385,8 +385,6 @@ PHP_FUNCTION( collator_sort_with_sort_keys ) int utf16_buf_size = DEF_UTF16_BUF_SIZE; /* the length of utf16_buf */ int utf16_len = 0; /* length of converted string */ - HashTable* sortedHash = NULL; - COLLATOR_METHOD_INIT_VARS /* Parse parameters. */ diff --git a/ext/intl/msgformat/msgformat_format.c b/ext/intl/msgformat/msgformat_format.c index 5aa68e2735..959a4fd5a0 100644 --- a/ext/intl/msgformat/msgformat_format.c +++ b/ext/intl/msgformat/msgformat_format.c @@ -104,7 +104,7 @@ PHP_FUNCTION( msgfmt_format_message ) size_t pattern_len = 0; const char *slocale = NULL; size_t slocale_len = 0; - MessageFormatter_object mf = {0}; + MessageFormatter_object mf; MessageFormatter_object *mfo = &mf; /* Parse parameters. */ @@ -117,6 +117,7 @@ PHP_FUNCTION( msgfmt_format_message ) RETURN_FALSE; } + memset(mfo, 0, sizeof(*mfo)); msgformat_data_init(&mfo->mf_data); if(pattern && pattern_len) { diff --git a/ext/intl/msgformat/msgformat_parse.c b/ext/intl/msgformat/msgformat_parse.c index 4d63a0169a..349633912b 100644 --- a/ext/intl/msgformat/msgformat_parse.c +++ b/ext/intl/msgformat/msgformat_parse.c @@ -97,7 +97,7 @@ PHP_FUNCTION( msgfmt_parse_message ) size_t slocale_len = 0; char *source = NULL; size_t src_len = 0; - MessageFormatter_object mf = {0}; + MessageFormatter_object mf; MessageFormatter_object *mfo = &mf; /* Parse parameters. */ @@ -110,6 +110,7 @@ PHP_FUNCTION( msgfmt_parse_message ) RETURN_FALSE; } + memset(mfo, 0, sizeof(*mfo)); msgformat_data_init(&mfo->mf_data); if(pattern && pattern_len) { diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index 88f8772d34..35a986ac2a 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -909,7 +909,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp } #endif /* copy the part of the string before the match */ - smart_str_appendl(&out_buf, pos, (size_t)((OnigUChar *)(string + regs->beg[0]) - pos)); + smart_str_appendl(&out_buf, (char *)pos, (size_t)((OnigUChar *)(string + regs->beg[0]) - pos)); if (!is_callable) { /* copy replacement and backrefs */ @@ -992,14 +992,14 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp pos = (OnigUChar *)string + n; } else { if (pos < string_lim) { - smart_str_appendl(&out_buf, pos, 1); + smart_str_appendl(&out_buf, (char *)pos, 1); } pos++; } } else { /* nomatch */ /* stick that last bit of string on our output */ if (string_lim - pos > 0) { - smart_str_appendl(&out_buf, pos, string_lim - pos); + smart_str_appendl(&out_buf, (char *)pos, string_lim - pos); } } onig_region_free(regs, 0); diff --git a/ext/pdo_mysql/php_pdo_mysql_int.h b/ext/pdo_mysql/php_pdo_mysql_int.h index 17bace7882..3d4108dd59 100644 --- a/ext/pdo_mysql/php_pdo_mysql_int.h +++ b/ext/pdo_mysql/php_pdo_mysql_int.h @@ -43,7 +43,12 @@ #define PDO_DBG_ERR(msg) do { if (dbg_skip_trace == FALSE) PDO_MYSQL_G(dbg)->m->log(PDO_MYSQL_G(dbg), __LINE__, __FILE__, -1, "error: ", (msg)); } while (0) #define PDO_DBG_INF_FMT(...) do { if (dbg_skip_trace == FALSE) PDO_MYSQL_G(dbg)->m->log_va(PDO_MYSQL_G(dbg), __LINE__, __FILE__, -1, "info : ", __VA_ARGS__); } while (0) #define PDO_DBG_ERR_FMT(...) do { if (dbg_skip_trace == FALSE) PDO_MYSQL_G(dbg)->m->log_va(PDO_MYSQL_G(dbg), __LINE__, __FILE__, -1, "error: ", __VA_ARGS__); } while (0) -#define PDO_DBG_ENTER(func_name) zend_bool dbg_skip_trace = TRUE; if (PDO_MYSQL_G(dbg)) dbg_skip_trace = !PDO_MYSQL_G(dbg)->m->func_enter(PDO_MYSQL_G(dbg), __LINE__, __FILE__, func_name, strlen(func_name)); +#define PDO_DBG_ENTER(func_name) \ + zend_bool dbg_skip_trace = TRUE; \ + ((void) dbg_skip_trace); \ + if (PDO_MYSQL_G(dbg)) \ + dbg_skip_trace = !PDO_MYSQL_G(dbg)->m->func_enter(PDO_MYSQL_G(dbg), __LINE__, __FILE__, func_name, strlen(func_name)); + #define PDO_DBG_RETURN(value) do { if (PDO_MYSQL_G(dbg)) PDO_MYSQL_G(dbg)->m->func_leave(PDO_MYSQL_G(dbg), __LINE__, __FILE__, 0); return (value); } while (0) #define PDO_DBG_VOID_RETURN do { if (PDO_MYSQL_G(dbg)) PDO_MYSQL_G(dbg)->m->func_leave(PDO_MYSQL_G(dbg), __LINE__, __FILE__, 0); return; } while (0) diff --git a/ext/pdo_sqlite/sqlite_statement.c b/ext/pdo_sqlite/sqlite_statement.c index 53d12a719d..9b74b24212 100644 --- a/ext/pdo_sqlite/sqlite_statement.c +++ b/ext/pdo_sqlite/sqlite_statement.c @@ -233,7 +233,7 @@ static int pdo_sqlite_stmt_fetch(pdo_stmt_t *stmt, static int pdo_sqlite_stmt_describe(pdo_stmt_t *stmt, int colno) { pdo_sqlite_stmt *S = (pdo_sqlite_stmt*)stmt->driver_data; - char *str; + const char *str; if(colno >= sqlite3_column_count(S->stmt)) { /* error invalid column */ diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 9282d48364..1172682bbc 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -5803,7 +5803,6 @@ static int php_pgsql_add_quotes(zval *src, zend_bool should_free) PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, zend_ulong opt) { zend_string *field = NULL; - zend_ulong num_idx = -1; zval meta, *def, *type, *not_null, *has_default, *is_enum, *val, new_val; int err = 0, skip_field; php_pgsql_data_type data_type; @@ -5824,7 +5823,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con return FAILURE; } - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(values), num_idx, field, val) { + ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(values), field, val) { skip_field = 0; ZVAL_NULL(&new_val); @@ -6550,7 +6549,6 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var char *tmp; smart_str querystr = {0}; int ret = FAILURE; - zend_ulong num_idx; zend_string *fld; assert(pg_link != NULL); @@ -6579,7 +6577,7 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var build_tablename(&querystr, pg_link, table); smart_str_appends(&querystr, " ("); - ZEND_HASH_FOREACH_KEY(Z_ARRVAL_P(var_array), num_idx, fld) { + ZEND_HASH_FOREACH_STR_KEY(Z_ARRVAL_P(var_array), fld) { if (fld == NULL) { php_error_docref(NULL, E_NOTICE, "Expects associative array for values to be inserted"); goto cleanup; @@ -6748,11 +6746,10 @@ static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr, { char *tmp; char buf[256]; - zend_ulong num_idx; zend_string *fld; zval *val; - ZEND_HASH_FOREACH_KEY_VAL(ht, num_idx, fld, val) { + ZEND_HASH_FOREACH_STR_KEY_VAL(ht, fld, val) { if (fld == NULL) { php_error_docref(NULL, E_NOTICE, "Expects associative array for values to be inserted"); return -1; diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c index 125b09e920..eaec591d9a 100644 --- a/ext/readline/readline_cli.c +++ b/ext/readline/readline_cli.c @@ -587,7 +587,7 @@ static int readline_shell_run(void) /* {{{ */ if (PG(auto_prepend_file) && PG(auto_prepend_file)[0]) { zend_file_handle *prepend_file_p; - zend_file_handle prepend_file = {0}; + zend_file_handle prepend_file = {{0}}; prepend_file.filename = PG(auto_prepend_file); prepend_file.opened_path = NULL; |