diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2020-03-20 16:04:40 (GMT) |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2020-03-23 19:19:26 (GMT) |
commit | bfb69f9543bfa7f9f3c9488bf7e740f21896cec4 (patch) | |
tree | 866c20d05a20fae42cf06ef848796ba621d643f2 /Source/CPack | |
parent | 7df84ffe58572a4535b08bc7b76148a60d38fbb4 (diff) | |
download | CMake-bfb69f9543bfa7f9f3c9488bf7e740f21896cec4.zip CMake-bfb69f9543bfa7f9f3c9488bf7e740f21896cec4.tar.gz CMake-bfb69f9543bfa7f9f3c9488bf7e740f21896cec4.tar.bz2 |
replace "substr(0, xx) ==" with cmHasPrefix()
Diffstat (limited to 'Source/CPack')
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWGenerator.cxx | 10 | ||||
-rw-r--r-- | Source/CPack/WiX/cmCPackWIXGenerator.cxx | 3 |
2 files changed, 3 insertions, 10 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 509ac65..2806c61 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -544,10 +544,7 @@ std::string cmCPackIFWGenerator::GetGroupPackageName( if (group->ParentGroup) { cmCPackIFWPackage* package = this->GetGroupPackage(group->ParentGroup); bool dot = !this->ResolveDuplicateNames; - if (dot && name.substr(0, package->Name.size()) == package->Name) { - dot = false; - } - if (dot) { + if (dot && !cmHasPrefix(name, package->Name)) { name = package->Name + "." + name; } } @@ -576,10 +573,7 @@ std::string cmCPackIFWGenerator::GetComponentPackageName( return package->Name; } bool dot = !this->ResolveDuplicateNames; - if (dot && name.substr(0, package->Name.size()) == package->Name) { - dot = false; - } - if (dot) { + if (dot && !cmHasPrefix(name, package->Name)) { name = package->Name + "." + name; } } diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 2ce989c..f29d8d9 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -350,8 +350,7 @@ void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile() std::vector<std::string> options = GetOptions(); for (std::string const& name : options) { - if (name.length() > prefix.length() && - name.substr(0, prefix.length()) == prefix) { + if (cmHasPrefix(name, prefix)) { std::string id = name.substr(prefix.length()); std::string value = GetOption(name.c_str()); |