diff --git a/Source/Modules/guile.cxx b/Source/Modules/guile.cxx index 03e777cf4..d7d3da8fc 100644 --- a/Source/Modules/guile.cxx +++ b/Source/Modules/guile.cxx @@ -947,16 +947,20 @@ public: if (!is_setter) { /* Strip off "-get" */ + char *pws_name = (char *) malloc(sizeof(char) * (len - 3)); + strncpy(pws_name, pc, len - 3); + pws_name[len - 4] = 0; if (struct_member == 2) { /* There was a setter, so create a procedure with setter */ Printf(f_init, "scm_c_define"); - Printf(f_init, "(\"%.*s\", " "scm_make_procedure_with_setter(getter, setter));\n", pc, len - 4); + Printf(f_init, "(\"%s\", " "scm_make_procedure_with_setter(getter, setter));\n", pws_name); } else { /* There was no setter, so make an alias to the getter */ Printf(f_init, "scm_c_define"); - Printf(f_init, "(\"%.*s\", getter);\n", pc, len - 4); + Printf(f_init, "(\"%s\", getter);\n", pws_name); } - Printf(exported_symbols, "\"%.*s\", ", pc, len - 4); + Printf(exported_symbols, "\"%s\", ", pws_name); + free(pws_name); } } else { /* Register the function */ diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx index 1f7ff044a..ebd788d35 100644 --- a/Source/Modules/main.cxx +++ b/Source/Modules/main.cxx @@ -471,7 +471,9 @@ static void getoptions(int argc, char *argv[]) { Swig_mark_arg(i); } else if (strncmp(argv[i], "-I", 2) == 0) { // Add a new directory search path - Swig_add_directory((String_or_char*)(argv[i] + 2)); + char *a = Swig_copy_string(argv[i] + 2); + Swig_add_directory((DOH *) a); + free(a); Swig_mark_arg(i); } else if (strncmp(argv[i], "-D", 2) == 0) { String *d = NewString(argv[i] + 2);