summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2016-02-14 14:02:19 +0100
committerNikita Popov <nikic@php.net>2016-02-14 14:45:53 +0100
commitc9357f82d3882eb3c7cb9f63dbc98d354fb20739 (patch)
treee4733ea1e1f5d866ef8ba6b63eb93b013d95c348 /ext
parent59833783641622160903d56c0aa522db01b59f4c (diff)
downloadphp-git-c9357f82d3882eb3c7cb9f63dbc98d354fb20739.tar.gz
Format string fixes
Conflicts: ext/pgsql/pgsql.c
Diffstat (limited to 'ext')
-rw-r--r--ext/iconv/iconv.c4
-rw-r--r--ext/mcrypt/mcrypt.c4
-rw-r--r--ext/openssl/openssl.c4
-rw-r--r--ext/pdo/pdo_stmt.c11
-rw-r--r--ext/standard/pack.c2
-rw-r--r--ext/standard/var.c9
-rw-r--r--ext/zip/php_zip.c4
-rw-r--r--ext/zlib/zlib.c2
8 files changed, 21 insertions, 19 deletions
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 309258b4c7..4dd6784209 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -424,9 +424,9 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c
char *p = strstr(get_output_encoding(), "//");
if (p) {
- len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%.*s", mimetype_len ? mimetype_len : (size_t) strlen(mimetype), mimetype, (size_t)(p - get_output_encoding()), get_output_encoding());
+ len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%.*s", mimetype_len ? mimetype_len : (int) strlen(mimetype), mimetype, (int) (p - get_output_encoding()), get_output_encoding());
} else {
- len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%s", mimetype_len ? mimetype_len : (size_t) strlen(mimetype), mimetype, get_output_encoding());
+ len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%s", mimetype_len ? mimetype_len : (int) strlen(mimetype), mimetype, get_output_encoding());
}
if (content_type && SUCCESS == sapi_add_header(content_type, (uint)len, 0)) {
SG(sapi_headers).send_default_content_type = 0;
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c
index 536edde425..456c40ae71 100644
--- a/ext/mcrypt/mcrypt.c
+++ b/ext/mcrypt/mcrypt.c
@@ -564,7 +564,7 @@ PHP_FUNCTION(mcrypt_generic_init)
memset(iv_s, 0, iv_size + 1);
if (key_len > max_key_size) {
- php_error_docref(NULL, E_WARNING, "Key size too large; supplied length: %d, max: %d", key_len, max_key_size);
+ php_error_docref(NULL, E_WARNING, "Key size too large; supplied length: %zd, max: %d", key_len, max_key_size);
key_size = max_key_size;
} else {
key_size = (int)key_len;
@@ -572,7 +572,7 @@ PHP_FUNCTION(mcrypt_generic_init)
memcpy(key_s, key, key_len);
if (iv_len != iv_size) {
- php_error_docref(NULL, E_WARNING, "Iv size incorrect; supplied length: %d, needed: %d", iv_len, iv_size);
+ php_error_docref(NULL, E_WARNING, "Iv size incorrect; supplied length: %zd, needed: %d", iv_len, iv_size);
if (iv_len > iv_size) {
iv_len = iv_size;
}
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 4eba110486..464b0b8ca9 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -5213,14 +5213,14 @@ static zend_bool php_openssl_validate_iv(char **piv, size_t *piv_len, size_t iv_
}
if (*piv_len < iv_required_len) {
- php_error_docref(NULL, E_WARNING, "IV passed is only %d bytes long, cipher expects an IV of precisely %d bytes, padding with \\0", *piv_len, iv_required_len);
+ php_error_docref(NULL, E_WARNING, "IV passed is only %zd bytes long, cipher expects an IV of precisely %zd bytes, padding with \\0", *piv_len, iv_required_len);
memcpy(iv_new, *piv, *piv_len);
*piv_len = iv_required_len;
*piv = iv_new;
return 1;
}
- php_error_docref(NULL, E_WARNING, "IV passed is %d bytes long which is longer than the %d expected by selected cipher, truncating", *piv_len, iv_required_len);
+ php_error_docref(NULL, E_WARNING, "IV passed is %zd bytes long which is longer than the %zd expected by selected cipher, truncating", *piv_len, iv_required_len);
memcpy(iv_new, *piv, iv_required_len);
*piv_len = iv_required_len;
*piv = iv_new;
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index 5ca20fcd5b..6019c39aba 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -2107,9 +2107,9 @@ static PHP_METHOD(PDOStatement, debugDumpParams)
RETURN_FALSE;
}
- php_stream_printf(out, "SQL: [%d] %.*s\n",
+ php_stream_printf(out, "SQL: [%zd] %.*s\n",
stmt->query_stringlen,
- stmt->query_stringlen, stmt->query_string);
+ (int) stmt->query_stringlen, stmt->query_string);
php_stream_printf(out, "Params: %d\n",
stmt->bound_params ? zend_hash_num_elements(stmt->bound_params) : 0);
@@ -2119,13 +2119,14 @@ static PHP_METHOD(PDOStatement, debugDumpParams)
zend_string *key = NULL;
ZEND_HASH_FOREACH_KEY_PTR(stmt->bound_params, num, key, param) {
if (key) {
- php_stream_printf(out, "Key: Name: [%d] %.*s\n", ZSTR_LEN(key), ZSTR_LEN(key), ZSTR_VAL(key));
+ php_stream_printf(out, "Key: Name: [%zd] %.*s\n",
+ ZSTR_LEN(key), (int) ZSTR_LEN(key), ZSTR_VAL(key));
} else {
php_stream_printf(out, "Key: Position #%pd:\n", num);
}
- php_stream_printf(out, "paramno=%pd\nname=[%d] \"%.*s\"\nis_param=%d\nparam_type=%d\n",
- param->paramno, param->name? ZSTR_LEN(param->name) : 0, param->name? ZSTR_LEN(param->name) : 0,
+ php_stream_printf(out, "paramno=%pd\nname=[%zd] \"%.*s\"\nis_param=%d\nparam_type=%d\n",
+ param->paramno, param->name ? ZSTR_LEN(param->name) : 0, param->name ? (int) ZSTR_LEN(param->name) : 0,
param->name ? ZSTR_VAL(param->name) : "",
param->is_param,
param->param_type);
diff --git a/ext/standard/pack.c b/ext/standard/pack.c
index ab7e9c71dc..a24ee69ad2 100644
--- a/ext/standard/pack.c
+++ b/ext/standard/pack.c
@@ -986,7 +986,7 @@ PHP_FUNCTION(unpack)
/* Reached end of input for '*' repeater */
break;
} else {
- php_error_docref(NULL, E_WARNING, "Type %c: not enough input, need %d, have %d", type, size, inputlen - inputpos);
+ php_error_docref(NULL, E_WARNING, "Type %c: not enough input, need %d, have " ZEND_LONG_FMT, type, size, inputlen - inputpos);
zval_dtor(return_value);
RETURN_FALSE;
}
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 61a7179dbb..fcee7a9cc6 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -108,7 +108,7 @@ again:
php_printf("%sfloat(%.*G)\n", COMMON, (int) EG(precision), Z_DVAL_P(struc));
break;
case IS_STRING:
- php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_P(struc));
+ php_printf("%sstring(%zd) \"", COMMON, Z_STRLEN_P(struc));
PHPWRITE(Z_STRVAL_P(struc), Z_STRLEN_P(struc));
PUTS("\"\n");
break;
@@ -278,7 +278,7 @@ again:
php_printf("%sfloat(%.*G)\n", COMMON, (int) EG(precision), Z_DVAL_P(struc));
break;
case IS_STRING:
- php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_P(struc));
+ php_printf("%sstring(%zd) \"", COMMON, Z_STRLEN_P(struc));
PHPWRITE(Z_STRVAL_P(struc), Z_STRLEN_P(struc));
php_printf("\" refcount(%u)\n", Z_REFCOUNTED_P(struc) ? Z_REFCOUNT_P(struc) : 1);
break;
@@ -336,7 +336,7 @@ again:
break;
case IS_RESOURCE: {
const char *type_name = zend_rsrc_list_get_rsrc_type(Z_RES_P(struc));
- php_printf("%sresource(" ZEND_LONG_FMT ") of type (%s) refcount(%u)\n", COMMON, Z_RES_P(struc)->handle, type_name ? type_name : "Unknown", Z_REFCOUNT_P(struc));
+ php_printf("%sresource(%d) of type (%s) refcount(%u)\n", COMMON, Z_RES_P(struc)->handle, type_name ? type_name : "Unknown", Z_REFCOUNT_P(struc));
break;
}
case IS_REFERENCE:
@@ -1045,7 +1045,8 @@ PHP_FUNCTION(unserialize)
}
zval_ptr_dtor(return_value);
if (!EG(exception)) {
- php_error_docref(NULL, E_NOTICE, "Error at offset " ZEND_LONG_FMT " of %d bytes", (zend_long)((char*)p - buf), buf_len);
+ php_error_docref(NULL, E_NOTICE, "Error at offset " ZEND_LONG_FMT " of %zd bytes",
+ (zend_long)((char*)p - buf), buf_len);
}
RETURN_FALSE;
}
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index ff3e60e4a9..83c14b5836 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -331,7 +331,7 @@ static int php_zip_parse_options(zval *options, zend_long *remove_all_path, char
}
if (Z_STRLEN_P(option) >= MAXPATHLEN) {
- php_error_docref(NULL, E_WARNING, "remove_path string is too long (max: %i, %i given)",
+ php_error_docref(NULL, E_WARNING, "remove_path string is too long (max: %d, %zd given)",
MAXPATHLEN - 1, Z_STRLEN_P(option));
return -1;
}
@@ -351,7 +351,7 @@ static int php_zip_parse_options(zval *options, zend_long *remove_all_path, char
}
if (Z_STRLEN_P(option) >= MAXPATHLEN) {
- php_error_docref(NULL, E_WARNING, "add_path string too long (max: %i, %i given)",
+ php_error_docref(NULL, E_WARNING, "add_path string too long (max: %d, %zd given)",
MAXPATHLEN - 1, Z_STRLEN_P(option));
return -1;
}
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index eda939d66e..bfca0f42f7 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -1064,7 +1064,7 @@ PHP_FUNCTION(deflate_init)
case Z_DEFAULT_STRATEGY:
break;
default:
- php_error_docref(NULL, E_WARNING, "strategy must be one of ZLIB_FILTERED, ZLIB_HUFFMAN_ONLY, ZLIB_RLE, ZLIB_FIXED or ZLIB_DEFAULT_STRATEGY", strategy);
+ php_error_docref(NULL, E_WARNING, "strategy must be one of ZLIB_FILTERED, ZLIB_HUFFMAN_ONLY, ZLIB_RLE, ZLIB_FIXED or ZLIB_DEFAULT_STRATEGY");
RETURN_FALSE;
}