From e1e275eefd0ea8bc394a9058244751349cf77b5c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 12 Jun 2019 12:42:53 +0200 Subject: [PATCH] Fix mysqlnd printf modifiers By moving the the standard macros... --- ext/mysqlnd/mysqlnd_ps_codec.c | 6 +++--- ext/mysqlnd/mysqlnd_result.c | 2 +- ext/mysqlnd/mysqlnd_statistics.c | 2 +- ext/mysqlnd/mysqlnd_wireprotocol.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c index 940bcf7ec3..12edd9a284 100644 --- a/ext/mysqlnd/mysqlnd_ps_codec.c +++ b/ext/mysqlnd/mysqlnd_ps_codec.c @@ -79,7 +79,7 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, const u #if SIZEOF_ZEND_LONG==4 if (uval > INT_MAX) { DBG_INF("stringify"); - tmp_len = sprintf((char *)&tmp, MYSQLND_LLU_SPEC, uval); + tmp_len = sprintf((char *)&tmp, "%" PRIu64, uval); } else #endif /* #if SIZEOF_LONG==4 */ { @@ -87,7 +87,7 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, const u ZVAL_LONG(zv, (zend_long) uval); /* the cast is safe, we are in the range */ } else { DBG_INF("stringify"); - tmp_len = sprintf((char *)&tmp, MYSQLND_LLU_SPEC, uval); + tmp_len = sprintf((char *)&tmp, "%" PRIu64, uval); DBG_INF_FMT("value=%s", tmp); } } @@ -109,7 +109,7 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, const u #if SIZEOF_ZEND_LONG==4 if ((L64(2147483647) < (int64_t) lval) || (L64(-2147483648) > (int64_t) lval)) { DBG_INF("stringify"); - tmp_len = sprintf((char *)&tmp, MYSQLND_LL_SPEC, lval); + tmp_len = sprintf((char *)&tmp, "%" PRIi64, lval); } else #endif /* SIZEOF */ { diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c index 5c6eeddd0b..0aa69a0d61 100644 --- a/ext/mysqlnd/mysqlnd_result.c +++ b/ext/mysqlnd/mysqlnd_result.c @@ -246,7 +246,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered, free_result)(MYSQLND_RES_BUFFERED * cons { DBG_ENTER("mysqlnd_result_buffered::free_result"); - DBG_INF_FMT("Freeing "MYSQLND_LLU_SPEC" row(s)", set->row_count); + DBG_INF_FMT("Freeing "PRIu64" row(s)", set->row_count); mysqlnd_error_info_free_contents(&set->error_info); diff --git a/ext/mysqlnd/mysqlnd_statistics.c b/ext/mysqlnd/mysqlnd_statistics.c index 6103f7f93b..2058441254 100644 --- a/ext/mysqlnd/mysqlnd_statistics.c +++ b/ext/mysqlnd/mysqlnd_statistics.c @@ -205,7 +205,7 @@ mysqlnd_fill_stats_hash(const MYSQLND_STATS * const stats, const MYSQLND_STRING for (i = 0; i < stats->count; i++) { char tmp[25]; - sprintf((char *)&tmp, MYSQLND_LLU_SPEC, stats->values[i]); + sprintf((char *)&tmp, "%" PRIu64, stats->values[i]); add_assoc_string_ex(return_value, names[i].s, names[i].l, tmp); } } diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index b56a92c152..6ef48a4a7d 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -1661,7 +1661,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_ROW_BUFFER * row_buffer, zval * if (Z_TYPE_P(current_field) == IS_LONG && !as_int_or_float) { /* we are using the text protocol, so convert to string */ char tmp[22]; - const size_t tmp_len = sprintf((char *)&tmp, MYSQLND_LLU_SPEC, (uint64_t) Z_LVAL_P(current_field)); + const size_t tmp_len = sprintf((char *)&tmp, ZEND_ULONG_FMT, Z_LVAL_P(current_field)); ZVAL_STRINGL(current_field, tmp, tmp_len); } else if (Z_TYPE_P(current_field) == IS_STRING) { /* nothing to do here, as we want a string and ps_fetch_from_1_to_8_bytes() has given us one */ -- 2.40.0