From d1bc46ffad08e070e24f775dd3e13201d97aeb5d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 30 Jul 2014 21:59:37 +0200 Subject: util/Error: add SetLastError() overload with "DWORD code" parameter --- src/util/Error.cxx | 9 +++++++-- src/util/Error.hxx | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/util/Error.cxx b/src/util/Error.cxx index 649276b20..ef8282329 100644 --- a/src/util/Error.cxx +++ b/src/util/Error.cxx @@ -133,11 +133,16 @@ Error::FormatErrno(const char *fmt, ...) #ifdef WIN32 void -Error::SetLastError(const char *prefix) +Error::SetLastError(DWORD _code, const char *prefix) { - DWORD _code = GetLastError(); const char *msg = g_win32_error_message(_code); Format(win32_domain, int(_code), "%s: %s", prefix, msg); } +void +Error::SetLastError(const char *prefix) +{ + SetLastError(GetLastError(), prefix); +} + #endif diff --git a/src/util/Error.hxx b/src/util/Error.hxx index 803ec002a..82f01105f 100644 --- a/src/util/Error.hxx +++ b/src/util/Error.hxx @@ -166,6 +166,7 @@ public: void FormatErrno(int e, const char *prefix, ...); #ifdef WIN32 + void SetLastError(DWORD _code, const char *prefix); void SetLastError(const char *prefix); #endif }; -- cgit v1.2.3