Merge branch 'upstream-KWSys' into update-kwsys

# By KWSys Upstream
* upstream-KWSys:
  KWSys 2021-10-08 (b8c734ba)
This commit is contained in:
Brad King
2021-10-12 11:38:24 -04:00
5 changed files with 46 additions and 4 deletions

View File

@@ -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)

View File

@@ -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 {

View File

@@ -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.

View File

@@ -213,6 +213,13 @@ public:
static bool Split(const std::string& s, std::vector<std::string>& l,
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 )

View File

@@ -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\"") {