Commit 5d6af189 authored by Charles Milette's avatar Charles Milette

Use target.capacity() even with std::string

parent 484bf073
......@@ -462,12 +462,8 @@ SPDLOG_INLINE void wstr_to_utf8buf(wstring_view_t wstr, memory_buf_t &target)
return;
}
#ifdef SPDLOG_USE_STD_FORMAT
int result_size = 0;
#else
int result_size = static_cast<int>(target.capacity());
if ((wstr_size + 1) * 2 > result_size)
#endif
{
result_size = ::WideCharToMultiByte(CP_UTF8, 0, wstr.data(), wstr_size, NULL, 0, NULL, NULL);
}
......@@ -501,12 +497,8 @@ SPDLOG_INLINE void utf8_to_wstrbuf(string_view_t str, wmemory_buf_t &target)
return;
}
#ifdef SPDLOG_USE_STD_FORMAT
int result_size = 0;
#else
int result_size = static_cast<int>(target.capacity());
if (str_size + 1 > result_size)
#endif
{
result_size = ::MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str.data(), str_size, NULL, 0);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment