Error: Fix negative formatting of HRESULT

This commit is contained in:
Stenzek 2024-05-07 01:44:02 +10:00 committed by Connor McLaughlin
parent 339dc2313b
commit 1881139b0a
1 changed files with 4 additions and 3 deletions

View File

@ -141,12 +141,13 @@ void Error::SetHResult(std::string_view prefix, long err)
static_cast<DWORD>(std::size(buf)), nullptr); static_cast<DWORD>(std::size(buf)), nullptr);
if (r > 0) if (r > 0)
{ {
m_description = m_description = fmt::format("{}HRESULT {:08X}: {}", prefix, static_cast<unsigned>(err),
fmt::format("{}HRESULT {:08X}: {}", prefix, err, StringUtil::WideStringToUTF8String(std::wstring_view(buf, r))); StringUtil::WideStringToUTF8String(std::wstring_view(buf, r)));
} }
else else
{ {
m_description = fmt::format("{}HRESULT {:08X}: <Could not resolve system error ID>", prefix, err); m_description = fmt::format("{}HRESULT {:08X}: <Could not resolve system error ID>", prefix,
static_cast<unsigned>(err));
} }
} }