summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorRuslan Baratov <ruslan_baratov@yahoo.com>2014-12-05 14:18:11 (GMT)
committerBrad King <brad.king@kitware.com>2014-12-05 17:59:37 (GMT)
commit97841dad2ba5a79acb0b22db9a01ae45f7b2e80b (patch)
treea549030bf27c8d94e42fbbd35e723ff56206c07b /Source/cmFileCommand.cxx
parent356f7cf4457271ee85a71face453ea9579f05da3 (diff)
downloadCMake-97841dad2ba5a79acb0b22db9a01ae45f7b2e80b.zip
CMake-97841dad2ba5a79acb0b22db9a01ae45f7b2e80b.tar.gz
CMake-97841dad2ba5a79acb0b22db9a01ae45f7b2e80b.tar.bz2
file: Use 'long' to represent the parsed LOCK TIMEOUT value
Convert the StringToInt helper into a StringToLong helper with a 'long' result type. This will make the helper more useful to other callers that want to use strtol. While at it, also check errno after calling strtol in case the conversion fails with a range error.
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index a6eb8c4..3c2dfa5 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -3521,7 +3521,7 @@ bool cmFileCommand::HandleLockCommand(
};
Guard guard = GUARD_PROCESS;
std::string resultVariable;
- unsigned timeout = static_cast<unsigned>(-1);
+ unsigned long timeout = static_cast<unsigned long>(-1);
// Parse arguments
if(args.size() < 2)
@@ -3597,15 +3597,16 @@ bool cmFileCommand::HandleLockCommand(
"expected timeout value after TIMEOUT");
return false;
}
- int scanned;
- if(!cmSystemTools::StringToInt(args[i].c_str(), &scanned) || scanned < 0)
+ long scanned;
+ if(!cmSystemTools::StringToLong(args[i].c_str(), &scanned)
+ || scanned < 0)
{
cmOStringStream e;
e << "TIMEOUT value \"" << args[i] << "\" is not an unsigned integer.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
}
- timeout = static_cast<unsigned>(scanned);
+ timeout = static_cast<unsigned long>(scanned);
}
else
{