Fix typemaps for void* and void**.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8727 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
48ced2736d
commit
3ff3be2a2d
2 changed files with 29 additions and 25 deletions
|
|
@ -119,20 +119,22 @@
|
|||
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)) {
|
||||
#ifdef __cplusplus
|
||||
ptr=new $*1_ltype;
|
||||
#else
|
||||
ptr=($*1_ltype) calloc(1,sizeof($*1_ltype));
|
||||
#endif
|
||||
$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");
|
||||
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.");
|
||||
}
|
||||
} else force=0;
|
||||
}
|
||||
force=0;
|
||||
if (arg1==NULL) {
|
||||
#ifdef __cplusplus
|
||||
ptr=new $*1_ltype;
|
||||
#else
|
||||
ptr=($*1_ltype) calloc(1,sizeof($*1_ltype));
|
||||
#endif
|
||||
$1=&ptr;
|
||||
/* have to passback arg$arg too */
|
||||
force=1;
|
||||
}
|
||||
}
|
||||
%typemap(argout) void **,
|
||||
void *&
|
||||
|
|
|
|||
|
|
@ -151,20 +151,22 @@ 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)) {
|
||||
#ifdef __cplusplus
|
||||
ptr=new $*1_ltype;
|
||||
#else
|
||||
ptr=($*1_ltype) calloc(1,sizeof($*1_ltype));
|
||||
#endif
|
||||
$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;
|
||||
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.");
|
||||
}
|
||||
} else force=0;
|
||||
}
|
||||
force=0;
|
||||
if (arg1==NULL) {
|
||||
#ifdef __cplusplus
|
||||
ptr=new $*1_ltype;
|
||||
#else
|
||||
ptr=($*1_ltype) calloc(1,sizeof($*1_ltype));
|
||||
#endif
|
||||
$1=&ptr;
|
||||
/* have to passback arg$arg too */
|
||||
force=1;
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(argout) void **OUTPUT,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue