Access string npos without instance

This commit is contained in:
Pavel Solodovnikov
2017-05-30 22:37:46 +03:00
committed by Brad King
parent 389ed56f63
commit 8b6f439ef2
44 changed files with 199 additions and 184 deletions
+12 -9
View File
@@ -606,7 +606,7 @@ std::string cmLocalUnixMakefileGenerator3::MaybeConvertWatcomShellCommand(
std::string const& cmd)
{
if (this->IsWatcomWMake() && cmSystemTools::FileIsFullPath(cmd.c_str()) &&
cmd.find_first_of("( )") != cmd.npos) {
cmd.find_first_of("( )") != std::string::npos) {
// On Watcom WMake use the windows short path for the command
// name. This is needed to avoid funny quoting problems on
// lines with shell redirection operators.
@@ -852,7 +852,7 @@ void cmLocalUnixMakefileGenerator3::AppendFlags(std::string& flags,
{
if (this->IsWatcomWMake() && !newFlags.empty()) {
std::string newf = newFlags;
if (newf.find("\\\"") != newf.npos) {
if (newf.find("\\\"") != std::string::npos) {
cmSystemTools::ReplaceString(newf, "\\\"", "\"");
this->cmLocalGenerator::AppendFlags(flags, newf);
return;
@@ -978,11 +978,11 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
cmSystemTools::ReplaceString(cmd, "/./", "/");
// Convert the command to a relative path only if the current
// working directory will be the start-output directory.
bool had_slash = cmd.find('/') != cmd.npos;
bool had_slash = cmd.find('/') != std::string::npos;
if (workingDir.empty()) {
cmd = this->MaybeConvertToRelativePath(currentBinDir, cmd);
}
bool has_slash = cmd.find('/') != cmd.npos;
bool has_slash = cmd.find('/') != std::string::npos;
if (had_slash && !has_slash) {
// This command was specified as a path to a file in the
// current directory. Add a leading "./" so it can run
@@ -1039,9 +1039,9 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
// curly braces are removed. The hack can be skipped if the
// first curly brace is the last character.
std::string::size_type lcurly = cmd.find('{');
if (lcurly != cmd.npos && lcurly < (cmd.size() - 1)) {
if (lcurly != std::string::npos && lcurly < (cmd.size() - 1)) {
std::string::size_type rcurly = cmd.find('}');
if (rcurly == cmd.npos || rcurly > lcurly) {
if (rcurly == std::string::npos || rcurly > lcurly) {
// The first curly is a left curly. Use the hack.
std::string hack_cmd = cmd.substr(0, lcurly);
hack_cmd += "{{}";
@@ -1207,9 +1207,12 @@ std::string cmLocalUnixMakefileGenerator3::CreateMakeVariable(
// if there is no restriction on the length of make variables
// and there are no "." characters in the string, then return the
// unmodified combination.
if ((!this->MakefileVariableSize && unmodified.find('.') == s.npos) &&
(!this->MakefileVariableSize && unmodified.find('+') == s.npos) &&
(!this->MakefileVariableSize && unmodified.find('-') == s.npos)) {
if ((!this->MakefileVariableSize &&
unmodified.find('.') == std::string::npos) &&
(!this->MakefileVariableSize &&
unmodified.find('+') == std::string::npos) &&
(!this->MakefileVariableSize &&
unmodified.find('-') == std::string::npos)) {
return unmodified;
}