mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-03-20 19:21:09 +01:00
library: debug: fix print format in mbedtls_debug_print_buf_ext()
%zu creates problem in MinGW testing. Use MBEDTLS_PRINTF_SIZET intead. Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
@@ -89,10 +89,12 @@
|
||||
#if defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER < 1900)
|
||||
#include <inttypes.h>
|
||||
#define MBEDTLS_PRINTF_SIZET PRIuPTR
|
||||
#define MBEDTLS_PRINTF_SIZET_HEX PRIxPTR
|
||||
#define MBEDTLS_PRINTF_LONGLONG "I64d"
|
||||
#else \
|
||||
/* defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER < 1900) */
|
||||
#define MBEDTLS_PRINTF_SIZET "zu"
|
||||
#define MBEDTLS_PRINTF_SIZET_HEX "zx"
|
||||
#define MBEDTLS_PRINTF_LONGLONG "lld"
|
||||
#endif \
|
||||
/* defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER < 1900) */
|
||||
|
||||
@@ -154,12 +154,13 @@ static void mbedtls_debug_print_buf_ext(const mbedtls_ssl_context *ssl, int leve
|
||||
return;
|
||||
}
|
||||
|
||||
mbedtls_snprintf(str, sizeof(str), "dumping '%s' (%zu bytes)\n", text, len);
|
||||
mbedtls_snprintf(str, sizeof(str), "dumping '%s' (%" MBEDTLS_PRINTF_SIZET " bytes)\n",
|
||||
text, len);
|
||||
debug_send_line(ssl, level, file, line, str);
|
||||
|
||||
while (len > 0) {
|
||||
memset(str, 0, sizeof(str));
|
||||
idx = mbedtls_snprintf(str, sizeof(str), "%04zx: ", curr_offset);
|
||||
idx = mbedtls_snprintf(str, sizeof(str), "%04" MBEDTLS_PRINTF_SIZET_HEX ": ", curr_offset);
|
||||
chunk_len = (len >= 16) ? 16 : len;
|
||||
mbedtls_debug_print_buf_one_line(str + idx, sizeof(str) - idx,
|
||||
&buf[curr_offset], chunk_len,
|
||||
|
||||
Reference in New Issue
Block a user