mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-23 08:18:37 -05:00
Access string npos without instance
This commit is contained in:
committed by
Brad King
parent
389ed56f63
commit
8b6f439ef2
@@ -596,10 +596,10 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(cmXMLWriter& xml)
|
|||||||
// At this point we need to make this->SourceFile relative to
|
// At this point we need to make this->SourceFile relative to
|
||||||
// the source root of the project, so cvs links will work
|
// the source root of the project, so cvs links will work
|
||||||
cmSystemTools::ConvertToUnixSlashes(cm->SourceFile);
|
cmSystemTools::ConvertToUnixSlashes(cm->SourceFile);
|
||||||
if (cm->SourceFile.find("/.../") != cm->SourceFile.npos) {
|
if (cm->SourceFile.find("/.../") != std::string::npos) {
|
||||||
cmSystemTools::ReplaceString(cm->SourceFile, "/.../", "");
|
cmSystemTools::ReplaceString(cm->SourceFile, "/.../", "");
|
||||||
std::string::size_type p = cm->SourceFile.find('/');
|
std::string::size_type p = cm->SourceFile.find('/');
|
||||||
if (p != cm->SourceFile.npos) {
|
if (p != std::string::npos) {
|
||||||
cm->SourceFile =
|
cm->SourceFile =
|
||||||
cm->SourceFile.substr(p + 1, cm->SourceFile.size() - p);
|
cm->SourceFile.substr(p + 1, cm->SourceFile.size() - p);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ public:
|
|||||||
return this->PipeState;
|
return this->PipeState;
|
||||||
}
|
}
|
||||||
int GetProcessState() { return this->PipeState; }
|
int GetProcessState() { return this->PipeState; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int PipeState;
|
int PipeState;
|
||||||
cmsysProcess* Process;
|
cmsysProcess* Process;
|
||||||
@@ -896,7 +897,7 @@ int cmCTestCoverageHandler::HandleBlanketJSCoverage(
|
|||||||
cmsys::ifstream in(files[fileEntry].c_str());
|
cmsys::ifstream in(files[fileEntry].c_str());
|
||||||
cmSystemTools::GetLineFromStream(in, line);
|
cmSystemTools::GetLineFromStream(in, line);
|
||||||
cmSystemTools::GetLineFromStream(in, line);
|
cmSystemTools::GetLineFromStream(in, line);
|
||||||
if (line.find("node-jscoverage") != line.npos) {
|
if (line.find("node-jscoverage") != std::string::npos) {
|
||||||
blanketFiles.push_back(files[fileEntry]);
|
blanketFiles.push_back(files[fileEntry]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1222,7 +1223,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
|
|||||||
// Initially all entries are -1 (not used). If we get coverage
|
// Initially all entries are -1 (not used). If we get coverage
|
||||||
// information, increment it to 0 first.
|
// information, increment it to 0 first.
|
||||||
if (vec[lineIdx] < 0) {
|
if (vec[lineIdx] < 0) {
|
||||||
if (cov > 0 || prefix.find('#') != prefix.npos) {
|
if (cov > 0 || prefix.find('#') != std::string::npos) {
|
||||||
vec[lineIdx] = 0;
|
vec[lineIdx] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1524,7 +1525,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
|
|||||||
// Initially all entries are -1 (not used). If we get coverage
|
// Initially all entries are -1 (not used). If we get coverage
|
||||||
// information, increment it to 0 first.
|
// information, increment it to 0 first.
|
||||||
if (vec[lineIdx] < 0) {
|
if (vec[lineIdx] < 0) {
|
||||||
if (cov > 0 || prefix.find('#') != prefix.npos) {
|
if (cov > 0 || prefix.find('#') != std::string::npos) {
|
||||||
vec[lineIdx] = 0;
|
vec[lineIdx] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2127,7 +2128,7 @@ bool cmCTestCoverageHandler::GetNextInt(std::string const& inputLine,
|
|||||||
std::string::size_type start = pos;
|
std::string::size_type start = pos;
|
||||||
pos = inputLine.find(',', start);
|
pos = inputLine.find(',', start);
|
||||||
value = atoi(inputLine.substr(start, pos).c_str());
|
value = atoi(inputLine.substr(start, pos).c_str());
|
||||||
if (pos == inputLine.npos) {
|
if (pos == std::string::npos) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
pos++;
|
pos++;
|
||||||
@@ -2141,7 +2142,7 @@ bool cmCTestCoverageHandler::ParseBullsEyeCovsrcLine(
|
|||||||
{
|
{
|
||||||
// find the first comma
|
// find the first comma
|
||||||
std::string::size_type pos = inputLine.find(',');
|
std::string::size_type pos = inputLine.find(',');
|
||||||
if (pos == inputLine.npos) {
|
if (pos == std::string::npos) {
|
||||||
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
||||||
"Error parsing string : " << inputLine << "\n");
|
"Error parsing string : " << inputLine << "\n");
|
||||||
return false;
|
return false;
|
||||||
@@ -2168,7 +2169,7 @@ bool cmCTestCoverageHandler::ParseBullsEyeCovsrcLine(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// should be at the end now
|
// should be at the end now
|
||||||
if (pos != inputLine.npos) {
|
if (pos != std::string::npos) {
|
||||||
cmCTestLog(this->CTest, ERROR_MESSAGE, "Error parsing input : "
|
cmCTestLog(this->CTest, ERROR_MESSAGE, "Error parsing input : "
|
||||||
<< inputLine << " last pos not npos = " << pos << "\n");
|
<< inputLine << " last pos not npos = " << pos << "\n");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,9 +191,9 @@ bool cmCTestGIT::UpdateByFetchAndReset()
|
|||||||
std::string line;
|
std::string line;
|
||||||
while (sha1.empty() && cmSystemTools::GetLineFromStream(fin, line)) {
|
while (sha1.empty() && cmSystemTools::GetLineFromStream(fin, line)) {
|
||||||
this->Log << "FETCH_HEAD> " << line << "\n";
|
this->Log << "FETCH_HEAD> " << line << "\n";
|
||||||
if (line.find("\tnot-for-merge\t") == line.npos) {
|
if (line.find("\tnot-for-merge\t") == std::string::npos) {
|
||||||
std::string::size_type pos = line.find('\t');
|
std::string::size_type pos = line.find('\t');
|
||||||
if (pos != line.npos) {
|
if (pos != std::string::npos) {
|
||||||
sha1 = line.substr(0, pos);
|
sha1 = line.substr(0, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -801,7 +801,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
|
|||||||
std::vector<std::string> lines;
|
std::vector<std::string> lines;
|
||||||
cmSystemTools::Split(str.c_str(), lines);
|
cmSystemTools::Split(str.c_str(), lines);
|
||||||
bool unlimitedOutput = false;
|
bool unlimitedOutput = false;
|
||||||
if (str.find("CTEST_FULL_OUTPUT") != str.npos ||
|
if (str.find("CTEST_FULL_OUTPUT") != std::string::npos ||
|
||||||
this->CustomMaximumFailedTestOutputSize == 0) {
|
this->CustomMaximumFailedTestOutputSize == 0) {
|
||||||
unlimitedOutput = true;
|
unlimitedOutput = true;
|
||||||
}
|
}
|
||||||
@@ -953,7 +953,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput(
|
|||||||
std::string& theLine = lines[cc];
|
std::string& theLine = lines[cc];
|
||||||
// check for command line arguments that are not escaped
|
// check for command line arguments that are not escaped
|
||||||
// correctly by BC
|
// correctly by BC
|
||||||
if (theLine.find("TargetArgs=") != theLine.npos) {
|
if (theLine.find("TargetArgs=") != std::string::npos) {
|
||||||
// skip this because BC gets it wrong and we can't parse it
|
// skip this because BC gets it wrong and we can't parse it
|
||||||
} else if (!parser.ParseChunk(theLine.c_str(), theLine.size())) {
|
} else if (!parser.ParseChunk(theLine.c_str(), theLine.size())) {
|
||||||
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
||||||
|
|||||||
@@ -596,8 +596,7 @@ void cmCTestRunTest::ComputeArguments()
|
|||||||
void cmCTestRunTest::DartProcessing()
|
void cmCTestRunTest::DartProcessing()
|
||||||
{
|
{
|
||||||
if (!this->ProcessOutput.empty() &&
|
if (!this->ProcessOutput.empty() &&
|
||||||
this->ProcessOutput.find("<DartMeasurement") !=
|
this->ProcessOutput.find("<DartMeasurement") != std::string::npos) {
|
||||||
this->ProcessOutput.npos) {
|
|
||||||
if (this->TestHandler->DartStuff.find(this->ProcessOutput.c_str())) {
|
if (this->TestHandler->DartStuff.find(this->ProcessOutput.c_str())) {
|
||||||
this->TestResult.DartString = this->TestHandler->DartStuff.match(1);
|
this->TestResult.DartString = this->TestHandler->DartStuff.match(1);
|
||||||
// keep searching and replacing until none are left
|
// keep searching and replacing until none are left
|
||||||
|
|||||||
@@ -595,7 +595,7 @@ void cmCTestSubmitHandler::ParseResponse(
|
|||||||
std::string output;
|
std::string output;
|
||||||
output.append(chunk.begin(), chunk.end());
|
output.append(chunk.begin(), chunk.end());
|
||||||
|
|
||||||
if (output.find("<cdash") != output.npos) {
|
if (output.find("<cdash") != std::string::npos) {
|
||||||
ResponseParser parser;
|
ResponseParser parser;
|
||||||
parser.Parse(output.c_str());
|
parser.Parse(output.c_str());
|
||||||
|
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* This is called when the command is first encountered in
|
* This is called when the command is first encountered in
|
||||||
* the CMakeLists.txt file.
|
* the CMakeLists.txt file.
|
||||||
*/
|
*/
|
||||||
bool InitialPass(std::vector<std::string> const& /*args*/,
|
bool InitialPass(std::vector<std::string> const& /*args*/,
|
||||||
cmExecutionStatus& /*unused*/) CM_OVERRIDE;
|
cmExecutionStatus& /*unused*/) CM_OVERRIDE;
|
||||||
|
|
||||||
@@ -247,7 +247,7 @@ inline int GetNextNumber(std::string const& in, int& val,
|
|||||||
std::string::size_type& pos2)
|
std::string::size_type& pos2)
|
||||||
{
|
{
|
||||||
pos2 = in.find(',', pos);
|
pos2 = in.find(',', pos);
|
||||||
if (pos2 != in.npos) {
|
if (pos2 != std::string::npos) {
|
||||||
if (pos2 - pos == 0) {
|
if (pos2 - pos == 0) {
|
||||||
val = -1;
|
val = -1;
|
||||||
} else {
|
} else {
|
||||||
@@ -273,7 +273,7 @@ inline int GetNextRealNumber(std::string const& in, double& val,
|
|||||||
std::string::size_type& pos2)
|
std::string::size_type& pos2)
|
||||||
{
|
{
|
||||||
pos2 = in.find(',', pos);
|
pos2 = in.find(',', pos);
|
||||||
if (pos2 != in.npos) {
|
if (pos2 != std::string::npos) {
|
||||||
if (pos2 - pos == 0) {
|
if (pos2 - pos == 0) {
|
||||||
val = -1;
|
val = -1;
|
||||||
} else {
|
} else {
|
||||||
@@ -1823,7 +1823,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed()
|
|||||||
std::string::size_type pos;
|
std::string::size_type pos;
|
||||||
while (cmSystemTools::GetLineFromStream(ifs, line)) {
|
while (cmSystemTools::GetLineFromStream(ifs, line)) {
|
||||||
pos = line.find(':', 0);
|
pos = line.find(':', 0);
|
||||||
if (pos == line.npos) {
|
if (pos == std::string::npos) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2027,7 +2027,7 @@ void cmCTestTestHandler::SetTestsToRunInformation(const char* in)
|
|||||||
bool cmCTestTestHandler::CleanTestOutput(std::string& output, size_t length)
|
bool cmCTestTestHandler::CleanTestOutput(std::string& output, size_t length)
|
||||||
{
|
{
|
||||||
if (!length || length >= output.size() ||
|
if (!length || length >= output.size() ||
|
||||||
output.find("CTEST_FULL_OUTPUT") != output.npos) {
|
output.find("CTEST_FULL_OUTPUT") != std::string::npos) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2175,7 +2175,7 @@ bool cmCTestTestHandler::SetTestsProperties(
|
|||||||
}
|
}
|
||||||
if (key == "MEASUREMENT") {
|
if (key == "MEASUREMENT") {
|
||||||
size_t pos = val.find_first_of('=');
|
size_t pos = val.find_first_of('=');
|
||||||
if (pos != val.npos) {
|
if (pos != std::string::npos) {
|
||||||
std::string mKey = val.substr(0, pos);
|
std::string mKey = val.substr(0, pos);
|
||||||
const char* mVal = val.c_str() + pos + 1;
|
const char* mVal = val.c_str() + pos + 1;
|
||||||
rtit->Measurements[mKey] = mVal;
|
rtit->Measurements[mKey] = mVal;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public:
|
|||||||
line.substr(begIndex + 3, endIndex - (begIndex + 4));
|
line.substr(begIndex + 3, endIndex - (begIndex + 4));
|
||||||
return foundFileName;
|
return foundFileName;
|
||||||
}
|
}
|
||||||
return line.substr(begIndex, line.npos);
|
return line.substr(begIndex, std::string::npos);
|
||||||
}
|
}
|
||||||
bool ParseFile(std::string const& file)
|
bool ParseFile(std::string const& file)
|
||||||
{
|
{
|
||||||
@@ -51,13 +51,13 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
while (cmSystemTools::GetLineFromStream(in, line)) {
|
while (cmSystemTools::GetLineFromStream(in, line)) {
|
||||||
if (line.find("filename") != line.npos) {
|
if (line.find("filename") != std::string::npos) {
|
||||||
if (foundFile) {
|
if (foundFile) {
|
||||||
/*
|
/*
|
||||||
* Upon finding a second file name, generate a
|
* Upon finding a second file name, generate a
|
||||||
* vector within the total coverage to capture the
|
* vector within the total coverage to capture the
|
||||||
* information in the local vector
|
* information in the local vector
|
||||||
*/
|
*/
|
||||||
FileLinesType& CoverageVector =
|
FileLinesType& CoverageVector =
|
||||||
this->Coverage.TotalCoverage[filename];
|
this->Coverage.TotalCoverage[filename];
|
||||||
CoverageVector = localCoverageVector;
|
CoverageVector = localCoverageVector;
|
||||||
@@ -66,19 +66,19 @@ public:
|
|||||||
foundFile = true;
|
foundFile = true;
|
||||||
inSource = false;
|
inSource = false;
|
||||||
filename = getValue(line, 0);
|
filename = getValue(line, 0);
|
||||||
} else if ((line.find("coverage") != line.npos) && foundFile &&
|
} else if ((line.find("coverage") != std::string::npos) && foundFile &&
|
||||||
inSource) {
|
inSource) {
|
||||||
/*
|
/*
|
||||||
* two types of "coverage" in the JSON structure
|
* two types of "coverage" in the JSON structure
|
||||||
*
|
*
|
||||||
* The coverage result over the file or set of files
|
* The coverage result over the file or set of files
|
||||||
* and the coverage for each individual line
|
* and the coverage for each individual line
|
||||||
*
|
*
|
||||||
* FoundFile and foundSource ensure that
|
* FoundFile and foundSource ensure that
|
||||||
* only the value of the line coverage is captured
|
* only the value of the line coverage is captured
|
||||||
*/
|
*/
|
||||||
std::string result = getValue(line, 1);
|
std::string result = getValue(line, 1);
|
||||||
result = result.substr(2, result.npos);
|
result = result.substr(2, std::string::npos);
|
||||||
if (result == "\"\"") {
|
if (result == "\"\"") {
|
||||||
// Empty quotation marks indicate that the
|
// Empty quotation marks indicate that the
|
||||||
// line is not executable
|
// line is not executable
|
||||||
@@ -87,7 +87,7 @@ public:
|
|||||||
// Else, it contains the number of time executed
|
// Else, it contains the number of time executed
|
||||||
localCoverageVector.push_back(atoi(result.c_str()));
|
localCoverageVector.push_back(atoi(result.c_str()));
|
||||||
}
|
}
|
||||||
} else if (line.find("source") != line.npos) {
|
} else if (line.find("source") != std::string::npos) {
|
||||||
inSource = true;
|
inSource = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,18 +42,20 @@ public:
|
|||||||
size_t beginPos = line.find("begin");
|
size_t beginPos = line.find("begin");
|
||||||
|
|
||||||
// Check that the begin is the first non-space string on the line
|
// Check that the begin is the first non-space string on the line
|
||||||
if ((beginPos == line.find_first_not_of(' ')) && beginPos != line.npos) {
|
if ((beginPos == line.find_first_not_of(' ')) &&
|
||||||
|
beginPos != std::string::npos) {
|
||||||
beginSet.push_back("begin");
|
beginSet.push_back("begin");
|
||||||
coverageVector.push_back(-1);
|
coverageVector.push_back(-1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (line.find('{') != line.npos) {
|
if (line.find('{') != std::string::npos) {
|
||||||
blockComFlag = true;
|
blockComFlag = true;
|
||||||
} else if (line.find('}') != line.npos) {
|
} else if (line.find('}') != std::string::npos) {
|
||||||
blockComFlag = false;
|
blockComFlag = false;
|
||||||
coverageVector.push_back(-1);
|
coverageVector.push_back(-1);
|
||||||
continue;
|
continue;
|
||||||
} else if ((line.find("end;") != line.npos) && !beginSet.empty()) {
|
} else if ((line.find("end;") != std::string::npos) &&
|
||||||
|
!beginSet.empty()) {
|
||||||
beginSet.pop_back();
|
beginSet.pop_back();
|
||||||
coverageVector.push_back(-1);
|
coverageVector.push_back(-1);
|
||||||
continue;
|
continue;
|
||||||
@@ -62,7 +64,7 @@ public:
|
|||||||
// This checks for comments after lines of code, finding the
|
// This checks for comments after lines of code, finding the
|
||||||
// comment symbol after the ending semicolon.
|
// comment symbol after the ending semicolon.
|
||||||
comPos = line.find("//");
|
comPos = line.find("//");
|
||||||
if (comPos != line.npos) {
|
if (comPos != std::string::npos) {
|
||||||
semiPos = line.find(';');
|
semiPos = line.find(';');
|
||||||
if (comPos < semiPos) {
|
if (comPos < semiPos) {
|
||||||
lineComFlag = true;
|
lineComFlag = true;
|
||||||
@@ -91,20 +93,20 @@ public:
|
|||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This first 'while' section goes through the found HTML
|
* This first 'while' section goes through the found HTML
|
||||||
* file name and attempts to capture the source file name
|
* file name and attempts to capture the source file name
|
||||||
* which is set as part of the HTML file name: the name of
|
* which is set as part of the HTML file name: the name of
|
||||||
* the file is found in parenthesis '()'
|
* the file is found in parenthesis '()'
|
||||||
*
|
*
|
||||||
* See test HTML file name: UTCovTest(UTCovTest.pas).html.
|
* See test HTML file name: UTCovTest(UTCovTest.pas).html.
|
||||||
*
|
*
|
||||||
* Find the text inside each pair of parenthesis and check
|
* Find the text inside each pair of parenthesis and check
|
||||||
* to see if it ends in '.pas'. If it can't be found,
|
* to see if it ends in '.pas'. If it can't be found,
|
||||||
* exit the function.
|
* exit the function.
|
||||||
*/
|
*/
|
||||||
while (true) {
|
while (true) {
|
||||||
lastoffset = line.find('(', pos);
|
lastoffset = line.find('(', pos);
|
||||||
if (lastoffset == line.npos) {
|
if (lastoffset == std::string::npos) {
|
||||||
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, endnamepos
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, endnamepos
|
||||||
<< "File not found " << lastoffset << std::endl,
|
<< "File not found " << lastoffset << std::endl,
|
||||||
this->Coverage.Quiet);
|
this->Coverage.Quiet);
|
||||||
@@ -112,7 +114,7 @@ public:
|
|||||||
}
|
}
|
||||||
endnamepos = line.find(')', lastoffset);
|
endnamepos = line.find(')', lastoffset);
|
||||||
filename = line.substr(lastoffset + 1, (endnamepos - 1) - lastoffset);
|
filename = line.substr(lastoffset + 1, (endnamepos - 1) - lastoffset);
|
||||||
if (filename.find(".pas") != filename.npos) {
|
if (filename.find(".pas") != std::string::npos) {
|
||||||
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Coverage found for file: " << filename
|
"Coverage found for file: " << filename
|
||||||
<< std::endl,
|
<< std::endl,
|
||||||
@@ -122,9 +124,9 @@ public:
|
|||||||
pos = lastoffset + 1;
|
pos = lastoffset + 1;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Glob through the source directory for the
|
* Glob through the source directory for the
|
||||||
* file found above
|
* file found above
|
||||||
*/
|
*/
|
||||||
cmsys::Glob gl;
|
cmsys::Glob gl;
|
||||||
gl.RecurseOn();
|
gl.RecurseOn();
|
||||||
gl.RecurseThroughSymlinksOff();
|
gl.RecurseThroughSymlinksOff();
|
||||||
@@ -133,9 +135,9 @@ public:
|
|||||||
std::vector<std::string> const& files = gl.GetFiles();
|
std::vector<std::string> const& files = gl.GetFiles();
|
||||||
if (files.empty()) {
|
if (files.empty()) {
|
||||||
/*
|
/*
|
||||||
* If that doesn't find any matching files
|
* If that doesn't find any matching files
|
||||||
* return a failure.
|
* return a failure.
|
||||||
*/
|
*/
|
||||||
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Unable to find file matching" << glob << std::endl,
|
"Unable to find file matching" << glob << std::endl,
|
||||||
this->Coverage.Quiet);
|
this->Coverage.Quiet);
|
||||||
@@ -144,9 +146,9 @@ public:
|
|||||||
FileLinesType& coverageVector = this->Coverage.TotalCoverage[files[0]];
|
FileLinesType& coverageVector = this->Coverage.TotalCoverage[files[0]];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the file to have all code between 'begin' and
|
* Initialize the file to have all code between 'begin' and
|
||||||
* 'end' tags marked as executable
|
* 'end' tags marked as executable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
this->initializeDelphiFile(files[0], coverageVector);
|
this->initializeDelphiFile(files[0], coverageVector);
|
||||||
|
|
||||||
@@ -156,19 +158,19 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now read the HTML file, looking for the lines that have an
|
* Now read the HTML file, looking for the lines that have an
|
||||||
* "inline" in it. Then parse out the "class" value of that
|
* "inline" in it. Then parse out the "class" value of that
|
||||||
* line to determine if the line is executed or not.
|
* line to determine if the line is executed or not.
|
||||||
*
|
*
|
||||||
* Sample HTML line:
|
* Sample HTML line:
|
||||||
*
|
*
|
||||||
* <tr class="covered"><td>47</td><td><pre style="display:inline;">
|
* <tr class="covered"><td>47</td><td><pre style="display:inline;">
|
||||||
* CheckEquals(1,2-1);</pre></td></tr>
|
* CheckEquals(1,2-1);</pre></td></tr>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
while (cmSystemTools::GetLineFromStream(in, line)) {
|
while (cmSystemTools::GetLineFromStream(in, line)) {
|
||||||
if (line.find("inline") == line.npos) {
|
if (line.find("inline") == std::string::npos) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ bool cmParseGTMCoverage::ReadMCovFile(const char* file)
|
|||||||
int lastoffset = 0;
|
int lastoffset = 0;
|
||||||
while (cmSystemTools::GetLineFromStream(in, line)) {
|
while (cmSystemTools::GetLineFromStream(in, line)) {
|
||||||
// only look at lines that have coverage data
|
// only look at lines that have coverage data
|
||||||
if (line.find("^ZZCOVERAGE") == line.npos) {
|
if (line.find("^ZZCOVERAGE") == std::string::npos) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::string filepath;
|
std::string filepath;
|
||||||
@@ -199,7 +199,7 @@ bool cmParseGTMCoverage::ParseMCOVLine(std::string const& line,
|
|||||||
// now parse the right hand side of the =
|
// now parse the right hand side of the =
|
||||||
pos = line.find('=');
|
pos = line.find('=');
|
||||||
// no = found, this is an error
|
// no = found, this is an error
|
||||||
if (pos == line.npos) {
|
if (pos == std::string::npos) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
pos++; // move past =
|
pos++; // move past =
|
||||||
|
|||||||
@@ -1050,7 +1050,7 @@ void cmCursesMainForm::JumpToCacheEntry(const char* astr)
|
|||||||
const char* curField = lbl->GetValue();
|
const char* curField = lbl->GetValue();
|
||||||
if (curField) {
|
if (curField) {
|
||||||
std::string cfld = cmSystemTools::LowerCase(curField);
|
std::string cfld = cmSystemTools::LowerCase(curField);
|
||||||
if (cfld.find(str) != cfld.npos && findex != start_index) {
|
if (cfld.find(str) != std::string::npos && findex != start_index) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ bool cmAddCustomCommandCommand::CheckOutputs(
|
|||||||
|
|
||||||
// Make sure the output file name has no invalid characters.
|
// Make sure the output file name has no invalid characters.
|
||||||
std::string::size_type pos = o->find_first_of("#<>");
|
std::string::size_type pos = o->find_first_of("#<>");
|
||||||
if (pos != o->npos) {
|
if (pos != std::string::npos) {
|
||||||
std::ostringstream msg;
|
std::ostringstream msg;
|
||||||
msg << "called with OUTPUT containing a \"" << (*o)[pos]
|
msg << "called with OUTPUT containing a \"" << (*o)[pos]
|
||||||
<< "\". This character is not allowed.";
|
<< "\". This character is not allowed.";
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ bool cmAddCustomTargetCommand::InitialPass(
|
|||||||
std::string const& targetName = args[0];
|
std::string const& targetName = args[0];
|
||||||
|
|
||||||
// Check the target name.
|
// Check the target name.
|
||||||
if (targetName.find_first_of("/\\") != targetName.npos) {
|
if (targetName.find_first_of("/\\") != std::string::npos) {
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
e << "called with invalid target name \"" << targetName
|
e << "called with invalid target name \"" << targetName
|
||||||
<< "\". Target names may not contain a slash. "
|
<< "\". Target names may not contain a slash. "
|
||||||
@@ -144,7 +144,7 @@ bool cmAddCustomTargetCommand::InitialPass(
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string::size_type pos = targetName.find_first_of("#<>");
|
std::string::size_type pos = targetName.find_first_of("#<>");
|
||||||
if (pos != targetName.npos) {
|
if (pos != std::string::npos) {
|
||||||
std::ostringstream msg;
|
std::ostringstream msg;
|
||||||
msg << "called with target name containing a \"" << targetName[pos]
|
msg << "called with target name containing a \"" << targetName[pos]
|
||||||
<< "\". This character is not allowed.";
|
<< "\". This character is not allowed.";
|
||||||
|
|||||||
+9
-9
@@ -119,10 +119,10 @@ std::string cmCTest::CleanString(const std::string& str)
|
|||||||
{
|
{
|
||||||
std::string::size_type spos = str.find_first_not_of(" \n\t\r\f\v");
|
std::string::size_type spos = str.find_first_not_of(" \n\t\r\f\v");
|
||||||
std::string::size_type epos = str.find_last_not_of(" \n\t\r\f\v");
|
std::string::size_type epos = str.find_last_not_of(" \n\t\r\f\v");
|
||||||
if (spos == str.npos) {
|
if (spos == std::string::npos) {
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
if (epos != str.npos) {
|
if (epos != std::string::npos) {
|
||||||
epos = epos - spos + 1;
|
epos = epos - spos + 1;
|
||||||
}
|
}
|
||||||
return str.substr(spos, epos);
|
return str.substr(spos, epos);
|
||||||
@@ -669,12 +669,12 @@ bool cmCTest::UpdateCTestConfiguration()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::string::size_type cpos = line.find_first_of(':');
|
std::string::size_type cpos = line.find_first_of(':');
|
||||||
if (cpos == line.npos) {
|
if (cpos == std::string::npos) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::string key = line.substr(0, cpos);
|
std::string key = line.substr(0, cpos);
|
||||||
std::string value =
|
std::string value =
|
||||||
cmCTest::CleanString(line.substr(cpos + 1, line.npos));
|
cmCTest::CleanString(line.substr(cpos + 1, std::string::npos));
|
||||||
this->CTestConfiguration[key] = value;
|
this->CTestConfiguration[key] = value;
|
||||||
}
|
}
|
||||||
fin.close();
|
fin.close();
|
||||||
@@ -1241,7 +1241,7 @@ std::string cmCTest::SafeBuildIdField(const std::string& value)
|
|||||||
//
|
//
|
||||||
const char* disallowed = "\\:*?\"<>|\n\r\t\f\v";
|
const char* disallowed = "\\:*?\"<>|\n\r\t\f\v";
|
||||||
|
|
||||||
if (safevalue.find_first_of(disallowed) != value.npos) {
|
if (safevalue.find_first_of(disallowed) != std::string::npos) {
|
||||||
std::string::size_type i = 0;
|
std::string::size_type i = 0;
|
||||||
std::string::size_type n = strlen(disallowed);
|
std::string::size_type n = strlen(disallowed);
|
||||||
char replace[2];
|
char replace[2];
|
||||||
@@ -2349,8 +2349,8 @@ std::string cmCTest::GetShortPathToFile(const char* cfname)
|
|||||||
cmSystemTools::RelativePath(buildDir.c_str(), fname.c_str());
|
cmSystemTools::RelativePath(buildDir.c_str(), fname.c_str());
|
||||||
|
|
||||||
// If any contains "." it is not parent directory
|
// If any contains "." it is not parent directory
|
||||||
bool inSrc = srcRelpath.find("..") == srcRelpath.npos;
|
bool inSrc = srcRelpath.find("..") == std::string::npos;
|
||||||
bool inBld = bldRelpath.find("..") == bldRelpath.npos;
|
bool inBld = bldRelpath.find("..") == std::string::npos;
|
||||||
// TODO: Handle files with .. in their name
|
// TODO: Handle files with .. in their name
|
||||||
|
|
||||||
std::string* res = CM_NULLPTR;
|
std::string* res = CM_NULLPTR;
|
||||||
@@ -2509,7 +2509,7 @@ void cmCTest::AddSubmitFile(Part part, const char* name)
|
|||||||
void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr)
|
void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr)
|
||||||
{
|
{
|
||||||
size_t epos = overStr.find('=');
|
size_t epos = overStr.find('=');
|
||||||
if (epos == overStr.npos) {
|
if (epos == std::string::npos) {
|
||||||
cmCTestLog(this, ERROR_MESSAGE,
|
cmCTestLog(this, ERROR_MESSAGE,
|
||||||
"CTest configuration overwrite specified in the wrong format."
|
"CTest configuration overwrite specified in the wrong format."
|
||||||
<< std::endl
|
<< std::endl
|
||||||
@@ -2518,7 +2518,7 @@ void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::string key = overStr.substr(0, epos);
|
std::string key = overStr.substr(0, epos);
|
||||||
std::string value = overStr.substr(epos + 1, overStr.npos);
|
std::string value = overStr.substr(epos + 1, std::string::npos);
|
||||||
this->CTestConfigurationOverwrites[key] = value;
|
this->CTestConfigurationOverwrites[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ void cmCacheManager::OutputKey(std::ostream& fout, std::string const& key)
|
|||||||
{
|
{
|
||||||
// support : in key name by double quoting
|
// support : in key name by double quoting
|
||||||
const char* q =
|
const char* q =
|
||||||
(key.find(':') != key.npos || key.find("//") == 0) ? "\"" : "";
|
(key.find(':') != std::string::npos || key.find("//") == 0) ? "\"" : "";
|
||||||
fout << q << key << q;
|
fout << q << key << q;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -490,7 +490,7 @@ void cmCacheManager::AddCacheEntry(const std::string& key, const char* value,
|
|||||||
e.Type = type;
|
e.Type = type;
|
||||||
// make sure we only use unix style paths
|
// make sure we only use unix style paths
|
||||||
if (type == cmStateEnums::FILEPATH || type == cmStateEnums::PATH) {
|
if (type == cmStateEnums::FILEPATH || type == cmStateEnums::PATH) {
|
||||||
if (e.Value.find(';') != e.Value.npos) {
|
if (e.Value.find(';') != std::string::npos) {
|
||||||
std::vector<std::string> paths;
|
std::vector<std::string> paths;
|
||||||
cmSystemTools::ExpandListArgument(e.Value, paths);
|
cmSystemTools::ExpandListArgument(e.Value, paths);
|
||||||
const char* sep = "";
|
const char* sep = "";
|
||||||
|
|||||||
@@ -1033,8 +1033,8 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item)
|
|||||||
// See documentation of CMP0008.
|
// See documentation of CMP0008.
|
||||||
std::string generator = this->GlobalGenerator->GetName();
|
std::string generator = this->GlobalGenerator->GetName();
|
||||||
if (this->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW &&
|
if (this->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW &&
|
||||||
(generator.find("Visual Studio") != generator.npos ||
|
(generator.find("Visual Studio") != std::string::npos ||
|
||||||
generator.find("Xcode") != generator.npos)) {
|
generator.find("Xcode") != std::string::npos)) {
|
||||||
std::string file = cmSystemTools::GetFilenameName(item);
|
std::string file = cmSystemTools::GetFilenameName(item);
|
||||||
if (!this->ExtractAnyLibraryName.find(file.c_str())) {
|
if (!this->ExtractAnyLibraryName.find(file.c_str())) {
|
||||||
this->HandleBadFullItem(item, file);
|
this->HandleBadFullItem(item, file);
|
||||||
|
|||||||
@@ -672,7 +672,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
|
|||||||
fprintf(fout, " \"%s\"", si->c_str());
|
fprintf(fout, " \"%s\"", si->c_str());
|
||||||
|
|
||||||
// Add dependencies on any non-temporary sources.
|
// Add dependencies on any non-temporary sources.
|
||||||
if (si->find("CMakeTmp") == si->npos) {
|
if (si->find("CMakeTmp") == std::string::npos) {
|
||||||
this->Makefile->AddCMakeDependFile(*si);
|
this->Makefile->AddCMakeDependFile(*si);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -449,11 +449,11 @@ void cmDependsC::ParseTransform(std::string const& xform)
|
|||||||
// A transform rule is of the form SOME_MACRO(%)=value-with-%
|
// A transform rule is of the form SOME_MACRO(%)=value-with-%
|
||||||
// We can simply separate with "(%)=".
|
// We can simply separate with "(%)=".
|
||||||
std::string::size_type pos = xform.find("(%)=");
|
std::string::size_type pos = xform.find("(%)=");
|
||||||
if (pos == xform.npos || pos == 0) {
|
if (pos == std::string::npos || pos == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::string name = xform.substr(0, pos);
|
std::string name = xform.substr(0, pos);
|
||||||
std::string value = xform.substr(pos + 4, xform.npos);
|
std::string value = xform.substr(pos + 4, std::string::npos);
|
||||||
this->TransformRules[name] = value;
|
this->TransformRules[name] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -590,16 +590,17 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
|
|||||||
std::string::size_type pos = 0;
|
std::string::size_type pos = 0;
|
||||||
std::string::size_type lastPos = pos;
|
std::string::size_type lastPos = pos;
|
||||||
|
|
||||||
while ((pos = input.find("$<TARGET_PROPERTY:", lastPos)) != input.npos) {
|
while ((pos = input.find("$<TARGET_PROPERTY:", lastPos)) !=
|
||||||
|
std::string::npos) {
|
||||||
std::string::size_type nameStartPos =
|
std::string::size_type nameStartPos =
|
||||||
pos + sizeof("$<TARGET_PROPERTY:") - 1;
|
pos + sizeof("$<TARGET_PROPERTY:") - 1;
|
||||||
std::string::size_type closePos = input.find('>', nameStartPos);
|
std::string::size_type closePos = input.find('>', nameStartPos);
|
||||||
std::string::size_type commaPos = input.find(',', nameStartPos);
|
std::string::size_type commaPos = input.find(',', nameStartPos);
|
||||||
std::string::size_type nextOpenPos = input.find("$<", nameStartPos);
|
std::string::size_type nextOpenPos = input.find("$<", nameStartPos);
|
||||||
if (commaPos == input.npos // Implied 'this' target
|
if (commaPos == std::string::npos // Implied 'this' target
|
||||||
|| closePos == input.npos // Imcomplete expression.
|
|| closePos == std::string::npos // Imcomplete expression.
|
||||||
|| closePos < commaPos // Implied 'this' target
|
|| closePos < commaPos // Implied 'this' target
|
||||||
|| nextOpenPos < commaPos) // Non-literal
|
|| nextOpenPos < commaPos) // Non-literal
|
||||||
{
|
{
|
||||||
lastPos = nameStartPos;
|
lastPos = nameStartPos;
|
||||||
continue;
|
continue;
|
||||||
@@ -617,15 +618,15 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
|
|||||||
std::string errorString;
|
std::string errorString;
|
||||||
pos = 0;
|
pos = 0;
|
||||||
lastPos = pos;
|
lastPos = pos;
|
||||||
while ((pos = input.find("$<TARGET_NAME:", lastPos)) != input.npos) {
|
while ((pos = input.find("$<TARGET_NAME:", lastPos)) != std::string::npos) {
|
||||||
std::string::size_type nameStartPos = pos + sizeof("$<TARGET_NAME:") - 1;
|
std::string::size_type nameStartPos = pos + sizeof("$<TARGET_NAME:") - 1;
|
||||||
std::string::size_type endPos = input.find('>', nameStartPos);
|
std::string::size_type endPos = input.find('>', nameStartPos);
|
||||||
if (endPos == input.npos) {
|
if (endPos == std::string::npos) {
|
||||||
errorString = "$<TARGET_NAME:...> expression incomplete";
|
errorString = "$<TARGET_NAME:...> expression incomplete";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
std::string targetName = input.substr(nameStartPos, endPos - nameStartPos);
|
std::string targetName = input.substr(nameStartPos, endPos - nameStartPos);
|
||||||
if (targetName.find("$<") != input.npos) {
|
if (targetName.find("$<") != std::string::npos) {
|
||||||
errorString = "$<TARGET_NAME:...> requires its parameter to be a "
|
errorString = "$<TARGET_NAME:...> requires its parameter to be a "
|
||||||
"literal.";
|
"literal.";
|
||||||
break;
|
break;
|
||||||
@@ -642,10 +643,10 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
|
|||||||
pos = 0;
|
pos = 0;
|
||||||
lastPos = pos;
|
lastPos = pos;
|
||||||
while (errorString.empty() &&
|
while (errorString.empty() &&
|
||||||
(pos = input.find("$<LINK_ONLY:", lastPos)) != input.npos) {
|
(pos = input.find("$<LINK_ONLY:", lastPos)) != std::string::npos) {
|
||||||
std::string::size_type nameStartPos = pos + sizeof("$<LINK_ONLY:") - 1;
|
std::string::size_type nameStartPos = pos + sizeof("$<LINK_ONLY:") - 1;
|
||||||
std::string::size_type endPos = input.find('>', nameStartPos);
|
std::string::size_type endPos = input.find('>', nameStartPos);
|
||||||
if (endPos == input.npos) {
|
if (endPos == std::string::npos) {
|
||||||
errorString = "$<LINK_ONLY:...> expression incomplete";
|
errorString = "$<LINK_ONLY:...> expression incomplete";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -255,7 +255,8 @@ void cmExportInstallFileGenerator::ReplaceInstallPrefix(std::string& input)
|
|||||||
std::string::size_type pos = 0;
|
std::string::size_type pos = 0;
|
||||||
std::string::size_type lastPos = pos;
|
std::string::size_type lastPos = pos;
|
||||||
|
|
||||||
while ((pos = input.find("$<INSTALL_PREFIX>", lastPos)) != input.npos) {
|
while ((pos = input.find("$<INSTALL_PREFIX>", lastPos)) !=
|
||||||
|
std::string::npos) {
|
||||||
std::string::size_type endPos = pos + sizeof("$<INSTALL_PREFIX>") - 1;
|
std::string::size_type endPos = pos + sizeof("$<INSTALL_PREFIX>") - 1;
|
||||||
input.replace(pos, endPos - pos, "${_IMPORT_PREFIX}");
|
input.replace(pos, endPos - pos, "${_IMPORT_PREFIX}");
|
||||||
lastPos = endPos;
|
lastPos = endPos;
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ void cmFindCommon::AddPathSuffix(std::string const& arg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (suffix[0] == '/') {
|
if (suffix[0] == '/') {
|
||||||
suffix = suffix.substr(1, suffix.npos);
|
suffix = suffix.substr(1, std::string::npos);
|
||||||
}
|
}
|
||||||
if (suffix.empty()) {
|
if (suffix.empty()) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ bool cmFindLibraryHelper::HasValidSuffix(std::string const& name)
|
|||||||
// Check if a valid library suffix is somewhere in the name,
|
// Check if a valid library suffix is somewhere in the name,
|
||||||
// this may happen e.g. for versioned shared libraries: libfoo.so.2
|
// this may happen e.g. for versioned shared libraries: libfoo.so.2
|
||||||
suffix += ".";
|
suffix += ".";
|
||||||
if (name.find(suffix) != name.npos) {
|
if (name.find(suffix) != std::string::npos) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
|
|||||||
} else if (doing == DoingPathSuffixes) {
|
} else if (doing == DoingPathSuffixes) {
|
||||||
this->AddPathSuffix(args[i]);
|
this->AddPathSuffix(args[i]);
|
||||||
} else if (doing == DoingConfigs) {
|
} else if (doing == DoingConfigs) {
|
||||||
if (args[i].find_first_of(":/\\") != args[i].npos ||
|
if (args[i].find_first_of(":/\\") != std::string::npos ||
|
||||||
cmSystemTools::GetFilenameLastExtension(args[i]) != ".cmake") {
|
cmSystemTools::GetFilenameLastExtension(args[i]) != ".cmake") {
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
e << "given CONFIGS option followed by invalid file name \"" << args[i]
|
e << "given CONFIGS option followed by invalid file name \"" << args[i]
|
||||||
@@ -1593,6 +1593,7 @@ class cmFileListGeneratorBase
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~cmFileListGeneratorBase() {}
|
virtual ~cmFileListGeneratorBase() {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool Consider(std::string const& fullPath, cmFileList& listing);
|
bool Consider(std::string const& fullPath, cmFileList& listing);
|
||||||
|
|
||||||
|
|||||||
@@ -76,14 +76,14 @@ std::string cmFindPathCommand::FindHeaderInFramework(std::string const& file,
|
|||||||
// if there is a / in the name try to find the header as a framework
|
// if there is a / in the name try to find the header as a framework
|
||||||
// For example bar/foo.h would look for:
|
// For example bar/foo.h would look for:
|
||||||
// bar.framework/Headers/foo.h
|
// bar.framework/Headers/foo.h
|
||||||
if (pos != fileName.npos) {
|
if (pos != std::string::npos) {
|
||||||
// remove the name from the slash;
|
// remove the name from the slash;
|
||||||
fileName = fileName.substr(pos + 1);
|
fileName = fileName.substr(pos + 1);
|
||||||
frameWorkName = file;
|
frameWorkName = file;
|
||||||
frameWorkName =
|
frameWorkName =
|
||||||
frameWorkName.substr(0, frameWorkName.size() - fileName.size() - 1);
|
frameWorkName.substr(0, frameWorkName.size() - fileName.size() - 1);
|
||||||
// if the framework has a path in it then just use the filename
|
// if the framework has a path in it then just use the filename
|
||||||
if (frameWorkName.find('/') != frameWorkName.npos) {
|
if (frameWorkName.find('/') != std::string::npos) {
|
||||||
fileName = file;
|
fileName = file;
|
||||||
frameWorkName = "";
|
frameWorkName = "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ cmCompiledGeneratorExpression::~cmCompiledGeneratorExpression()
|
|||||||
std::string cmGeneratorExpression::StripEmptyListElements(
|
std::string cmGeneratorExpression::StripEmptyListElements(
|
||||||
const std::string& input)
|
const std::string& input)
|
||||||
{
|
{
|
||||||
if (input.find(';') == input.npos) {
|
if (input.find(';') == std::string::npos) {
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
std::string result;
|
std::string result;
|
||||||
@@ -161,7 +161,7 @@ static std::string stripAllGeneratorExpressions(const std::string& input)
|
|||||||
std::string::size_type pos = 0;
|
std::string::size_type pos = 0;
|
||||||
std::string::size_type lastPos = pos;
|
std::string::size_type lastPos = pos;
|
||||||
int nestingLevel = 0;
|
int nestingLevel = 0;
|
||||||
while ((pos = input.find("$<", lastPos)) != input.npos) {
|
while ((pos = input.find("$<", lastPos)) != std::string::npos) {
|
||||||
result += input.substr(lastPos, pos - lastPos);
|
result += input.substr(lastPos, pos - lastPos);
|
||||||
pos += 2;
|
pos += 2;
|
||||||
nestingLevel = 1;
|
nestingLevel = 1;
|
||||||
@@ -290,7 +290,7 @@ void cmGeneratorExpression::Split(const std::string& input,
|
|||||||
{
|
{
|
||||||
std::string::size_type pos = 0;
|
std::string::size_type pos = 0;
|
||||||
std::string::size_type lastPos = pos;
|
std::string::size_type lastPos = pos;
|
||||||
while ((pos = input.find("$<", lastPos)) != input.npos) {
|
while ((pos = input.find("$<", lastPos)) != std::string::npos) {
|
||||||
std::string part = input.substr(lastPos, pos - lastPos);
|
std::string part = input.substr(lastPos, pos - lastPos);
|
||||||
std::string preGenex;
|
std::string preGenex;
|
||||||
if (!part.empty()) {
|
if (!part.empty()) {
|
||||||
|
|||||||
@@ -5148,11 +5148,11 @@ std::string cmGeneratorTarget::CheckCMP0004(std::string const& item) const
|
|||||||
// do the expansion but users link to libraries like " ${VAR} ".
|
// do the expansion but users link to libraries like " ${VAR} ".
|
||||||
std::string lib = item;
|
std::string lib = item;
|
||||||
std::string::size_type pos = lib.find_first_not_of(" \t\r\n");
|
std::string::size_type pos = lib.find_first_not_of(" \t\r\n");
|
||||||
if (pos != lib.npos) {
|
if (pos != std::string::npos) {
|
||||||
lib = lib.substr(pos, lib.npos);
|
lib = lib.substr(pos, std::string::npos);
|
||||||
}
|
}
|
||||||
pos = lib.find_last_not_of(" \t\r\n");
|
pos = lib.find_last_not_of(" \t\r\n");
|
||||||
if (pos != lib.npos) {
|
if (pos != std::string::npos) {
|
||||||
lib = lib.substr(0, pos + 1);
|
lib = lib.substr(0, pos + 1);
|
||||||
}
|
}
|
||||||
if (lib != item) {
|
if (lib != item) {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ bool cmGetFilenameComponentCommand::InitialPass(
|
|||||||
|
|
||||||
std::string result;
|
std::string result;
|
||||||
std::string filename = args[1];
|
std::string filename = args[1];
|
||||||
if (filename.find("[HKEY") != filename.npos) {
|
if (filename.find("[HKEY") != std::string::npos) {
|
||||||
// Check the registry as the target application would view it.
|
// Check the registry as the target application would view it.
|
||||||
cmSystemTools::KeyWOW64 view = cmSystemTools::KeyWOW64_32;
|
cmSystemTools::KeyWOW64 view = cmSystemTools::KeyWOW64_32;
|
||||||
cmSystemTools::KeyWOW64 other_view = cmSystemTools::KeyWOW64_64;
|
cmSystemTools::KeyWOW64 other_view = cmSystemTools::KeyWOW64_64;
|
||||||
@@ -37,10 +37,10 @@ bool cmGetFilenameComponentCommand::InitialPass(
|
|||||||
other_view = cmSystemTools::KeyWOW64_32;
|
other_view = cmSystemTools::KeyWOW64_32;
|
||||||
}
|
}
|
||||||
cmSystemTools::ExpandRegistryValues(filename, view);
|
cmSystemTools::ExpandRegistryValues(filename, view);
|
||||||
if (filename.find("/registry") != filename.npos) {
|
if (filename.find("/registry") != std::string::npos) {
|
||||||
std::string other = args[1];
|
std::string other = args[1];
|
||||||
cmSystemTools::ExpandRegistryValues(other, other_view);
|
cmSystemTools::ExpandRegistryValues(other, other_view);
|
||||||
if (other.find("/registry") == other.npos) {
|
if (other.find("/registry") == std::string::npos) {
|
||||||
filename = other;
|
filename = other;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ bool cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
|
|||||||
// if there are spaces in the make program use short path
|
// if there are spaces in the make program use short path
|
||||||
// but do not short path the actual program name, as
|
// but do not short path the actual program name, as
|
||||||
// this can cause trouble with VSExpress
|
// this can cause trouble with VSExpress
|
||||||
if (makeProgram.find(' ') != makeProgram.npos) {
|
if (makeProgram.find(' ') != std::string::npos) {
|
||||||
std::string dir;
|
std::string dir;
|
||||||
std::string file;
|
std::string file;
|
||||||
cmSystemTools::SplitProgramPath(makeProgram, dir, file);
|
cmSystemTools::SplitProgramPath(makeProgram, dir, file);
|
||||||
@@ -2730,7 +2730,7 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the filename.
|
// Get the filename.
|
||||||
fname = line.substr(33, line.npos);
|
fname = line.substr(33, std::string::npos);
|
||||||
|
|
||||||
// Look for a hash for this file's rule.
|
// Look for a hash for this file's rule.
|
||||||
std::map<std::string, RuleHash>::const_iterator rhi =
|
std::map<std::string, RuleHash>::const_iterator rhi =
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(
|
|||||||
std::string::size_type pos;
|
std::string::size_type pos;
|
||||||
if (cmSystemTools::RunSingleCommand("xcode-select --print-path", &out, 0,
|
if (cmSystemTools::RunSingleCommand("xcode-select --print-path", &out, 0,
|
||||||
0, 0, cmSystemTools::OUTPUT_NONE) &&
|
0, 0, cmSystemTools::OUTPUT_NONE) &&
|
||||||
(pos = out.find(".app/"), pos != out.npos)) {
|
(pos = out.find(".app/"), pos != std::string::npos)) {
|
||||||
versionFile = out.substr(0, pos + 5) + "Contents/version.plist";
|
versionFile = out.substr(0, pos + 5) + "Contents/version.plist";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -244,7 +244,7 @@ std::string cmGlobalXCodeGenerator::FindXcodeBuildCommand()
|
|||||||
bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts,
|
bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts,
|
||||||
cmMakefile* mf)
|
cmMakefile* mf)
|
||||||
{
|
{
|
||||||
if (ts.find_first_of(",=") != ts.npos) {
|
if (ts.find_first_of(",=") != std::string::npos) {
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
e <<
|
e <<
|
||||||
@@ -1400,7 +1400,7 @@ std::string cmGlobalXCodeGenerator::ExtractFlag(const char* flag,
|
|||||||
std::string retFlag;
|
std::string retFlag;
|
||||||
std::string::size_type lastOccurancePos = flags.rfind(flag);
|
std::string::size_type lastOccurancePos = flags.rfind(flag);
|
||||||
bool saved = false;
|
bool saved = false;
|
||||||
while (lastOccurancePos != flags.npos) {
|
while (lastOccurancePos != std::string::npos) {
|
||||||
// increment pos, we use lastOccurancePos to reduce search space on next
|
// increment pos, we use lastOccurancePos to reduce search space on next
|
||||||
// inc
|
// inc
|
||||||
std::string::size_type pos = lastOccurancePos;
|
std::string::size_type pos = lastOccurancePos;
|
||||||
@@ -3423,7 +3423,7 @@ std::string cmGlobalXCodeGenerator::RelativeToBinary(const char* p)
|
|||||||
|
|
||||||
std::string cmGlobalXCodeGenerator::XCodeEscapePath(const std::string& p)
|
std::string cmGlobalXCodeGenerator::XCodeEscapePath(const std::string& p)
|
||||||
{
|
{
|
||||||
if (p.find(' ') != p.npos) {
|
if (p.find(' ') != std::string::npos) {
|
||||||
std::string t = "\"";
|
std::string t = "\"";
|
||||||
t += p;
|
t += p;
|
||||||
t += "\"";
|
t += "\"";
|
||||||
@@ -3511,7 +3511,7 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags,
|
|||||||
|
|
||||||
// Check if the flag needs quoting.
|
// Check if the flag needs quoting.
|
||||||
bool quoteFlag =
|
bool quoteFlag =
|
||||||
flag.find_first_of("`~!@#$%^&*()+={}[]|:;\"'<>,.? ") != flag.npos;
|
flag.find_first_of("`~!@#$%^&*()+={}[]|:;\"'<>,.? ") != std::string::npos;
|
||||||
|
|
||||||
// We escape a flag as follows:
|
// We escape a flag as follows:
|
||||||
// - Place each flag in single quotes ''
|
// - Place each flag in single quotes ''
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ void cmIncludeDirectoryCommand::NormalizeInclude(std::string& inc)
|
|||||||
{
|
{
|
||||||
std::string::size_type b = inc.find_first_not_of(" \r");
|
std::string::size_type b = inc.find_first_not_of(" \r");
|
||||||
std::string::size_type e = inc.find_last_not_of(" \r");
|
std::string::size_type e = inc.find_last_not_of(" \r");
|
||||||
if ((b != inc.npos) && (e != inc.npos)) {
|
if ((b != std::string::npos) && (e != std::string::npos)) {
|
||||||
inc.assign(inc, b, 1 + e - b); // copy the remaining substring
|
inc.assign(inc, b, 1 + e - b); // copy the remaining substring
|
||||||
} else {
|
} else {
|
||||||
inc = "";
|
inc = "";
|
||||||
|
|||||||
@@ -1210,7 +1210,7 @@ bool cmInstallCommand::HandleExportAndroidMKMode(
|
|||||||
|
|
||||||
// Check the file name.
|
// Check the file name.
|
||||||
std::string fname = filename.GetString();
|
std::string fname = filename.GetString();
|
||||||
if (fname.find_first_of(":/\\") != fname.npos) {
|
if (fname.find_first_of(":/\\") != std::string::npos) {
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
e << args[0] << " given invalid export file name \"" << fname << "\". "
|
e << args[0] << " given invalid export file name \"" << fname << "\". "
|
||||||
<< "The FILE argument may not contain a path. "
|
<< "The FILE argument may not contain a path. "
|
||||||
@@ -1228,7 +1228,7 @@ bool cmInstallCommand::HandleExportAndroidMKMode(
|
|||||||
this->SetError(e.str());
|
this->SetError(e.str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (fname.find_first_of(":/\\") != fname.npos) {
|
if (fname.find_first_of(":/\\") != std::string::npos) {
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
e << args[0] << " given export name \"" << exp.GetString() << "\". "
|
e << args[0] << " given export name \"" << exp.GetString() << "\". "
|
||||||
<< "This name cannot be safely converted to a file name. "
|
<< "This name cannot be safely converted to a file name. "
|
||||||
@@ -1302,7 +1302,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
|
|||||||
|
|
||||||
// Check the file name.
|
// Check the file name.
|
||||||
std::string fname = filename.GetString();
|
std::string fname = filename.GetString();
|
||||||
if (fname.find_first_of(":/\\") != fname.npos) {
|
if (fname.find_first_of(":/\\") != std::string::npos) {
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
e << args[0] << " given invalid export file name \"" << fname << "\". "
|
e << args[0] << " given invalid export file name \"" << fname << "\". "
|
||||||
<< "The FILE argument may not contain a path. "
|
<< "The FILE argument may not contain a path. "
|
||||||
@@ -1326,7 +1326,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
|
|||||||
fname = exp.GetString();
|
fname = exp.GetString();
|
||||||
fname += ".cmake";
|
fname += ".cmake";
|
||||||
|
|
||||||
if (fname.find_first_of(":/\\") != fname.npos) {
|
if (fname.find_first_of(":/\\") != std::string::npos) {
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
e << args[0] << " given export name \"" << exp.GetString() << "\". "
|
e << args[0] << " given export name \"" << exp.GetString() << "\". "
|
||||||
<< "This name cannot be safely converted to a file name. "
|
<< "This name cannot be safely converted to a file name. "
|
||||||
@@ -1391,7 +1391,7 @@ bool cmInstallCommand::MakeFilesFullPath(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the file is not a directory.
|
// Make sure the file is not a directory.
|
||||||
if (gpos == file.npos && cmSystemTools::FileIsDirectory(file)) {
|
if (gpos == std::string::npos && cmSystemTools::FileIsDirectory(file)) {
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
e << modeName << " given directory \"" << (*fileIt) << "\" to install.";
|
e << modeName << " given directory \"" << (*fileIt) << "\" to install.";
|
||||||
this->SetError(e.str());
|
this->SetError(e.str());
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile)
|
|||||||
for (const char* const* replaceIter = cmArrayBegin(ruleReplaceVars);
|
for (const char* const* replaceIter = cmArrayBegin(ruleReplaceVars);
|
||||||
replaceIter != cmArrayEnd(ruleReplaceVars); ++replaceIter) {
|
replaceIter != cmArrayEnd(ruleReplaceVars); ++replaceIter) {
|
||||||
std::string actualReplace = *replaceIter;
|
std::string actualReplace = *replaceIter;
|
||||||
if (actualReplace.find("${LANG}") != actualReplace.npos) {
|
if (actualReplace.find("${LANG}") != std::string::npos) {
|
||||||
cmSystemTools::ReplaceString(actualReplace, "${LANG}", lang);
|
cmSystemTools::ReplaceString(actualReplace, "${LANG}", lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1932,7 +1932,7 @@ void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
|
|||||||
// -DNAME="value" instead of -D"NAME=value" for historical reasons.
|
// -DNAME="value" instead of -D"NAME=value" for historical reasons.
|
||||||
std::string::size_type eq = defineIt->find("=");
|
std::string::size_type eq = defineIt->find("=");
|
||||||
def += defineIt->substr(0, eq);
|
def += defineIt->substr(0, eq);
|
||||||
if (eq != defineIt->npos) {
|
if (eq != std::string::npos) {
|
||||||
def += "=";
|
def += "=";
|
||||||
def += this->EscapeForShell(defineIt->c_str() + eq + 1, true);
|
def += this->EscapeForShell(defineIt->c_str() + eq + 1, true);
|
||||||
}
|
}
|
||||||
@@ -2109,7 +2109,7 @@ static bool cmLocalGeneratorShortenObjectName(std::string& objName,
|
|||||||
// its own md5 sum.
|
// its own md5 sum.
|
||||||
std::string::size_type pos =
|
std::string::size_type pos =
|
||||||
objName.find('/', objName.size() - max_len + 32);
|
objName.find('/', objName.size() - max_len + 32);
|
||||||
if (pos != objName.npos) {
|
if (pos != std::string::npos) {
|
||||||
cmCryptoHash md5(cmCryptoHash::AlgoMD5);
|
cmCryptoHash md5(cmCryptoHash::AlgoMD5);
|
||||||
std::string md5name = md5.HashString(objName.substr(0, pos));
|
std::string md5name = md5.HashString(objName.substr(0, pos));
|
||||||
md5name += objName.substr(pos);
|
md5name += objName.substr(pos);
|
||||||
@@ -2460,7 +2460,7 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Many compilers do not support # in the value so we disable it.
|
// Many compilers do not support # in the value so we disable it.
|
||||||
if (define.find_first_of('#') != define.npos) {
|
if (define.find_first_of('#') != std::string::npos) {
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
e << "WARNING: Preprocessor definitions containing '#' may not be "
|
e << "WARNING: Preprocessor definitions containing '#' may not be "
|
||||||
|
|||||||
@@ -606,7 +606,7 @@ std::string cmLocalUnixMakefileGenerator3::MaybeConvertWatcomShellCommand(
|
|||||||
std::string const& cmd)
|
std::string const& cmd)
|
||||||
{
|
{
|
||||||
if (this->IsWatcomWMake() && cmSystemTools::FileIsFullPath(cmd.c_str()) &&
|
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
|
// On Watcom WMake use the windows short path for the command
|
||||||
// name. This is needed to avoid funny quoting problems on
|
// name. This is needed to avoid funny quoting problems on
|
||||||
// lines with shell redirection operators.
|
// lines with shell redirection operators.
|
||||||
@@ -852,7 +852,7 @@ void cmLocalUnixMakefileGenerator3::AppendFlags(std::string& flags,
|
|||||||
{
|
{
|
||||||
if (this->IsWatcomWMake() && !newFlags.empty()) {
|
if (this->IsWatcomWMake() && !newFlags.empty()) {
|
||||||
std::string newf = newFlags;
|
std::string newf = newFlags;
|
||||||
if (newf.find("\\\"") != newf.npos) {
|
if (newf.find("\\\"") != std::string::npos) {
|
||||||
cmSystemTools::ReplaceString(newf, "\\\"", "\"");
|
cmSystemTools::ReplaceString(newf, "\\\"", "\"");
|
||||||
this->cmLocalGenerator::AppendFlags(flags, newf);
|
this->cmLocalGenerator::AppendFlags(flags, newf);
|
||||||
return;
|
return;
|
||||||
@@ -978,11 +978,11 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
|
|||||||
cmSystemTools::ReplaceString(cmd, "/./", "/");
|
cmSystemTools::ReplaceString(cmd, "/./", "/");
|
||||||
// Convert the command to a relative path only if the current
|
// Convert the command to a relative path only if the current
|
||||||
// working directory will be the start-output directory.
|
// 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()) {
|
if (workingDir.empty()) {
|
||||||
cmd = this->MaybeConvertToRelativePath(currentBinDir, cmd);
|
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) {
|
if (had_slash && !has_slash) {
|
||||||
// This command was specified as a path to a file in the
|
// This command was specified as a path to a file in the
|
||||||
// current directory. Add a leading "./" so it can run
|
// 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
|
// curly braces are removed. The hack can be skipped if the
|
||||||
// first curly brace is the last character.
|
// first curly brace is the last character.
|
||||||
std::string::size_type lcurly = cmd.find('{');
|
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('}');
|
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.
|
// The first curly is a left curly. Use the hack.
|
||||||
std::string hack_cmd = cmd.substr(0, lcurly);
|
std::string hack_cmd = cmd.substr(0, lcurly);
|
||||||
hack_cmd += "{{}";
|
hack_cmd += "{{}";
|
||||||
@@ -1207,9 +1207,12 @@ std::string cmLocalUnixMakefileGenerator3::CreateMakeVariable(
|
|||||||
// if there is no restriction on the length of make variables
|
// if there is no restriction on the length of make variables
|
||||||
// and there are no "." characters in the string, then return the
|
// and there are no "." characters in the string, then return the
|
||||||
// unmodified combination.
|
// unmodified combination.
|
||||||
if ((!this->MakefileVariableSize && unmodified.find('.') == s.npos) &&
|
if ((!this->MakefileVariableSize &&
|
||||||
(!this->MakefileVariableSize && unmodified.find('+') == s.npos) &&
|
unmodified.find('.') == std::string::npos) &&
|
||||||
(!this->MakefileVariableSize && unmodified.find('-') == s.npos)) {
|
(!this->MakefileVariableSize &&
|
||||||
|
unmodified.find('+') == std::string::npos) &&
|
||||||
|
(!this->MakefileVariableSize &&
|
||||||
|
unmodified.find('-') == std::string::npos)) {
|
||||||
return unmodified;
|
return unmodified;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ std::string cmMSVC60LinkLineComputer::ConvertToLinkReference(
|
|||||||
// Work-ardound command line parsing limitations in MSVC 6.0
|
// Work-ardound command line parsing limitations in MSVC 6.0
|
||||||
// Search for the last space.
|
// Search for the last space.
|
||||||
std::string::size_type pos = lib.rfind(' ');
|
std::string::size_type pos = lib.rfind(' ');
|
||||||
if (pos != lib.npos) {
|
if (pos != std::string::npos) {
|
||||||
// Find the slash after the last space, if any.
|
// Find the slash after the last space, if any.
|
||||||
pos = lib.find('/', pos);
|
pos = lib.find('/', pos);
|
||||||
|
|
||||||
|
|||||||
@@ -316,6 +316,7 @@ public:
|
|||||||
bool noPolicyScope);
|
bool noPolicyScope);
|
||||||
~IncludeScope();
|
~IncludeScope();
|
||||||
void Quiet() { this->ReportError = false; }
|
void Quiet() { this->ReportError = false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cmMakefile* Makefile;
|
cmMakefile* Makefile;
|
||||||
bool NoPolicyScope;
|
bool NoPolicyScope;
|
||||||
@@ -480,6 +481,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Quiet() { this->ReportError = false; }
|
void Quiet() { this->ReportError = false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cmMakefile* Makefile;
|
cmMakefile* Makefile;
|
||||||
bool ReportError;
|
bool ReportError;
|
||||||
@@ -625,7 +627,7 @@ struct file_not_persistent
|
|||||||
{
|
{
|
||||||
bool operator()(const std::string& path) const
|
bool operator()(const std::string& path) const
|
||||||
{
|
{
|
||||||
return !(path.find("CMakeTmp") == path.npos &&
|
return !(path.find("CMakeTmp") == std::string::npos &&
|
||||||
cmSystemTools::FileExists(path.c_str()));
|
cmSystemTools::FileExists(path.c_str()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1347,6 +1349,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Quiet() { this->ReportError = false; }
|
void Quiet() { this->ReportError = false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cmMakefile* Makefile;
|
cmMakefile* Makefile;
|
||||||
cmGlobalGenerator* GG;
|
cmGlobalGenerator* GG;
|
||||||
@@ -1893,7 +1896,7 @@ cmSourceFile* cmMakefile::LinearGetSourceFileWithOutput(
|
|||||||
out = *o;
|
out = *o;
|
||||||
std::string::size_type pos = out.rfind(name);
|
std::string::size_type pos = out.rfind(name);
|
||||||
// If the output matches exactly
|
// If the output matches exactly
|
||||||
if (pos != out.npos && pos == out.size() - name.size() &&
|
if (pos != std::string::npos && pos == out.size() - name.size() &&
|
||||||
(pos == 0 || out[pos - 1] == '/')) {
|
(pos == 0 || out[pos - 1] == '/')) {
|
||||||
return *i;
|
return *i;
|
||||||
}
|
}
|
||||||
@@ -2406,7 +2409,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringOld(
|
|||||||
bool removeEmpty, bool replaceAt) const
|
bool removeEmpty, bool replaceAt) const
|
||||||
{
|
{
|
||||||
// Fast path strings without any special characters.
|
// Fast path strings without any special characters.
|
||||||
if (source.find_first_of("$@\\") == source.npos) {
|
if (source.find_first_of("$@\\") == std::string::npos) {
|
||||||
return cmake::LOG;
|
return cmake::LOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1287,6 +1287,7 @@ public:
|
|||||||
this->CurrentString += this->NextObject;
|
this->CurrentString += this->NextObject;
|
||||||
}
|
}
|
||||||
void Done() { this->Strings.push_back(this->CurrentString); }
|
void Done() { this->Strings.push_back(this->CurrentString); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string MaybeConvertToRelativePath(std::string const& obj)
|
std::string MaybeConvertToRelativePath(std::string const& obj)
|
||||||
{
|
{
|
||||||
@@ -1596,7 +1597,8 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
|
|||||||
frameworkPath, linkPath);
|
frameworkPath, linkPath);
|
||||||
linkLibs = frameworkPath + linkPath + linkLibs;
|
linkLibs = frameworkPath + linkPath + linkLibs;
|
||||||
|
|
||||||
if (useResponseFile && linkLibs.find_first_not_of(' ') != linkLibs.npos) {
|
if (useResponseFile &&
|
||||||
|
linkLibs.find_first_not_of(' ') != std::string::npos) {
|
||||||
// Lookup the response file reference flag.
|
// Lookup the response file reference flag.
|
||||||
std::string responseFlagVar = "CMAKE_";
|
std::string responseFlagVar = "CMAKE_";
|
||||||
responseFlagVar +=
|
responseFlagVar +=
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ static std::string utilStripCR(std::string const& line)
|
|||||||
{
|
{
|
||||||
// Strip CR characters rcc may have printed (possibly more than one!).
|
// Strip CR characters rcc may have printed (possibly more than one!).
|
||||||
std::string::size_type cr = line.find('\r');
|
std::string::size_type cr = line.find('\r');
|
||||||
if (cr != line.npos) {
|
if (cr != std::string::npos) {
|
||||||
return line.substr(0, cr);
|
return line.substr(0, cr);
|
||||||
}
|
}
|
||||||
return line;
|
return line;
|
||||||
|
|||||||
+5
-5
@@ -80,7 +80,7 @@ void cmRST::ProcessModule(std::istream& is)
|
|||||||
if (!rst.empty() && rst != "#") {
|
if (!rst.empty() && rst != "#") {
|
||||||
// Bracket mode: check for end bracket
|
// Bracket mode: check for end bracket
|
||||||
std::string::size_type pos = line.find(rst);
|
std::string::size_type pos = line.find(rst);
|
||||||
if (pos == line.npos) {
|
if (pos == std::string::npos) {
|
||||||
this->ProcessLine(line);
|
this->ProcessLine(line);
|
||||||
} else {
|
} else {
|
||||||
if (line[0] != '#') {
|
if (line[0] != '#') {
|
||||||
@@ -98,7 +98,7 @@ void cmRST::ProcessModule(std::istream& is)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (line.substr(0, 2) == "# ") {
|
if (line.substr(0, 2) == "# ") {
|
||||||
this->ProcessLine(line.substr(2, line.npos));
|
this->ProcessLine(line.substr(2, std::string::npos));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
rst = "";
|
rst = "";
|
||||||
@@ -156,8 +156,8 @@ void cmRST::ProcessLine(std::string const& line)
|
|||||||
isspace(line[2]))) {
|
isspace(line[2]))) {
|
||||||
this->Reset();
|
this->Reset();
|
||||||
this->Markup =
|
this->Markup =
|
||||||
(line.find_first_not_of(" \t", 2) == line.npos ? MarkupEmpty
|
(line.find_first_not_of(" \t", 2) == std::string::npos ? MarkupEmpty
|
||||||
: MarkupNormal);
|
: MarkupNormal);
|
||||||
if (this->CMakeDirective.find(line)) {
|
if (this->CMakeDirective.find(line)) {
|
||||||
// Output cmake domain directives and their content normally.
|
// Output cmake domain directives and their content normally.
|
||||||
this->NormalLine(line);
|
this->NormalLine(line);
|
||||||
@@ -252,7 +252,7 @@ void cmRST::OutputLine(std::string const& line_in, bool inlineMarkup)
|
|||||||
// no explicit "(...)" then add "()" to the text.
|
// no explicit "(...)" then add "()" to the text.
|
||||||
if (this->CMakeRole.match(2) == "command" &&
|
if (this->CMakeRole.match(2) == "command" &&
|
||||||
this->CMakeRole.match(5).empty() &&
|
this->CMakeRole.match(5).empty() &&
|
||||||
text.find_first_of("()") == text.npos) {
|
text.find_first_of("()") == std::string::npos) {
|
||||||
text += "()";
|
text += "()";
|
||||||
}
|
}
|
||||||
this->OS << "``" << text << "``";
|
this->OS << "``" << text << "``";
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable(
|
|||||||
// Strip the last extension off the target name.
|
// Strip the last extension off the target name.
|
||||||
std::string targetBase = replaceValues.Target;
|
std::string targetBase = replaceValues.Target;
|
||||||
std::string::size_type pos = targetBase.rfind('.');
|
std::string::size_type pos = targetBase.rfind('.');
|
||||||
if (pos != targetBase.npos) {
|
if (pos != std::string::npos) {
|
||||||
return targetBase.substr(0, pos);
|
return targetBase.substr(0, pos);
|
||||||
}
|
}
|
||||||
return targetBase;
|
return targetBase;
|
||||||
@@ -270,7 +270,7 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable(
|
|||||||
std::map<std::string, std::string>::iterator mapIt =
|
std::map<std::string, std::string>::iterator mapIt =
|
||||||
this->VariableMappings.find(variable);
|
this->VariableMappings.find(variable);
|
||||||
if (mapIt != this->VariableMappings.end()) {
|
if (mapIt != this->VariableMappings.end()) {
|
||||||
if (variable.find("_FLAG") == variable.npos) {
|
if (variable.find("_FLAG") == std::string::npos) {
|
||||||
return outputConverter->ConvertToOutputForExisting(mapIt->second);
|
return outputConverter->ConvertToOutputForExisting(mapIt->second);
|
||||||
}
|
}
|
||||||
return mapIt->second;
|
return mapIt->second;
|
||||||
@@ -284,15 +284,15 @@ void cmRulePlaceholderExpander::ExpandRuleVariables(
|
|||||||
{
|
{
|
||||||
std::string::size_type start = s.find('<');
|
std::string::size_type start = s.find('<');
|
||||||
// no variables to expand
|
// no variables to expand
|
||||||
if (start == s.npos) {
|
if (start == std::string::npos) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::string::size_type pos = 0;
|
std::string::size_type pos = 0;
|
||||||
std::string expandedInput;
|
std::string expandedInput;
|
||||||
while (start != s.npos && start < s.size() - 2) {
|
while (start != std::string::npos && start < s.size() - 2) {
|
||||||
std::string::size_type end = s.find('>', start);
|
std::string::size_type end = s.find('>', start);
|
||||||
// if we find a < with no > we are done
|
// if we find a < with no > we are done
|
||||||
if (end == s.npos) {
|
if (end == std::string::npos) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char c = s[start + 1];
|
char c = s[start + 1];
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ public:
|
|||||||
operator bool() const { return this->handle_ != INVALID_HANDLE_VALUE; }
|
operator bool() const { return this->handle_ != INVALID_HANDLE_VALUE; }
|
||||||
bool operator!() const { return this->handle_ == INVALID_HANDLE_VALUE; }
|
bool operator!() const { return this->handle_ == INVALID_HANDLE_VALUE; }
|
||||||
operator HANDLE() const { return this->handle_; }
|
operator HANDLE() const { return this->handle_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HANDLE handle_;
|
HANDLE handle_;
|
||||||
};
|
};
|
||||||
@@ -2372,7 +2373,7 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
|
|||||||
rp[rp_count].Value = se[i]->Value.substr(0, prefix_len);
|
rp[rp_count].Value = se[i]->Value.substr(0, prefix_len);
|
||||||
rp[rp_count].Value += newRPath;
|
rp[rp_count].Value += newRPath;
|
||||||
rp[rp_count].Value +=
|
rp[rp_count].Value +=
|
||||||
se[i]->Value.substr(pos + oldRPath.length(), oldRPath.npos);
|
se[i]->Value.substr(pos + oldRPath.length(), std::string::npos);
|
||||||
|
|
||||||
if (!rp[rp_count].Value.empty()) {
|
if (!rp[rp_count].Value.empty()) {
|
||||||
remove_rpath = false;
|
remove_rpath = false;
|
||||||
|
|||||||
+1
-1
@@ -1476,7 +1476,7 @@ bool cmTarget::CheckImportedLibName(std::string const& prop,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::string::size_type bad = value.find_first_of(":/\\;");
|
std::string::size_type bad = value.find_first_of(":/\\;");
|
||||||
if (bad != value.npos) {
|
if (bad != std::string::npos) {
|
||||||
this->Makefile->IssueMessage(
|
this->Makefile->IssueMessage(
|
||||||
cmake::FATAL_ERROR, prop + " property value\n " + value +
|
cmake::FATAL_ERROR, prop + " property value\n " + value +
|
||||||
"\nmay not contain '" + value.substr(bad, 1) + "'.");
|
"\nmay not contain '" + value.substr(bad, 1) + "'.");
|
||||||
|
|||||||
@@ -224,11 +224,11 @@ void cmXCodeObject::PrintString(std::ostream& os, std::string String)
|
|||||||
{
|
{
|
||||||
// The string needs to be quoted if it contains any characters
|
// The string needs to be quoted if it contains any characters
|
||||||
// considered special by the Xcode project file parser.
|
// considered special by the Xcode project file parser.
|
||||||
bool needQuote = (String.empty() || String.find("//") != String.npos ||
|
bool needQuote = (String.empty() || String.find("//") != std::string::npos ||
|
||||||
String.find_first_not_of("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
String.find_first_not_of("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
"abcdefghijklmnopqrstuvwxyz"
|
"abcdefghijklmnopqrstuvwxyz"
|
||||||
"0123456789"
|
"0123456789"
|
||||||
"$_./") != String.npos);
|
"$_./") != std::string::npos);
|
||||||
const char* quote = needQuote ? "\"" : "";
|
const char* quote = needQuote ? "\"" : "";
|
||||||
|
|
||||||
// Print the string, quoted and escaped as necessary.
|
// Print the string, quoted and escaped as necessary.
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ int RunXCode(std::vector<const char*>& argv, bool& hitbug)
|
|||||||
std::string line;
|
std::string line;
|
||||||
int pipe = cmSystemTools::WaitForLine(cp, line, 100.0, out, err);
|
int pipe = cmSystemTools::WaitForLine(cp, line, 100.0, out, err);
|
||||||
while (pipe != cmsysProcess_Pipe_None) {
|
while (pipe != cmsysProcess_Pipe_None) {
|
||||||
if (line.find("/bin/sh: bad interpreter: Text file busy") != line.npos) {
|
if (line.find("/bin/sh: bad interpreter: Text file busy") !=
|
||||||
|
std::string::npos) {
|
||||||
hitbug = true;
|
hitbug = true;
|
||||||
std::cerr << "Hit xcodebuild bug : " << line << "\n";
|
std::cerr << "Hit xcodebuild bug : " << line << "\n";
|
||||||
}
|
}
|
||||||
@@ -37,7 +38,7 @@ int RunXCode(std::vector<const char*>& argv, bool& hitbug)
|
|||||||
// because it may contain bogus errors
|
// because it may contain bogus errors
|
||||||
// also remove all output with setenv in it to tone down
|
// also remove all output with setenv in it to tone down
|
||||||
// the verbosity of xcodebuild
|
// the verbosity of xcodebuild
|
||||||
if (!hitbug && (line.find("setenv") == line.npos)) {
|
if (!hitbug && (line.find("setenv") == std::string::npos)) {
|
||||||
if (pipe == cmsysProcess_Pipe_STDERR) {
|
if (pipe == cmsysProcess_Pipe_STDERR) {
|
||||||
std::cerr << line << "\n";
|
std::cerr << line << "\n";
|
||||||
} else if (pipe == cmsysProcess_Pipe_STDOUT) {
|
} else if (pipe == cmsysProcess_Pipe_STDOUT) {
|
||||||
|
|||||||
+13
-13
@@ -351,8 +351,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Warn if iwyu reported anything.
|
// Warn if iwyu reported anything.
|
||||||
if (stdErr.find("should remove these lines:") != stdErr.npos ||
|
if (stdErr.find("should remove these lines:") != std::string::npos ||
|
||||||
stdErr.find("should add these lines:") != stdErr.npos) {
|
stdErr.find("should add these lines:") != std::string::npos) {
|
||||||
std::cerr << "Warning: include-what-you-use reported diagnostics:\n"
|
std::cerr << "Warning: include-what-you-use reported diagnostics:\n"
|
||||||
<< stdErr << "\n";
|
<< stdErr << "\n";
|
||||||
}
|
}
|
||||||
@@ -412,7 +412,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
|
|
||||||
// Output the stdout from ldd -r -u to stderr
|
// Output the stdout from ldd -r -u to stderr
|
||||||
// Warn if lwyu reported anything.
|
// Warn if lwyu reported anything.
|
||||||
if (stdOut.find("Unused direct dependencies:") != stdOut.npos) {
|
if (stdOut.find("Unused direct dependencies:") != std::string::npos) {
|
||||||
std::cerr << "Warning: " << stdOut;
|
std::cerr << "Warning: " << stdOut;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -480,7 +480,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
std::cerr << "cmake -E env: unknown option '" << a << "'"
|
std::cerr << "cmake -E env: unknown option '" << a << "'"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
} else if (a.find('=') != a.npos) {
|
} else if (a.find('=') != std::string::npos) {
|
||||||
// Set environment variable.
|
// Set environment variable.
|
||||||
cmSystemTools::PutEnv(a);
|
cmSystemTools::PutEnv(a);
|
||||||
} else {
|
} else {
|
||||||
@@ -924,15 +924,15 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
cmSystemTools::TarCompressNone;
|
cmSystemTools::TarCompressNone;
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
int nCompress = 0;
|
int nCompress = 0;
|
||||||
if (flags.find_first_of('j') != flags.npos) {
|
if (flags.find_first_of('j') != std::string::npos) {
|
||||||
compress = cmSystemTools::TarCompressBZip2;
|
compress = cmSystemTools::TarCompressBZip2;
|
||||||
++nCompress;
|
++nCompress;
|
||||||
}
|
}
|
||||||
if (flags.find_first_of('J') != flags.npos) {
|
if (flags.find_first_of('J') != std::string::npos) {
|
||||||
compress = cmSystemTools::TarCompressXZ;
|
compress = cmSystemTools::TarCompressXZ;
|
||||||
++nCompress;
|
++nCompress;
|
||||||
}
|
}
|
||||||
if (flags.find_first_of('z') != flags.npos) {
|
if (flags.find_first_of('z') != std::string::npos) {
|
||||||
compress = cmSystemTools::TarCompressGZip;
|
compress = cmSystemTools::TarCompressGZip;
|
||||||
++nCompress;
|
++nCompress;
|
||||||
}
|
}
|
||||||
@@ -946,22 +946,22 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
"at most one flag of z, j, or J may be used");
|
"at most one flag of z, j, or J may be used");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (flags.find_first_of('v') != flags.npos) {
|
if (flags.find_first_of('v') != std::string::npos) {
|
||||||
verbose = true;
|
verbose = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags.find_first_of('t') != flags.npos) {
|
if (flags.find_first_of('t') != std::string::npos) {
|
||||||
if (!cmSystemTools::ListTar(outFile.c_str(), verbose)) {
|
if (!cmSystemTools::ListTar(outFile.c_str(), verbose)) {
|
||||||
cmSystemTools::Error("Problem listing tar: ", outFile.c_str());
|
cmSystemTools::Error("Problem listing tar: ", outFile.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else if (flags.find_first_of('c') != flags.npos) {
|
} else if (flags.find_first_of('c') != std::string::npos) {
|
||||||
if (!cmSystemTools::CreateTar(outFile.c_str(), files, compress,
|
if (!cmSystemTools::CreateTar(outFile.c_str(), files, compress,
|
||||||
verbose, mtime, format)) {
|
verbose, mtime, format)) {
|
||||||
cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
|
cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else if (flags.find_first_of('x') != flags.npos) {
|
} else if (flags.find_first_of('x') != std::string::npos) {
|
||||||
if (!cmSystemTools::ExtractTar(outFile.c_str(), verbose)) {
|
if (!cmSystemTools::ExtractTar(outFile.c_str(), verbose)) {
|
||||||
cmSystemTools::Error("Problem extracting tar: ", outFile.c_str());
|
cmSystemTools::Error("Problem extracting tar: ", outFile.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
@@ -1272,7 +1272,7 @@ int cmcmd::ExecuteLinkScript(std::vector<std::string>& args)
|
|||||||
int result = 0;
|
int result = 0;
|
||||||
while (result == 0 && cmSystemTools::GetLineFromStream(fin, command)) {
|
while (result == 0 && cmSystemTools::GetLineFromStream(fin, command)) {
|
||||||
// Skip empty command lines.
|
// Skip empty command lines.
|
||||||
if (command.find_first_not_of(" \t") == command.npos) {
|
if (command.find_first_not_of(" \t") == std::string::npos) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1420,7 +1420,7 @@ static bool RunCommand(const char* comment, std::vector<std::string>& command,
|
|||||||
// it is the dumb rc command banner, but if the command
|
// it is the dumb rc command banner, but if the command
|
||||||
// returned an error code then print the output anyway as
|
// returned an error code then print the output anyway as
|
||||||
// the banner may be mixed with some other important information.
|
// the banner may be mixed with some other important information.
|
||||||
if (output.find("Resource Compiler Version") == output.npos || !res ||
|
if (output.find("Resource Compiler Version") == std::string::npos || !res ||
|
||||||
retCode) {
|
retCode) {
|
||||||
std::cout << output;
|
std::cout << output;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user