diff --git a/src/win32/HResult.cxx b/src/win32/HResult.cxx index 49e28db25..e81eb7c4a 100644 --- a/src/win32/HResult.cxx +++ b/src/win32/HResult.cxx @@ -26,9 +26,7 @@ #include "system/Error.hxx" #include -#include #include -#include #include // needed by audiopolicy.h if COM_NO_WINDOWS_H is defined #include @@ -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(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)); -} diff --git a/src/win32/HResult.hxx b/src/win32/HResult.hxx index 607c4ecf4..7ddec5138 100644 --- a/src/win32/HResult.hxx +++ b/src/win32/HResult.hxx @@ -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