mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
KWSys 2026-07-28 (b5fb218b)
Code extracted from:
https://gitlab.kitware.com/utils/kwsys.git
at commit b5fb218b6b2b2da08939ff5dfc6dd4e83e87009d (master).
Upstream Shortlog
-----------------
Brad King (1):
9fd9ce30 SystemTools: Remove Strnucmp in favor of String_strncasecmp
Tyler Yankee (1):
3a121a09 SystemTools: Widen string for registry deletion
This commit is contained in:
committed by
Brad King
parent
fd4084d93e
commit
17d84a64e9
+2
-17
@@ -1252,7 +1252,8 @@ bool SystemTools::DeleteRegistryValue(std::string const& key, KeyWOW64 view)
|
||||
&hKey) != ERROR_SUCCESS) {
|
||||
return false;
|
||||
} else {
|
||||
if (RegDeleteValue(hKey, (LPTSTR)valuename.c_str()) == ERROR_SUCCESS) {
|
||||
if (RegDeleteValueW(hKey, Encoding::ToWide(valuename).c_str()) ==
|
||||
ERROR_SUCCESS) {
|
||||
RegCloseKey(hKey);
|
||||
return true;
|
||||
}
|
||||
@@ -2728,22 +2729,6 @@ int SystemTools::Strucmp(char const* l, char const* r)
|
||||
return lc - rc;
|
||||
}
|
||||
|
||||
int SystemTools::Strnucmp(char const* l, char const* r, size_t n)
|
||||
{
|
||||
int lc;
|
||||
int rc;
|
||||
size_t count = 0;
|
||||
do {
|
||||
lc = kwsysString_tolower(*l++);
|
||||
rc = kwsysString_tolower(*r++);
|
||||
count++;
|
||||
if (count >= n) {
|
||||
return lc - rc;
|
||||
}
|
||||
} while (lc == rc && lc);
|
||||
return lc - rc;
|
||||
}
|
||||
|
||||
// return file's modified time
|
||||
long int SystemTools::ModifiedTime(std::string const& filename)
|
||||
{
|
||||
|
||||
+1
-8
@@ -198,17 +198,10 @@ public:
|
||||
char separator = '/',
|
||||
bool isPath = false);
|
||||
/**
|
||||
* Perform a case-independent string comparison.
|
||||
* Similar to POSIX's strcasecmp.
|
||||
* Perform a case-independent string comparison
|
||||
*/
|
||||
static int Strucmp(char const* s1, char const* s2);
|
||||
|
||||
/**
|
||||
* Perform a case-independent string comparison, but compares at most n
|
||||
* characters. Similar to POSIX's strncasecmp.
|
||||
*/
|
||||
static int Strnucmp(char const* s1, char const* s2, size_t n);
|
||||
|
||||
/**
|
||||
* Split a string on its newlines into multiple lines
|
||||
* Return false only if the last line stored had no newline
|
||||
|
||||
@@ -1317,43 +1317,6 @@ static bool CheckSplitString()
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool CheckStringComparisons()
|
||||
{
|
||||
if (!(kwsys::SystemTools::Strucmp("", "") == 0))
|
||||
return false;
|
||||
if (!(kwsys::SystemTools::Strucmp("bob", "bob") == 0))
|
||||
return false;
|
||||
if (!(kwsys::SystemTools::Strucmp("bob", "BOB") == 0))
|
||||
return false;
|
||||
if (!(kwsys::SystemTools::Strucmp("bob1", "BoB2") < 0))
|
||||
return false;
|
||||
if (!(kwsys::SystemTools::Strucmp("bOb4", "Bob3") > 0))
|
||||
return false;
|
||||
if (!(kwsys::SystemTools::Strucmp("aaa", "aaaaaaaaa") < 0))
|
||||
return false;
|
||||
if (!(kwsys::SystemTools::Strucmp("aaaaaaaaa", "aaa") > 1))
|
||||
return false;
|
||||
|
||||
if (!(kwsys::SystemTools::Strnucmp("", "", 0) == 0))
|
||||
return false;
|
||||
if (!(kwsys::SystemTools::Strnucmp("", "", 3000) == 0))
|
||||
return false;
|
||||
if (!(kwsys::SystemTools::Strnucmp("bob", "Bobby", 3) == 0))
|
||||
return false;
|
||||
if (!(kwsys::SystemTools::Strnucmp("Bob", "boBBy", 3) == 0))
|
||||
return false;
|
||||
if (!(kwsys::SystemTools::Strnucmp("bob", "Bobby", 3000) < 0))
|
||||
return false;
|
||||
if (!(kwsys::SystemTools::Strnucmp("bobbY", "BOB", 3000) > 0))
|
||||
return false;
|
||||
if (!(kwsys::SystemTools::Strnucmp("bobb", "Bobby", 5) < 0))
|
||||
return false;
|
||||
if (!(kwsys::SystemTools::Strnucmp("bobbY", "BOBb", 5) > 0))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int testSystemTools(int, char*[])
|
||||
{
|
||||
bool res = true;
|
||||
@@ -1407,7 +1370,5 @@ int testSystemTools(int, char*[])
|
||||
|
||||
res &= CheckSplitString();
|
||||
|
||||
res &= CheckStringComparisons();
|
||||
|
||||
return res ? 0 : 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user