win32/HResult: remove unused function FormatHResultError()

This commit is contained in:
Max Kellermann 2023-01-23 15:33:42 +01:00
parent 3cc770a00b
commit 6cc532c9a0
2 changed files with 0 additions and 24 deletions

View File

@ -26,9 +26,7 @@
#include "system/Error.hxx"
#include <cassert>
#include <cstdarg>
#include <cstdio>
#include <memory>
#include <combaseapi.h> // needed by audiopolicy.h if COM_NO_WINDOWS_H is defined
#include <audiopolicy.h>
@ -92,22 +90,3 @@ HResultCategory::message(int Errcode) const
assert(2 <= size && size <= 10);
return std::string(buffer, size);
}
std::system_error
FormatHResultError(HRESULT result, const char *fmt, ...) noexcept
{
std::va_list args1, args2;
va_start(args1, fmt);
va_copy(args2, args1);
const int size = vsnprintf(nullptr, 0, fmt, args1);
va_end(args1);
assert(size >= 0);
auto buffer = std::make_unique<char[]>(size + 1);
vsprintf(buffer.get(), fmt, args2);
va_end(args2);
return std::system_error(std::error_code(result, hresult_category()),
std::string(buffer.get(), size));
}

View File

@ -52,7 +52,4 @@ MakeHResultError(HRESULT result, const char *msg) noexcept
msg);
}
gcc_printf(2, 3) std::system_error
FormatHResultError(HRESULT result, const char *fmt, ...) noexcept;
#endif