diff options
author | Sebastien Barre <sebastien.barre@kitware.com> | 2006-04-18 15:50:39 (GMT) |
---|---|---|
committer | Sebastien Barre <sebastien.barre@kitware.com> | 2006-04-18 15:50:39 (GMT) |
commit | d5237b30fc8eca9c56c8ee7f671cb00f7303c169 (patch) | |
tree | aa72c6b4a2d1588969e1dc03cdce0e89a9d4a47a /Source/kwsys/SystemTools.cxx | |
parent | 428b4c92440091d798b0d6bcbae6544a168ca867 (diff) | |
download | CMake-d5237b30fc8eca9c56c8ee7f671cb00f7303c169.zip CMake-d5237b30fc8eca9c56c8ee7f671cb00f7303c169.tar.gz CMake-d5237b30fc8eca9c56c8ee7f671cb00f7303c169.tar.bz2 |
ENH: try to bypass Microsoft assert() on isspace, isalpha, etc.
Diffstat (limited to 'Source/kwsys/SystemTools.cxx')
-rw-r--r-- | Source/kwsys/SystemTools.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 93cc5b3..b68a9bf 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -836,7 +836,14 @@ kwsys_stl::string SystemTools::CapitalizedWords(const kwsys_stl::string& s) kwsys_stl::string n(s); for (size_t i = 0; i < s.size(); i++) { +#if defined(_MSC_VER) && defined (_MT) && defined (_DEBUG) + // MS has an assert that will fail if s[i] < 0; setting + // LC_CTYPE using setlocale() does *not* help. Painful. + if ((int)s[i] >= 0 && isalpha(s[i]) && + (i == 0 || ((int)s[i - 1] >= 0 && isspace(s[i - 1])))) +#else if (isalpha(s[i]) && (i == 0 || isspace(s[i - 1]))) +#endif { n[i] = static_cast<kwsys_stl::string::value_type>(toupper(s[i])); } @@ -850,7 +857,14 @@ kwsys_stl::string SystemTools::UnCapitalizedWords(const kwsys_stl::string& s) kwsys_stl::string n(s); for (size_t i = 0; i < s.size(); i++) { +#if defined(_MSC_VER) && defined (_MT) && defined (_DEBUG) + // MS has an assert that will fail if s[i] < 0; setting + // LC_CTYPE using setlocale() does *not* help. Painful. + if ((int)s[i] >= 0 && isalpha(s[i]) && + (i == 0 || ((int)s[i - 1] >= 0 && isspace(s[i - 1])))) +#else if (isalpha(s[i]) && (i == 0 || isspace(s[i - 1]))) +#endif { n[i] = static_cast<kwsys_stl::string::value_type>(tolower(s[i])); } |