From ea6292168a6acd4c263913f0ccd7dd64daf4f5cf Mon Sep 17 00:00:00 2001 From: Sandro Jäckel Date: Fri, 23 Feb 2018 01:45:58 +0100 Subject: Revert "Applied clang-format on source" This reverts commit 5e5c9c07291f6b09623d31c92b1fb61c4ede576e. --- src/shared/error_report.cpp | 98 ++++++++++++++++++++++++--------------------- 1 file changed, 52 insertions(+), 46 deletions(-) (limited to 'src/shared/error_report.cpp') diff --git a/src/shared/error_report.cpp b/src/shared/error_report.cpp index fffd77b9..6d091630 100644 --- a/src/shared/error_report.cpp +++ b/src/shared/error_report.cpp @@ -23,71 +23,77 @@ along with Mod Organizer. If not, see . namespace MOShared { -void reportError(LPCSTR format, ...) { - char buffer[1025]; - memset(buffer, 0, sizeof(char) * 1025); - va_list argList; - va_start(argList, format); +void reportError(LPCSTR format, ...) +{ + char buffer[1025]; + memset(buffer, 0, sizeof(char) * 1025); - vsnprintf(buffer, 1024, format, argList); - va_end(argList); + va_list argList; + va_start(argList, format); - MessageBoxA(nullptr, buffer, "Error", MB_OK | MB_ICONERROR); + vsnprintf(buffer, 1024, format, argList); + va_end(argList); + + MessageBoxA(nullptr, buffer, "Error", MB_OK | MB_ICONERROR); } -void reportError(LPCWSTR format, ...) { - WCHAR buffer[1025]; - memset(buffer, 0, sizeof(WCHAR) * 1025); +void reportError(LPCWSTR format, ...) +{ + WCHAR buffer[1025]; + memset(buffer, 0, sizeof(WCHAR) * 1025); - va_list argList; - va_start(argList, format); + va_list argList; + va_start(argList, format); - _vsnwprintf_s(buffer, 1024, format, argList); - va_end(argList); + _vsnwprintf_s(buffer, 1024, format, argList); + va_end(argList); - MessageBoxW(nullptr, buffer, L"Error", MB_OK | MB_ICONERROR); + MessageBoxW(nullptr, buffer, L"Error", MB_OK | MB_ICONERROR); } -std::string getCurrentErrorStringA() { - LPSTR buffer = nullptr; - DWORD errorCode = ::GetLastError(); +std::string getCurrentErrorStringA() +{ + LPSTR buffer = nullptr; + + DWORD errorCode = ::GetLastError(); - if (FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, nullptr, errorCode, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&buffer, 0, nullptr) == 0) { - ::SetLastError(errorCode); - return std::string(); - } else { - LPSTR lastChar = buffer + strlen(buffer) - 2; - *lastChar = '\0'; + if (FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + nullptr, errorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&buffer, 0, nullptr) == 0) { + ::SetLastError(errorCode); + return std::string(); + } else { + LPSTR lastChar = buffer + strlen(buffer) - 2; + *lastChar = '\0'; - std::string result(buffer); + std::string result(buffer); - LocalFree(buffer); - ::SetLastError(errorCode); - return result; - } + LocalFree(buffer); + ::SetLastError(errorCode); + return result; + } } -std::wstring getCurrentErrorStringW() { - LPWSTR buffer = nullptr; +std::wstring getCurrentErrorStringW() +{ + LPWSTR buffer = nullptr; - DWORD errorCode = ::GetLastError(); + DWORD errorCode = ::GetLastError(); - if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, nullptr, errorCode, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&buffer, 0, nullptr) == 0) { - ::SetLastError(errorCode); - return std::wstring(); - } else { - LPWSTR lastChar = buffer + wcslen(buffer) - 2; - *lastChar = '\0'; + if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + nullptr, errorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&buffer, 0, nullptr) == 0) { + ::SetLastError(errorCode); + return std::wstring(); + } else { + LPWSTR lastChar = buffer + wcslen(buffer) - 2; + *lastChar = '\0'; - std::wstring result(buffer); + std::wstring result(buffer); - LocalFree(buffer); - ::SetLastError(errorCode); - return result; - } + LocalFree(buffer); + ::SetLastError(errorCode); + return result; + } } } // namespace MOShared -- cgit v1.3.1