diff options
author | David Cole <david.cole@kitware.com> | 2008-12-09 15:56:41 (GMT) |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2008-12-09 15:56:41 (GMT) |
commit | 95a6feaa66e6cafcc310cdaddddb5eaf7c4bb866 (patch) | |
tree | 14a03f5a051b24f2de2c99155a8111ba8a28a800 /Templates | |
parent | ae28ec9f243e2fd6a6d4462e890249cd43dd318a (diff) | |
download | CMake-95a6feaa66e6cafcc310cdaddddb5eaf7c4bb866.zip CMake-95a6feaa66e6cafcc310cdaddddb5eaf7c4bb866.tar.gz CMake-95a6feaa66e6cafcc310cdaddddb5eaf7c4bb866.tar.bz2 |
COMP: Don't emit old style cast warning when configured as C++ but still allow being configured as C. Thanks to Monsieur Francois Bertel for the patch.
Diffstat (limited to 'Templates')
-rw-r--r-- | Templates/TestDriver.cxx.in | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in index 8c9f54e..9e53030 100644 --- a/Templates/TestDriver.cxx.in +++ b/Templates/TestDriver.cxx.in @@ -29,7 +29,14 @@ functionMapEntry cmakeGeneratedFunctionMapEntries[] = { char* lowercase(const char *string) { char *new_string, *p; - new_string = (char *)malloc(sizeof(char) * (size_t)(strlen(string) + 1)); + +#ifdef __cplusplus + new_string = static_cast<char *>(malloc(sizeof(char) * + static_cast<size_t>(strlen(string) + 1))); +#else + new_string = (char *)(malloc(sizeof(char) * (size_t)(strlen(string) + 1))); +#endif + if (!new_string) { return 0; @@ -38,7 +45,12 @@ char* lowercase(const char *string) p = new_string; while (*p != 0) { - *p = (char)tolower(*p); +#ifdef __cplusplus + *p = static_cast<char>(tolower(*p)); +#else + *p = (char)(tolower(*p)); +#endif + ++p; } return new_string; |