From b7e04e69ae872f3e665199c15b6a27ad6d91035f Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 25 Oct 2006 10:57:26 -0400 Subject: BUG: It cannot be an error if the values do not convert. The docs say that if the values do not convert the test is false. --- Source/cmIfCommand.cxx | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 9dcaf9b..2c69d83 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -395,26 +395,13 @@ bool cmIfCommand::IsTrue(const std::vector &args, def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile); def2 = cmIfCommand::GetVariableOrString((argP2)->c_str(), makefile); double lhs; - if(sscanf(def, "%lg", &lhs) != 1) - { - cmOStringStream error; - error << "could not convert \"" << def << "\" to a number"; - delete [] *errorString; - *errorString = new char[error.str().size() + 1]; - strcpy(*errorString, error.str().c_str()); - return false; - } double rhs; - if(sscanf(def2, "%lg", &rhs) != 1) + if(sscanf(def, "%lg", &lhs) != 1 || + sscanf(def2, "%lg", &rhs) != 1) { - cmOStringStream error; - error << "could not convert \"" << def2 << "\" to a number"; - delete [] *errorString; - *errorString = new char[error.str().size() + 1]; - strcpy(*errorString, error.str().c_str()); - return false; + *arg = "0"; } - if (*(argP1) == "LESS") + else if (*(argP1) == "LESS") { if(lhs < rhs) { -- cgit v0.12