Silence C26451

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2025-03-28 10:13:00 +01:00
parent 0f412d5c38
commit f0699d7f47

View File

@ -277,7 +277,7 @@ static int vsprintf(_Inout_ std::basic_string<char, _Traits, _Ax> &str, _In_z_ _
} }
size_t offset = str.size(); size_t offset = str.size();
str.resize(offset + count); str.resize(offset + count);
if (_vsnprintf(&str[offset], count + 1, format, arg) != count) if (_vsnprintf(&str[offset], static_cast<size_t>(count) + 1, format, arg) != count)
throw std::runtime_error("failed to format string"); throw std::runtime_error("failed to format string");
return count; return count;
} }
@ -316,7 +316,7 @@ static int vsprintf(_Inout_ std::basic_string<wchar_t, _Traits, _Ax> &str, _In_z
} }
size_t offset = str.size(); size_t offset = str.size();
str.resize(offset + count); str.resize(offset + count);
if (_vsnwprintf(&str[offset], count + 1, format, arg) != count) if (_vsnwprintf(&str[offset], static_cast<size_t>(count) + 1, format, arg) != count)
throw std::runtime_error("failed to format string"); throw std::runtime_error("failed to format string");
return count; return count;
} }