q2dm: correctly expect the return type of strchr(const char*) to be

'const char*' in C++ so that the code builds on gcc-4.4

ISO C++ overloads strchr() so that strchr(const char*) return 'const
char*' and strchr(char *) return 'char *'.
Since DmTrace::parseAndAddFunction really wants to write to its 'const
char *name' argument I just casted a pointer pointing inside of 'name' to 'char*'
This commit is contained in:
Scott Tsai
2009-03-21 08:17:41 +08:00
parent 0c4ee7741c
commit eda65f5f60

View File

@@ -164,7 +164,7 @@ void DmTrace::parseAndAddFunction(int functionId, const char *name)
// sig = "()I" // sig = "()I"
// Find the first parenthesis, the start of the signature. // Find the first parenthesis, the start of the signature.
char *paren = strchr(name, '('); char *paren = (char*)strchr(name, '(');
// If not found, then add the original name. // If not found, then add the original name.
if (paren == NULL) { if (paren == NULL) {
@@ -181,7 +181,7 @@ void DmTrace::parseAndAddFunction(int functionId, const char *name)
*paren = 0; *paren = 0;
// Search for the last period, the start of the method name // Search for the last period, the start of the method name
char *dot = strrchr(name, '.'); char *dot = (char*)strrchr(name, '.');
// If not found, then add the original name. // If not found, then add the original name.
if (dot == NULL || dot == name) { if (dot == NULL || dot == name) {