Fixed problem in handling of void pointers.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@764 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2000-08-31 18:19:50 +00:00
commit 90a7839b0c

View file

@ -464,14 +464,17 @@ get_pointer(char *iname, char *srcname, char *src, char *dest,
SwigType *t, String *f, char *ret) { SwigType *t, String *f, char *ret) {
SwigType_remember(t); SwigType_remember(t);
SwigType *lt = Swig_clocal_type(t);
Printv(f, "if (SWIG_ConvertPtr(", src, ",(void **) &", dest, ",", 0); Printv(f, "if (SWIG_ConvertPtr(", src, ",(void **) &", dest, ",", 0);
/* If we're passing a void pointer, we give the pointer conversion a NULL /* If we're passing a void pointer, we give the pointer conversion a NULL
pointer, otherwise pass in the expected type. */ pointer, otherwise pass in the expected type. */
if (SwigType_type(t) == T_VOID) Printf(f, " 0 ) < 0) {\n"); if (Cmp(lt,"p.void") == 0) {
else Printf(f, " 0 ) < 0) {\n");
} else {
Printv(f, "SWIGTYPE", SwigType_manglestr(t), ") < 0) {\n",0); Printv(f, "SWIGTYPE", SwigType_manglestr(t), ") < 0) {\n",0);
}
Printv(f, Printv(f,
"croak(\"Type error in ", srcname, " of ", iname,". Expected %s\", SWIGTYPE", "croak(\"Type error in ", srcname, " of ", iname,". Expected %s\", SWIGTYPE",
@ -479,6 +482,7 @@ get_pointer(char *iname, char *srcname, char *src, char *dest,
ret, ";\n", ret, ";\n",
"}\n", "}\n",
0); 0);
Delete(lt);
} }
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------