diff options
author | Alexander Neundorf <neundorf@kde.org> | 2007-12-16 12:56:43 (GMT) |
---|---|---|
committer | Alexander Neundorf <neundorf@kde.org> | 2007-12-16 12:56:43 (GMT) |
commit | bcb73bb9f4cba2db3706a755a37da52c84bb8429 (patch) | |
tree | 2c005c8f72092a3c25a49bdb3edf468c9aa1f8b7 /Source/cmStringCommand.cxx | |
parent | 7bcafb410fd3cfff007ece786d948e63ff7836ab (diff) | |
download | CMake-bcb73bb9f4cba2db3706a755a37da52c84bb8429.zip CMake-bcb73bb9f4cba2db3706a755a37da52c84bb8429.tar.gz CMake-bcb73bb9f4cba2db3706a755a37da52c84bb8429.tar.bz2 |
BUG: fix STRING(STRIP ...) if no non-space is contained in the input string,
this should fix the dashboard
Alex
Diffstat (limited to 'Source/cmStringCommand.cxx')
-rw-r--r-- | Source/cmStringCommand.cxx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index f746f82..7ef39af 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -675,8 +675,20 @@ bool cmStringCommand::HandleStripCommand( ++ ptr; } - size_t outLength = endPos - startPos + 1; - + size_t outLength = 0; + + // if the input string didn't contain any non-space characters, return + // an empty string + if (startPos > inStringLength) + { + outLength = 0; + startPos = 0; + } + else + { + outLength=endPos - startPos + 1; + } + this->Makefile->AddDefinition(variableName.c_str(), stringValue.substr(startPos, outLength).c_str()); return true; |