Browse Source

fix interrogate compile error when a function takes a non-const char pointer

rdb 12 years ago
parent
commit
abc5c381be
1 changed files with 11 additions and 2 deletions
  1. 11 2
      dtool/src/interrogate/parameterRemapToString.cxx

+ 11 - 2
dtool/src/interrogate/parameterRemapToString.cxx

@@ -26,10 +26,19 @@ ParameterRemapToString(CPPType *orig_type) :
 {
   static CPPType *char_star_type = (CPPType *)NULL;
   if (char_star_type == (CPPType *)NULL) {
-    char_star_type = parser.parse_type("const char *");
+    char_star_type = parser.parse_type("char *");
   }
 
-  _new_type = char_star_type;
+  static CPPType *const_char_star_type = (CPPType *)NULL;
+  if (const_char_star_type == (CPPType *)NULL) {
+    const_char_star_type = parser.parse_type("const char *");
+  }
+
+  if (TypeManager::is_const(orig_type)) {
+    _new_type = const_char_star_type;
+  } else {
+    _new_type = char_star_type;
+  }
 }
 
 ////////////////////////////////////////////////////////////////////