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.

This commit is contained in:
David Cole 2008-12-09 10:56:41 -05:00
parent ae28ec9f24
commit 95a6feaa66
1 changed files with 14 additions and 2 deletions

View File

@ -29,7 +29,14 @@ functionMapEntry cmakeGeneratedFunctionMapEntries[] = {
char* lowercase(const char *string) char* lowercase(const char *string)
{ {
char *new_string, *p; 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) if (!new_string)
{ {
return 0; return 0;
@ -38,7 +45,12 @@ char* lowercase(const char *string)
p = new_string; p = new_string;
while (*p != 0) while (*p != 0)
{ {
*p = (char)tolower(*p); #ifdef __cplusplus
*p = static_cast<char>(tolower(*p));
#else
*p = (char)(tolower(*p));
#endif
++p; ++p;
} }
return new_string; return new_string;