Browse Source

KWSys 2025-03-01 (1d82baee)

Code extracted from:

    https://gitlab.kitware.com/utils/kwsys.git

at commit 1d82baee88 (master).

Upstream Shortlog
-----------------

leha-bot (1):
      1079929c Status: Fix encoding of error strings on Windows
pull/377/head
KWSys Upstream 5 months ago
committed by Brad King
parent
commit
25ea535aba
  1. 3
      CMakeLists.txt
  2. 10
      Status.cxx

3
CMakeLists.txt

@ -173,6 +173,9 @@ if(KWSYS_USE_Process)
set(KWSYS_USE_System 1)
set(KWSYS_USE_Encoding 1)
endif()
if(KWSYS_USE_Status)
set(KWSYS_USE_Encoding 1)
endif()
if(KWSYS_USE_SystemInformation)
set(KWSYS_USE_Process 1)
endif()

10
Status.cxx

@ -2,10 +2,12 @@
file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
#include "kwsysPrivate.h"
#include KWSYS_HEADER(Status.hxx)
#include KWSYS_HEADER(Encoding.hxx)
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
# include "Encoding.hxx.in"
# include "Status.hxx.in"
#endif
@ -43,13 +45,13 @@ std::string Status::GetString() const
break;
#ifdef _WIN32
case Kind::Windows: {
LPSTR message = NULL;
DWORD size = FormatMessageA(
LPWSTR message = NULL;
DWORD size = FormatMessageW(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, this->Windows_, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR)&message, 0, NULL);
err = std::string(message, size);
(LPWSTR)&message, 0, NULL);
err = kwsys::Encoding::ToNarrow(message);
LocalFree(message);
} break;
#endif

Loading…
Cancel
Save