瀏覽代碼

KWSys 2021-07-26 (d5fd6ca2)

Code extracted from:

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

at commit d5fd6ca2ba5b4ca04d7ac346ceb87f7d2b0ad8aa (master).

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

Dženan Zukić (1):
      7079df74 SystemTools: Fix GetOperatingSystemNameAndVersion empty string return

Đoàn Trần Công Danh (1):
      4e69b791 SystemInformation: Add option to explicitly avoid using execinfo
KWSys Upstream 4 年之前
父節點
當前提交
7fc3f7001a
共有 2 個文件被更改,包括 6 次插入4 次删除
  1. 3 1
      CMakeLists.txt
  2. 3 3
      SystemTools.cxx

+ 3 - 1
CMakeLists.txt

@@ -46,6 +46,8 @@
 #                               Set to empty string to use no default value.
 #  KWSYS_CXX_COMPILE_FEATURES = target_compile_features arguments for KWSys.
 #
+#  KWSYS_NO_EXECINFO          = Do not use execinfo.
+#
 # Optional settings to setup install rules are as follows:
 #
 #  KWSYS_INSTALL_BIN_DIR     = The installation target directories into
@@ -526,7 +528,7 @@ if(KWSYS_USE_SystemInformation)
     set_property(SOURCE SystemInformation.cxx APPEND PROPERTY
       COMPILE_DEFINITIONS KWSYS_CXX_HAS_RLIMIT64=1)
   endif()
-  if(UNIX)
+  if(UNIX AND NOT KWSYS_NO_EXECINFO)
     include(CheckIncludeFileCXX)
     # check for simple stack trace
     # usually it's in libc but on FreeBSD

+ 3 - 3
SystemTools.cxx

@@ -4360,7 +4360,7 @@ std::string SystemTools::GetOperatingSystemNameAndVersion()
 #  endif
   bOsVersionInfoEx = GetVersionExA((OSVERSIONINFOA*)&osvi);
   if (!bOsVersionInfoEx) {
-    return 0;
+    return "";
   }
 #  ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
 #    ifdef __clang__
@@ -4499,14 +4499,14 @@ std::string SystemTools::GetOperatingSystemNameAndVersion()
                         L"SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
                         0, KEY_QUERY_VALUE, &hKey);
         if (lRet != ERROR_SUCCESS) {
-          return 0;
+          return "";
         }
 
         lRet = RegQueryValueExW(hKey, L"ProductType", nullptr, nullptr,
                                 (LPBYTE)szProductType, &dwBufLen);
 
         if ((lRet != ERROR_SUCCESS) || (dwBufLen > BUFSIZE)) {
-          return 0;
+          return "";
         }
 
         RegCloseKey(hKey);