Replace 'foo.length() >= 1' pattern with !foo.empty()

This commit is contained in:
Stephen Kelly 2015-01-15 22:58:10 +01:00
parent f09fde2d21
commit fd0c036c0c
2 changed files with 2 additions and 2 deletions

View File

@ -745,7 +745,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
// A non-string character has been found. Check if the current // A non-string character has been found. Check if the current
// string matches the requirements. We require that the length // string matches the requirements. We require that the length
// be at least one no matter what the user specified. // be at least one no matter what the user specified.
if(s.length() >= minlen && s.length() >= 1 && if(s.length() >= minlen && !s.empty() &&
(!have_regex || regex.find(s.c_str()))) (!have_regex || regex.find(s.c_str())))
{ {
output_size += static_cast<int>(s.size()) + 1; output_size += static_cast<int>(s.size()) + 1;

View File

@ -2531,7 +2531,7 @@ static bool cmakeCheckStampFile(const char* stampName)
while(cmSystemTools::GetLineFromStream(fin, dep)) while(cmSystemTools::GetLineFromStream(fin, dep))
{ {
int result; int result;
if(dep.length() >= 1 && dep[0] != '#' && if(!dep.empty() && dep[0] != '#' &&
(!ftc.FileTimeCompare(stampDepends.c_str(), dep.c_str(), &result) (!ftc.FileTimeCompare(stampDepends.c_str(), dep.c_str(), &result)
|| result < 0)) || result < 0))
{ {