diff options
author | Brad King <brad.king@kitware.com> | 2021-10-13 13:03:11 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-10-13 13:03:27 (GMT) |
commit | 315fc296e3c1ecddbf59a2144b0dff9a05c715ed (patch) | |
tree | c095b88a17427f923da7de41b06f2bf94a0ffdd1 | |
parent | 90e56da9e764f4a162399437cf08724d2b14cba6 (diff) | |
parent | 8d14ca3142d869eed7be953e156718f51a855e02 (diff) | |
download | CMake-315fc296e3c1ecddbf59a2144b0dff9a05c715ed.zip CMake-315fc296e3c1ecddbf59a2144b0dff9a05c715ed.tar.gz CMake-315fc296e3c1ecddbf59a2144b0dff9a05c715ed.tar.bz2 |
Merge topic 'update-kwsys'
8d14ca3142 Merge branch 'upstream-KWSys' into update-kwsys
58f046ba26 KWSys 2021-10-08 (b8c734ba)
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6618
-rw-r--r-- | Source/kwsys/CTestConfig.cmake | 4 | ||||
-rw-r--r-- | Source/kwsys/MD5.c | 3 | ||||
-rw-r--r-- | Source/kwsys/SystemTools.cxx | 26 | ||||
-rw-r--r-- | Source/kwsys/SystemTools.hxx.in | 7 | ||||
-rw-r--r-- | Source/kwsys/testSystemTools.cxx | 10 |
5 files changed, 46 insertions, 4 deletions
diff --git a/Source/kwsys/CTestConfig.cmake b/Source/kwsys/CTestConfig.cmake index 12347b6..6484cc2 100644 --- a/Source/kwsys/CTestConfig.cmake +++ b/Source/kwsys/CTestConfig.cmake @@ -3,9 +3,7 @@ set(CTEST_PROJECT_NAME "KWSys") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") -if (NOT CTEST_DROP_METHOD STREQUAL "https") - set(CTEST_DROP_METHOD "http") -endif () +set(CTEST_DROP_METHOD "https") set(CTEST_DROP_SITE "open.cdash.org") set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Source/kwsys/MD5.c b/Source/kwsys/MD5.c index fb18a5b..76995e2 100644 --- a/Source/kwsys/MD5.c +++ b/Source/kwsys/MD5.c @@ -10,6 +10,7 @@ #endif #include <stddef.h> /* size_t */ +#include <stdint.h> /* uintptr_t */ #include <stdlib.h> /* malloc, free */ #include <string.h> /* memcpy, strlen */ @@ -202,7 +203,7 @@ static void md5_process(md5_state_t* pms, const md5_byte_t* data /*[64]*/) * On little-endian machines, we can process properly aligned * data without copying it. */ - if (!((data - (const md5_byte_t*)0) & 3)) { + if (!((uintptr_t)data & 3)) { /* data are properly aligned */ X = (const md5_word_t*)data; } else { diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 930d84c..bd900fe 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -3767,6 +3767,32 @@ bool SystemTools::Split(const std::string& str, return true; } +std::string SystemTools::Join(const std::vector<std::string>& list, + const std::string& separator) +{ + std::string result; + if (list.empty()) { + return result; + } + + size_t total_size = separator.size() * (list.size() - 1); + for (const std::string& string : list) { + total_size += string.size(); + } + + result.reserve(total_size); + bool needs_separator = false; + for (const std::string& string : list) { + if (needs_separator) { + result += separator; + } + result += string; + needs_separator = true; + } + + return result; +} + /** * Return path of a full filename (no trailing slashes). * Warning: returned path is converted to Unix slashes format. diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index e5d115e..dd0cb3b 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -214,6 +214,13 @@ public: char separator); /** + * Joins a vector of strings into a single string, with separator in between + * each string. + */ + static std::string Join(const std::vector<std::string>& list, + const std::string& separator); + + /** * Return string with space added between capitalized words * (i.e. EatMyShorts becomes Eat My Shorts ) * (note that IEatShorts becomes IEat Shorts) diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index 6ccc7a7..f96bd71 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -626,6 +626,16 @@ static bool CheckStringOperations() res = false; } + std::vector<std::string> linesToJoin = { "Mary", "Had", "A", "Little", + "Lamb." }; + std::string joinResult = kwsys::SystemTools::Join(linesToJoin, " "); + if (joinResult != "Mary Had A Little Lamb.") { + std::cerr << "Problem with Join " + "\"Mary Had A Little Lamb.\"" + << std::endl; + res = false; + } + if (kwsys::SystemTools::ConvertToWindowsOutputPath( "L://Local Mojo/Hex Power Pack/Iffy Voodoo") != "\"L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"") { |