Fix some cases of converting PHP NULL to C++ NULL
Fixes testcase overload_null for PHP 8.0
This commit is contained in:
parent
37f575b7b4
commit
836258b9d3
2 changed files with 9 additions and 32 deletions
|
|
@ -86,14 +86,10 @@
|
||||||
/* 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 ($needNewFlow) {
|
if (SWIG_ConvertPtr(&$input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) {
|
||||||
$1 = *(($1_ltype *)$obj_value);
|
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor");
|
||||||
} else {
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
$1 = *tmp;
|
|
||||||
}
|
}
|
||||||
|
$1 = *tmp;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%typemap(directorout) SWIGTYPE ($&1_ltype tmp)
|
%typemap(directorout) SWIGTYPE ($&1_ltype tmp)
|
||||||
|
|
@ -115,35 +111,23 @@
|
||||||
%typemap(in) SWIGTYPE *,
|
%typemap(in) SWIGTYPE *,
|
||||||
SWIGTYPE []
|
SWIGTYPE []
|
||||||
%{
|
%{
|
||||||
if ($needNewFlow) {
|
if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0) {
|
||||||
$1 = ($1_ltype) $obj_value;
|
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
|
||||||
} else {
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%typemap(in) SWIGTYPE &,
|
%typemap(in) SWIGTYPE &,
|
||||||
SWIGTYPE &&
|
SWIGTYPE &&
|
||||||
%{
|
%{
|
||||||
if ($needNewFlow) {
|
if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL) {
|
||||||
$1 = ($1_ltype) $obj_value;
|
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
|
||||||
} else {
|
|
||||||
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 *const& ($*ltype temp)
|
%typemap(in) SWIGTYPE *const& ($*ltype temp)
|
||||||
%{
|
%{
|
||||||
if ($needNewFlow) {
|
if (SWIG_ConvertPtr(&$input, (void **) &temp, $*1_descriptor, 0) < 0) {
|
||||||
temp = ($*1_ltype) $obj_value;
|
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $*1_descriptor");
|
||||||
} else {
|
|
||||||
if (SWIG_ConvertPtr(&$input, (void **) &temp, $*1_descriptor, 0) < 0) {
|
|
||||||
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $*1_descriptor");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$1 = ($1_ltype)&temp;
|
$1 = ($1_ltype)&temp;
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
|
|
@ -1354,7 +1354,6 @@ public:
|
||||||
|
|
||||||
String *paramType_class = NULL;
|
String *paramType_class = NULL;
|
||||||
bool paramType_valid = is_class(pt);
|
bool paramType_valid = is_class(pt);
|
||||||
SwigType *resolved = SwigType_typedef_resolve_all(pt);
|
|
||||||
|
|
||||||
if (paramType_valid) {
|
if (paramType_valid) {
|
||||||
paramType_class = get_class_name(pt);
|
paramType_class = get_class_name(pt);
|
||||||
|
|
@ -1365,15 +1364,9 @@ public:
|
||||||
Replaceall(tm, "$source", source);
|
Replaceall(tm, "$source", source);
|
||||||
Replaceall(tm, "$target", ln);
|
Replaceall(tm, "$target", ln);
|
||||||
Replaceall(tm, "$input", source);
|
Replaceall(tm, "$input", source);
|
||||||
if (paramType_valid) {
|
|
||||||
String *param_value = NewStringf("SWIG_Z_FETCH_OBJ_P(&%s)->ptr", source);
|
|
||||||
Replaceall(tm, "$obj_value", param_value);
|
|
||||||
Delete(param_value);
|
|
||||||
}
|
|
||||||
Replaceall(tm, "$needNewFlow", paramType_valid ? (is_class_wrapped(paramType_class) ? "1" : "0") : "0");
|
Replaceall(tm, "$needNewFlow", paramType_valid ? (is_class_wrapped(paramType_class) ? "1" : "0") : "0");
|
||||||
String *temp_obj = NewStringEmpty();
|
String *temp_obj = NewStringEmpty();
|
||||||
Printf(temp_obj, "&%s", ln);
|
Printf(temp_obj, "&%s", ln);
|
||||||
Replaceall(tm, "$obj_value", is_param_type_pointer(resolved ? resolved : pt) ? "NULL" : temp_obj); // Adding this to compile. It won't reach this if $obj_val is required.
|
|
||||||
Setattr(p, "emit:input", source);
|
Setattr(p, "emit:input", source);
|
||||||
Printf(f->code, "%s\n", tm);
|
Printf(f->code, "%s\n", tm);
|
||||||
if (i == 0 && Getattr(p, "self")) {
|
if (i == 0 && Getattr(p, "self")) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue