diff --git a/src/win32/HResult.cxx b/src/win32/HResult.cxx index 9ca928f9a..6d792e67f 100644 --- a/src/win32/HResult.cxx +++ b/src/win32/HResult.cxx @@ -8,8 +8,9 @@ #include "HResult.hxx" +#include + #include -#include #include // needed by audiopolicy.h if COM_NO_WINDOWS_H is defined #include @@ -69,7 +70,5 @@ HResultCategory::message(int Errcode) const if (!msg.empty()) return std::string(msg); - int size = snprintf(buffer, sizeof(buffer), "0x%1x", Errcode); - assert(2 <= size && size <= 10); - return std::string(buffer, size); + return fmt::format("{:#x}", Errcode); } diff --git a/src/win32/meson.build b/src/win32/meson.build index 28f958a8a..ce71c1990 100644 --- a/src/win32/meson.build +++ b/src/win32/meson.build @@ -10,6 +10,9 @@ win32 = static_library( 'PropVariant.cxx', 'WinEvent.cxx', include_directories: inc, + dependencies: [ + fmt_dep, + ], ) win32_dep = declare_dependency(