Fix typemaps for void* and void**.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8727 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Kevin Ruland 2006-02-06 14:02:44 +00:00
commit d90cfcb917
2 changed files with 29 additions and 25 deletions

View file

@ -119,7 +119,13 @@
This bit should go in arginit if arginit support init-ing scripting args */
if(SWIG_ConvertPtr(*$input, (void **) &$1, $1_descriptor, 0) < 0) {
/* So... we didn't get a ref or ptr, but we'll accept NULL by reference */
if ((*$input)->type==IS_NULL && PZVAL_IS_REF(*$input)) {
if (!((*$input)->type==IS_NULL && PZVAL_IS_REF(*$input))) {
/* wasn't a pre/ref/thing, OR anything like an int thing */
SWIG_PHP_Error(E_ERROR, "Type error in argument $arg of $symname.");
}
}
force=0;
if (arg1==NULL) {
#ifdef __cplusplus
ptr=new $*1_ltype;
#else
@ -128,11 +134,7 @@
$1=&ptr;
/* have to passback arg$arg too */
force=1;
} else { /* wasn't a pre/ref/thing, OR anything like an int thing */
force=0;
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
}
} else force=0;
}
%typemap(argout) void **,
void *&

View file

@ -151,7 +151,13 @@ int_typemap(unsigned char);
This bit should go in arginit if arginit support init-ing scripting args */
if(SWIG_ConvertPtr(*$input, (void **) &$1, $1_descriptor, 0) < 0) {
/* So... we didn't get a ref or ptr, but we'll accept NULL by reference */
if ((*$input)->type==IS_NULL && PZVAL_IS_REF(*$input)) {
if (!((*$input)->type==IS_NULL && PZVAL_IS_REF(*$input))) {
/* wasn't a pre/ref/thing, OR anything like an int thing */
SWIG_PHP_Error(E_ERROR, "Type error in argument $arg of $symname.");
}
}
force=0;
if (arg1==NULL) {
#ifdef __cplusplus
ptr=new $*1_ltype;
#else
@ -160,11 +166,7 @@ int_typemap(unsigned char);
$1=&ptr;
/* have to passback arg$arg too */
force=1;
} else { /* wasn't a pre/ref/thing, OR anything like an int thing */
force=0;
SWIG_PHP_Error(E_ERROR, "Type error in argument $arg of $symname.");
}
} else force=0;
}
%typemap(argout) void **OUTPUT,