From 51e076cecb45f240063099bd026b30e36008452b Mon Sep 17 00:00:00 2001 From: Vedansh Bhartia Date: Sun, 16 Jul 2023 10:28:07 +0530 Subject: [PATCH] rgw: typecast long long to int when passing length to format string Signed-off-by: Vedansh Bhartia --- src/rgw/rgw_formats.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/rgw/rgw_formats.cc b/src/rgw/rgw_formats.cc index 3affb5f141425..576c08d9aff73 100644 --- a/src/rgw/rgw_formats.cc +++ b/src/rgw/rgw_formats.cc @@ -167,10 +167,11 @@ void RGWFormatter_Plain::dump_format_va(std::string_view name, const char *ns, b eol = ""; wrote_something = true; - if (use_kv && !entry.is_array) - write_data("%s%.*s: %s", eol, name.size(), name.data(), buf); - else + if (use_kv && !entry.is_array) { + write_data("%s%.*s: %s", eol, static_cast(name.size()), name.data(), buf); + } else { write_data("%s%s", eol, buf); + } } int RGWFormatter_Plain::get_len() const @@ -277,10 +278,11 @@ void RGWFormatter_Plain::dump_value_int(std::string_view name, const char *fmt, eol = ""; wrote_something = true; - if (use_kv && !entry.is_array) - write_data("%s%.*s: %s", eol, name.size(), name.data(), buf); - else + if (use_kv && !entry.is_array) { + write_data("%s%.*s: %s", eol, static_cast(name.size()), name.data(), buf); + } else { write_data("%s%s", eol, buf); + } } -- 2.39.5