Don't segfault if PHP Null is passed where a C++ reference is wanted.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9094 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ff7ab7afac
commit
843444d5ba
2 changed files with 20 additions and 8 deletions
|
|
@ -1,6 +1,10 @@
|
||||||
Version 1.3.30 (in progress)
|
Version 1.3.30 (in progress)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
05/07/2006: olly
|
||||||
|
[php] Don't segfault if PHP Null is passed where a C++ reference
|
||||||
|
is wanted.
|
||||||
|
|
||||||
05/05/2006: olly
|
05/05/2006: olly
|
||||||
[php] Fix wrappers generated for global 'char' variables to not
|
[php] Fix wrappers generated for global 'char' variables to not
|
||||||
include a terminating zero in the PHP string.
|
include a terminating zero in the PHP string.
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
%include <globalvar.i> // Global variables.
|
%include <globalvar.i> // Global variables.
|
||||||
%include <const.i>
|
%include <const.i>
|
||||||
|
|
||||||
// use %init %{ "/*code goes here*/ " %}
|
// use %init %{ "/*code goes here*/ " %}
|
||||||
// or %minit %{ "/* code goes here*/ " %} to
|
// or %minit %{ "/* code goes here*/ " %} to
|
||||||
// insert code in the PHP_MINIT_FUNCTION
|
// insert code in the PHP_MINIT_FUNCTION
|
||||||
#define %minit %insert("init")
|
#define %minit %insert("init")
|
||||||
|
|
@ -76,21 +76,29 @@
|
||||||
/* Object passed by value. Convert to a pointer */
|
/* Object passed by value. Convert to a pointer */
|
||||||
%typemap(in) SWIGTYPE ($&1_ltype tmp)
|
%typemap(in) SWIGTYPE ($&1_ltype tmp)
|
||||||
{
|
{
|
||||||
if(SWIG_ConvertPtr(*$input, (void **) &tmp, $&1_descriptor, 0) < 0) {
|
if(SWIG_ConvertPtr(*$input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) {
|
||||||
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor");
|
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor");
|
||||||
}
|
}
|
||||||
$1 = *tmp;
|
$1 = *tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(in) SWIGTYPE *,
|
%typemap(in) SWIGTYPE *,
|
||||||
SWIGTYPE [],
|
SWIGTYPE []
|
||||||
SWIGTYPE &
|
|
||||||
{
|
{
|
||||||
/* typemap(in) SWIGTYPE * */
|
/* typemap(in) SWIGTYPE * or SWIGTYPE [] */
|
||||||
if(SWIG_ConvertPtr(*$input, (void **) &$1, $1_descriptor, 0) < 0) {
|
if(SWIG_ConvertPtr(*$input, (void **) &$1, $1_descriptor, 0) < 0) {
|
||||||
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
|
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%typemap(in) SWIGTYPE &
|
||||||
|
{
|
||||||
|
/* typemap(in) SWIGTYPE & */
|
||||||
|
if(SWIG_ConvertPtr(*$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL) {
|
||||||
|
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
%typemap(in) SWIGTYPE *DISOWN
|
%typemap(in) SWIGTYPE *DISOWN
|
||||||
{
|
{
|
||||||
/* typemap(in) SWIGTYPE *DISOWN */
|
/* typemap(in) SWIGTYPE *DISOWN */
|
||||||
|
|
@ -101,7 +109,7 @@
|
||||||
%typemap(argout) SWIGTYPE *,
|
%typemap(argout) SWIGTYPE *,
|
||||||
SWIGTYPE [],
|
SWIGTYPE [],
|
||||||
SWIGTYPE&;
|
SWIGTYPE&;
|
||||||
|
|
||||||
%typemap(in) void *
|
%typemap(in) void *
|
||||||
{
|
{
|
||||||
if(SWIG_ConvertPtr(*$input, (void **) &$1, 0, 0) < 0) {
|
if(SWIG_ConvertPtr(*$input, (void **) &$1, 0, 0) < 0) {
|
||||||
|
|
@ -163,7 +171,7 @@
|
||||||
ZVAL_LONG(return_value,$1);
|
ZVAL_LONG(return_value,$1);
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(out) bool
|
%typemap(out) bool
|
||||||
{
|
{
|
||||||
ZVAL_BOOL(return_value,($1)?1:0);
|
ZVAL_BOOL(return_value,($1)?1:0);
|
||||||
}
|
}
|
||||||
|
|
@ -268,7 +276,7 @@
|
||||||
void *tmp;
|
void *tmp;
|
||||||
_v = (SWIG_ConvertPtr( *$input, (void**)&tmp, $1_descriptor, 0) < 0)? 0:1;
|
_v = (SWIG_ConvertPtr( *$input, (void**)&tmp, $1_descriptor, 0) < 0)? 0:1;
|
||||||
}
|
}
|
||||||
|
|
||||||
%typecheck(SWIG_TYPECHECK_VOIDPTR) void *
|
%typecheck(SWIG_TYPECHECK_VOIDPTR) void *
|
||||||
" /* tyepcheck void * */ "
|
" /* tyepcheck void * */ "
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue