securing the call to SWIG_IsOK, which is a macro

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8131 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-12-30 01:14:24 +00:00
commit 7223672e09
10 changed files with 63 additions and 58 deletions

View file

@ -1,7 +1,7 @@
%include <std_common.i> %include <std_common.i>
%include <typemaps/implicit.swg> %include <typemaps/implicit.swg>
#warning "This file provide the %implicit directive, which is an old and fragil" #warning "This file provides the %implicit directive, which is an old and fragile"
#warning "way to implement the C++ implicit conversion mechanism." #warning "way to implement the C++ implicit conversion mechanism."
#warning "Try using the more robust '%implicitconv Type;' directive instead." #warning "Try using the more robust '%implicitconv Type;' directive instead."

View file

@ -36,8 +36,7 @@ SWIG_AsVal_dec(bool)(PyObject *obj, bool *val)
/* long */ /* long */
%fragment(SWIG_From_frag(long),"header", %fragment(SWIG_From_frag(long),"header") {
fragment="<limits.h>") {
%define_as(SWIG_From_dec(long), PyInt_FromLong) %define_as(SWIG_From_dec(long), PyInt_FromLong)
} }

View file

@ -101,7 +101,8 @@ namespace swig {
struct traits_as<Type, value_category> { struct traits_as<Type, value_category> {
static Type as(PyObject *obj, bool throw_error) { static Type as(PyObject *obj, bool throw_error) {
Type v; Type v;
if (!obj || !SWIG_IsOK(asval(obj, &v))) { int res = asval(obj, &v);
if (!obj || !SWIG_IsOK(res)) {
if (!PyErr_Occurred()) { if (!PyErr_Occurred()) {
%type_error(swig::type_name<Type>()); %type_error(swig::type_name<Type>());
} }
@ -161,20 +162,22 @@ namespace swig {
template <class Type> template <class Type>
struct traits_check<Type, value_category> { struct traits_check<Type, value_category> {
static bool check(PyObject *obj) { static int check(PyObject *obj) {
return obj && SWIG_IsOK(asval(obj, (Type *)(0))); int res = asval(obj, (Type *)(0));
return obj && SWIG_IsOK(res) ? res : 0;
} }
}; };
template <class Type> template <class Type>
struct traits_check<Type, pointer_category> { struct traits_check<Type, pointer_category> {
static bool check(PyObject *obj) { static int check(PyObject *obj) {
return obj && asptr(obj, (Type **)(0)); int res = asptr(obj, (Type **)(0));
return obj && SWIG_IsOK(res) ? res : 0;
} }
}; };
template <class Type> template <class Type>
inline bool check(PyObject *obj) { inline int check(PyObject *obj) {
return traits_check<Type, typename traits<Type>::category>::check(obj); return traits_check<Type, typename traits<Type>::category>::check(obj);
} }
} }
@ -232,8 +235,9 @@ namespace swig {
template <> template <>
struct traits_check<Type, value_category> { struct traits_check<Type, value_category> {
static bool check(PyObject *obj) { static int check(PyObject *obj) {
return obj && Check(obj); int res = Check(obj);
return obj && res ? res : 0;
} }
}; };
} }

View file

@ -31,7 +31,7 @@
%define Name ## _input_binary(TYPEMAP, SIZE) %define Name ## _input_binary(TYPEMAP, SIZE)
%typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize) (TYPEMAP, SIZE) %typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize) (TYPEMAP, SIZE)
(Char *buf = 0, size_t size = 0, int alloc = 0) { (Char *buf = 0, size_t size = 0, int alloc = 0) {
if (!SWIG_IsOK(SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc))) { if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc)))) {
%argument_fail(SWIG_TypeError, "(TYPEMAP, SIZE)", $argnum); %argument_fail(SWIG_TypeError, "(TYPEMAP, SIZE)", $argnum);
} }
$1 = ($1_ltype) buf; $1 = ($1_ltype) buf;
@ -114,7 +114,7 @@
%define Name ## _bounded_mutable(TYPEMAP,MAX) %define Name ## _bounded_mutable(TYPEMAP,MAX)
%typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize) TYPEMAP %typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize) TYPEMAP
(Char temp[MAX+1], Char *t = 0, size_t n = 0, int alloc = 0) { (Char temp[MAX+1], Char *t = 0, size_t n = 0, int alloc = 0) {
if (!SWIG_IsOK(SWIG_AsCharPtrAndSize($input, &t, &n, &alloc))) { if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &t, &n, &alloc)))) {
%argument_fail(SWIG_TypeError, "TYPEMAP", $argnum); %argument_fail(SWIG_TypeError, "TYPEMAP", $argnum);
} }
if ( n > (size_t) MAX ) n = (size_t) MAX; if ( n > (size_t) MAX ) n = (size_t) MAX;
@ -153,7 +153,7 @@
#if #EXP != "" #if #EXP != ""
expansion += EXP; expansion += EXP;
#endif #endif
if (!SWIG_IsOK(SWIG_AsCharPtrAndSize($input, &t, &n, &alloc))) { if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &t, &n, &alloc)))) {
%argument_fail(SWIG_TypeError, "TYPEMAP", $argnum); %argument_fail(SWIG_TypeError, "TYPEMAP", $argnum);
} }
$1 = %new_array(n+expansion, $*1_ltype); $1 = %new_array(n+expansion, $*1_ltype);
@ -182,7 +182,7 @@
%define Name ## _output_maxsize(TYPEMAP, SIZE) %define Name ## _output_maxsize(TYPEMAP, SIZE)
%typemap(in,noblock=1,fragment=SWIG_AsVal_frag(size_t)) (TYPEMAP, SIZE) (size_t size, Char *buff = 0) { %typemap(in,noblock=1,fragment=SWIG_AsVal_frag(size_t)) (TYPEMAP, SIZE) (size_t size, Char *buff = 0) {
if (!SWIG_IsOK(SWIG_AsVal(size_t)($input, &size))) { if (!SWIG_IsOK((SWIG_AsVal(size_t)($input, &size)))) {
%argument_fail(SWIG_TypeError, "(TYPEMAP, SIZE)", $argnum); %argument_fail(SWIG_TypeError, "(TYPEMAP, SIZE)", $argnum);
} }
buff= %new_array(size+1, Char); buff= %new_array(size+1, Char);
@ -212,7 +212,7 @@
%define Name ## _output_withsize(TYPEMAP, SIZE) %define Name ## _output_withsize(TYPEMAP, SIZE)
%typemap(in,noblock=1,fragment=SWIG_AsVal_frag(size_t)) (TYPEMAP, SIZE) (size_t n, Char *buff = 0, $*2_ltype size) { %typemap(in,noblock=1,fragment=SWIG_AsVal_frag(size_t)) (TYPEMAP, SIZE) (size_t n, Char *buff = 0, $*2_ltype size) {
if (!SWIG_IsOK(SWIG_AsVal(size_t)($input, &n))) { if (!SWIG_IsOK((SWIG_AsVal(size_t)($input, &n)))) {
%argument_fail(SWIG_TypeError, "(TYPEMAP, SIZE)", $argnum); %argument_fail(SWIG_TypeError, "(TYPEMAP, SIZE)", $argnum);
} }
buff= %new_array(n+1, Char); buff= %new_array(n+1, Char);

View file

@ -44,12 +44,14 @@
%define %implicit_frag(Type...) ,fragment=SWIG_Traits_frag(Type) %enddef %define %implicit_frag(Type...) ,fragment=SWIG_Traits_frag(Type) %enddef
%define %implicit_code(Type...) %define %implicit_code(Type...)
if (SWIG_IsOK(swig::asval<Type >(obj, 0))) { {
Type _v; Type _v;
int res = swig::asval<Type >(obj, &_v); int res = swig::asval<Type >(obj, &_v);
if (SWIG_IsOK(res)) {
if (val) *val = %new_copy(_v, value_type); if (val) *val = %new_copy(_v, value_type);
return SWIG_AddNewMask(res); return SWIG_AddNewMask(res);
} }
}
%enddef %enddef
/* implicit */ /* implicit */

View file

@ -71,9 +71,9 @@ or you can use the %apply directive :
*/ */
#if defined(SWIG_INPUT_ACCEPT_PTRS) #if defined(SWIG_INPUT_ACCEPT_PTRS)
#define %check_input_ptr(input,arg,desc,disown) (SWIG_IsOK(res = SWIG_ConvertPtr(input,%as_voidptrptr(arg),desc,disown))) #define %check_input_ptr(input,arg,desc,disown) (SWIG_IsOK((res = SWIG_ConvertPtr(input,%as_voidptrptr(arg),desc,disown))))
#else #else
#define %check_input_ptr(input,arg,desc,disown) (SWIG_IsOK(res = SWIG_ERROR)) #define %check_input_ptr(input,arg,desc,disown) (SWIG_IsOK((res = SWIG_ERROR)))
#endif #endif
%define %_value_input_typemap(code, asval_meth, asval_frag, Type) %define %_value_input_typemap(code, asval_meth, asval_frag, Type)

View file

@ -7,7 +7,7 @@ SWIGINTERN int
SWIG_AsPtr_dec(String)(SWIG_Object obj, String **val) SWIG_AsPtr_dec(String)(SWIG_Object obj, String **val)
{ {
Char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ; Char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ;
if (SWIG_IsOK(SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc))) { if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) {
if (buf) { if (buf) {
if (val) *val = new String(buf, size - 1); if (val) *val = new String(buf, size - 1);
if (alloc == SWIG_NEWOBJ) %delete_array(buf); if (alloc == SWIG_NEWOBJ) %delete_array(buf);

View file

@ -40,7 +40,7 @@
} }
%typemap(in,noblock=1,fragment=#SWIG_AsCharPtr) Char const*& (Char *buf = 0, int alloc = 0) { %typemap(in,noblock=1,fragment=#SWIG_AsCharPtr) Char const*& (Char *buf = 0, int alloc = 0) {
if (!SWIG_IsOK(SWIG_AsCharPtr($input, &buf, &alloc))) { if (!SWIG_IsOK((SWIG_AsCharPtr($input, &buf, &alloc)))) {
%argument_fail(SWIG_TypeError,"$type",$argnum); %argument_fail(SWIG_TypeError,"$type",$argnum);
} }
$1 = &temp; $1 = &temp;
@ -65,7 +65,7 @@
%typemap(varin,noblock=1,fragment=#SWIG_AsCharPtrAndSize) Char * { %typemap(varin,noblock=1,fragment=#SWIG_AsCharPtrAndSize) Char * {
Char *cptr = 0; size_t csize = 0; int alloc = SWIG_NEWOBJ; Char *cptr = 0; size_t csize = 0; int alloc = SWIG_NEWOBJ;
if (!SWIG_IsOK(SWIG_AsCharPtrAndSize($input, &cptr, &csize, &alloc))) { if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &cptr, &csize, &alloc)))) {
%variable_fail(SWIG_TypeError,"$type","$name"); %variable_fail(SWIG_TypeError,"$type","$name");
} }
if ($1) %delete_array($1); if ($1) %delete_array($1);
@ -78,7 +78,7 @@
%typemap(varin,noblock=1,fragment=#SWIG_AsCharPtrAndSize,warning=SWIG_WARN_TYPEMAP_CHARLEAK) const Char * { %typemap(varin,noblock=1,fragment=#SWIG_AsCharPtrAndSize,warning=SWIG_WARN_TYPEMAP_CHARLEAK) const Char * {
Char *cptr = 0; size_t csize = 0; int alloc = SWIG_NEWOBJ; Char *cptr = 0; size_t csize = 0; int alloc = SWIG_NEWOBJ;
if (!SWIG_IsOK(SWIG_AsCharPtrAndSize($input, &cptr, &csize, &alloc))) { if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &cptr, &csize, &alloc)))) {
%variable_fail(SWIG_TypeError, "$type", "$name"); %variable_fail(SWIG_TypeError, "$type", "$name");
} }
if (alloc == SWIG_NEWOBJ) { if (alloc == SWIG_NEWOBJ) {
@ -159,7 +159,7 @@
%typemap(directorout,noblock=1,fragment=#SWIG_AsCharPtr,warning=SWIG_WARN_TYPEMAP_DIRECTOROUT_PTR) %typemap(directorout,noblock=1,fragment=#SWIG_AsCharPtr,warning=SWIG_WARN_TYPEMAP_DIRECTOROUT_PTR)
Char * (Char* buf = 0, int alloc = SWIG_NEWOBJ) { Char * (Char* buf = 0, int alloc = SWIG_NEWOBJ) {
if (!SWIG_IsOK(SWIG_AsCharPtr($input, &buf, &alloc))) { if (!SWIG_IsOK((SWIG_AsCharPtr($input, &buf, &alloc)))) {
%dirout_fail(SWIG_TypeError, "$type"); %dirout_fail(SWIG_TypeError, "$type");
} }
if (alloc == SWIG_NEWOBJ) { if (alloc == SWIG_NEWOBJ) {
@ -178,7 +178,7 @@
%typemap(directorout,noblock=1,fragment=#SWIG_AsCharPtr,warning=SWIG_WARN_TYPEMAP_DIRECTOROUT_PTR) %typemap(directorout,noblock=1,fragment=#SWIG_AsCharPtr,warning=SWIG_WARN_TYPEMAP_DIRECTOROUT_PTR)
Char * const& (Char* buf = 0, int alloc = SWIG_NEWOBJ), Char * const& (Char* buf = 0, int alloc = SWIG_NEWOBJ),
Char const* const& (Char* buf = 0, int alloc = SWIG_NEWOBJ) { Char const* const& (Char* buf = 0, int alloc = SWIG_NEWOBJ) {
if (!SWIG_IsOK(SWIG_AsCharPtr($input, &buf, &alloc))) { if (!SWIG_IsOK((SWIG_AsCharPtr($input, &buf, &alloc)))) {
%dirout_fail(SWIG_TypeError, "$type"); %dirout_fail(SWIG_TypeError, "$type");
} }
static $*ltype tmp = buf; static $*ltype tmp = buf;
@ -249,7 +249,7 @@
Char [ANY] (Char temp[$1_dim0]), Char [ANY] (Char temp[$1_dim0]),
const Char [ANY](Char temp[$1_dim0]) const Char [ANY](Char temp[$1_dim0])
{ {
if (!SWIG_IsOK(SWIG_AsCharArray($input, temp, $1_dim0))) { if (!SWIG_IsOK((SWIG_AsCharArray($input, temp, $1_dim0)))) {
%argument_fail(SWIG_TypeError,"$type",$argnum); %argument_fail(SWIG_TypeError,"$type",$argnum);
} }
$1 = temp; $1 = temp;
@ -258,7 +258,7 @@
%typemap(in,noblock=1,fragment=#SWIG_AsCharArray) const Char (&)[ANY] (Char temp[$1_dim0]) %typemap(in,noblock=1,fragment=#SWIG_AsCharArray) const Char (&)[ANY] (Char temp[$1_dim0])
{ {
if (!SWIG_IsOK(SWIG_AsCharArray($input, temp, $1_dim0))) { if (!SWIG_IsOK((SWIG_AsCharArray($input, temp, $1_dim0)))) {
%argument_fail(SWIG_TypeError,"$type",$argnum); %argument_fail(SWIG_TypeError,"$type",$argnum);
} }
$1 = &temp; $1 = &temp;
@ -279,7 +279,7 @@
%typemap(varin,noblock=1,fragment=#SWIG_AsCharArray) Char [ANY] %typemap(varin,noblock=1,fragment=#SWIG_AsCharArray) Char [ANY]
{ {
if (!SWIG_IsOK(SWIG_AsCharArray($input, $1, $1_dim0))) { if (!SWIG_IsOK((SWIG_AsCharArray($input, $1, $1_dim0)))) {
%variable_fail(SWIG_TypeError, "$type", "$name"); %variable_fail(SWIG_TypeError, "$type", "$name");
} }
} }
@ -327,7 +327,7 @@
Char [ANY] (Char temp[$result_dim0]), Char [ANY] (Char temp[$result_dim0]),
const Char [ANY] (Char temp[$result_dim0]) const Char [ANY] (Char temp[$result_dim0])
{ {
if (!SWIG_IsOK(SWIG_AsCharArray($input, temp, $result_dim0))) { if (!SWIG_IsOK((SWIG_AsCharArray($input, temp, $result_dim0)))) {
%dirout_fail(SWIG_TypeError, "$type"); %dirout_fail(SWIG_TypeError, "$type");
} }
$result = temp; $result = temp;
@ -397,7 +397,7 @@
(Char *STRING, size_t LENGTH) (Char *buf = 0, size_t size = 0, int alloc = 0), (Char *STRING, size_t LENGTH) (Char *buf = 0, size_t size = 0, int alloc = 0),
(const Char *STRING, size_t LENGTH) (Char *buf = 0, size_t size = 0, int alloc = 0) (const Char *STRING, size_t LENGTH) (Char *buf = 0, size_t size = 0, int alloc = 0)
{ {
if (!SWIG_IsOK(SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc))) { if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc)))) {
%argument_fail(SWIG_TypeError,"$type",$argnum); %argument_fail(SWIG_TypeError,"$type",$argnum);
} }
$1 = %static_cast(buf, $1_ltype); $1 = %static_cast(buf, $1_ltype);
@ -416,7 +416,7 @@
(Char *STRING, size_t SIZE) (Char *buf = 0, size_t size = 0, int alloc = 0), (Char *STRING, size_t SIZE) (Char *buf = 0, size_t size = 0, int alloc = 0),
(const Char *STRING, size_t SIZE) (Char *buf = 0, size_t size = 0, int alloc = 0) (const Char *STRING, size_t SIZE) (Char *buf = 0, size_t size = 0, int alloc = 0)
{ {
if (!SWIG_IsOK(SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc))) { if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc)))) {
%argument_fail(SWIG_TypeError,"$type",$argnum); %argument_fail(SWIG_TypeError,"$type",$argnum);
} }
$1 = %static_cast(buf, $1_ltype); $1 = %static_cast(buf, $1_ltype);
@ -437,7 +437,7 @@
(size_t LENGTH, Char *STRING) (Char *buf = 0, size_t size = 0, int alloc = 0), (size_t LENGTH, Char *STRING) (Char *buf = 0, size_t size = 0, int alloc = 0),
(size_t LENGHT, const Char *STRING) (Char *buf = 0, size_t size = 0, int alloc = 0) (size_t LENGHT, const Char *STRING) (Char *buf = 0, size_t size = 0, int alloc = 0)
{ {
if (!SWIG_IsOK(SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc))) { if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc)))) {
%argument_fail(SWIG_TypeError,"$type",$argnum); %argument_fail(SWIG_TypeError,"$type",$argnum);
} }
$2 = %static_cast(buf, $2_ltype) ; $2 = %static_cast(buf, $2_ltype) ;
@ -455,7 +455,7 @@
(size_t SIZE, Char *STRING) (Char *buf = 0, size_t size = 0, int alloc = 0), (size_t SIZE, Char *STRING) (Char *buf = 0, size_t size = 0, int alloc = 0),
(size_t SIZE, const Char *STRING) (Char *buf = 0, size_t size = 0, int alloc = 0) (size_t SIZE, const Char *STRING) (Char *buf = 0, size_t size = 0, int alloc = 0)
{ {
if (!SWIG_IsOK(SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc))) { if (!SWIG_IsOK((SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc)))) {
%argument_fail(SWIG_TypeError, "$type",$argnum); %argument_fail(SWIG_TypeError, "$type",$argnum);
} }
$2 = %static_cast(buf, $2_ltype) ; $2 = %static_cast(buf, $2_ltype) ;

View file

@ -4,7 +4,7 @@
/* Pointers and arrays */ /* Pointers and arrays */
%typemap(in, noblock=1) SWIGTYPE *(void *argp = 0) { %typemap(in, noblock=1) SWIGTYPE *(void *argp = 0) {
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags)))) {
%argument_fail(SWIG_TypeError, "$type", $argnum); %argument_fail(SWIG_TypeError, "$type", $argnum);
} }
$1 = %reinterpret_cast(argp, $ltype); $1 = %reinterpret_cast(argp, $ltype);
@ -12,7 +12,7 @@
%typemap(freearg) SWIGTYPE * ""; %typemap(freearg) SWIGTYPE * "";
%typemap(in, noblock=1) SWIGTYPE [] (void *argp = 0) { %typemap(in, noblock=1) SWIGTYPE [] (void *argp = 0) {
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags)))) {
%argument_fail(SWIG_TypeError, "$type", $argnum); %argument_fail(SWIG_TypeError, "$type", $argnum);
} }
$1 = %reinterpret_cast(argp, $ltype); $1 = %reinterpret_cast(argp, $ltype);
@ -21,7 +21,7 @@
%typemap(in, noblock=1) SWIGTYPE* const& (void *argp = 0, $*ltype temp) { %typemap(in, noblock=1) SWIGTYPE* const& (void *argp = 0, $*ltype temp) {
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &argp, $*descriptor, $disown | %convertptr_flags))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp, $*descriptor, $disown | %convertptr_flags)))) {
%argument_fail(SWIG_TypeError, "$*ltype", $argnum); %argument_fail(SWIG_TypeError, "$*ltype", $argnum);
} }
temp = %reinterpret_cast(argp, $*ltype); temp = %reinterpret_cast(argp, $*ltype);
@ -32,7 +32,7 @@
/* Reference */ /* Reference */
%typemap(in, noblock=1) SWIGTYPE & (void *argp = 0) { %typemap(in, noblock=1) SWIGTYPE & (void *argp = 0) {
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags)))) {
%argument_fail(SWIG_TypeError, "$type", $argnum); %argument_fail(SWIG_TypeError, "$type", $argnum);
} }
if (!argp) { %argument_nullref("$type", $argnum); } if (!argp) { %argument_nullref("$type", $argnum); }
@ -55,7 +55,7 @@
} }
#else #else
%typemap(in,noblock=1) const SWIGTYPE & (void *argp) { %typemap(in,noblock=1) const SWIGTYPE & (void *argp) {
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags)))) {
%argument_fail(SWIG_TypeError, "$type", $argnum); %argument_fail(SWIG_TypeError, "$type", $argnum);
} }
if (!argp) { %argument_nullref("$type", $argnum); } if (!argp) { %argument_nullref("$type", $argnum); }
@ -83,7 +83,7 @@
%typemap(in) SWIGTYPE { %typemap(in) SWIGTYPE {
void *argp; void *argp;
$&ltype temp; $&ltype temp;
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags)))) {
%argument_fail(SWIG_TypeError, "$type", $argnum); %argument_fail(SWIG_TypeError, "$type", $argnum);
} }
if (!argp) { if (!argp) {
@ -268,7 +268,7 @@
#else #else
%typemap(varin,noblock=1) SWIGTYPE { %typemap(varin,noblock=1) SWIGTYPE {
void *argp = 0; void *argp = 0;
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags)))) {
%variable_fail(SWIG_TypeError, "$type", "$name"); %variable_fail(SWIG_TypeError, "$type", "$name");
} }
if (!argp) { if (!argp) {
@ -374,7 +374,7 @@
} }
#else #else
%typemap(directorout,noblock=1) SWIGTYPE (void * argp) { %typemap(directorout,noblock=1) SWIGTYPE (void * argp) {
if (!SWIG_IsOK(SWIG_ConvertPtr($input,&argp,$&descriptor, %convertptr_flags))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input,&argp,$&descriptor, %convertptr_flags)))) {
%dirout_fail(SWIG_TypeError,"$type"); %dirout_fail(SWIG_TypeError,"$type");
} }
$result = *(%reinterpret_cast(argp, $&ltype)); $result = *(%reinterpret_cast(argp, $&ltype));
@ -383,7 +383,7 @@
%typemap(directorout,noblock=1,warning=SWIG_WARN_TYPEMAP_DIRECTOROUT_PTR) %typemap(directorout,noblock=1,warning=SWIG_WARN_TYPEMAP_DIRECTOROUT_PTR)
SWIGTYPE *(void *argp, swig_owntype own) { SWIGTYPE *(void *argp, swig_owntype own) {
if (!SWIG_IsOK(SWIG_ConvertPtrAndOwn($input, &argp, $descriptor, %convertptr_flags | SWIG_POINTER_DISOWN, &own))) { if (!SWIG_IsOK((SWIG_ConvertPtrAndOwn($input, &argp, $descriptor, %convertptr_flags | SWIG_POINTER_DISOWN, &own)))) {
%dirout_fail(SWIG_TypeError,"$type"); %dirout_fail(SWIG_TypeError,"$type");
} }
$result = %reinterpret_cast(argp, $ltype); $result = %reinterpret_cast(argp, $ltype);
@ -397,7 +397,7 @@
%typemap(directorout,noblock=1,warning=SWIG_WARN_TYPEMAP_DIRECTOROUT_PTR) %typemap(directorout,noblock=1,warning=SWIG_WARN_TYPEMAP_DIRECTOROUT_PTR)
SWIGTYPE &(void *argp, swig_owntype own) { SWIGTYPE &(void *argp, swig_owntype own) {
if (!SWIG_IsOK(SWIG_ConvertPtrAndOwn($input, &argp, $descriptor, %convertptr_flags | SWIG_POINTER_DISOWN, &own))) { if (!SWIG_IsOK((SWIG_ConvertPtrAndOwn($input, &argp, $descriptor, %convertptr_flags | SWIG_POINTER_DISOWN, &own)))) {
%dirout_fail(SWIG_TypeError,"$type"); %dirout_fail(SWIG_TypeError,"$type");
} }
if (!argp) { %dirout_nullref("$type"); } if (!argp) { %dirout_nullref("$type"); }
@ -450,7 +450,7 @@
* ------------------------------------------------------------ */ * ------------------------------------------------------------ */
%typemap(in,noblock=1) SWIGTYPE (CLASS::*) { %typemap(in,noblock=1) SWIGTYPE (CLASS::*) {
if (!SWIG_IsOK(SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($type),$descriptor))) { if (!SWIG_IsOK((SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($type),$descriptor)))) {
%argument_fail(SWIG_TypeError,"$type",$argnum); %argument_fail(SWIG_TypeError,"$type",$argnum);
} }
} }
@ -460,7 +460,7 @@
} }
%typemap(varin,noblock=1) SWIGTYPE (CLASS::*) { %typemap(varin,noblock=1) SWIGTYPE (CLASS::*) {
if (!SWIG_IsOK(SWIG_ConvertMember($input,%as_voidptr(&$1), sizeof($type), $descriptor))) { if (!SWIG_IsOK((SWIG_ConvertMember($input,%as_voidptr(&$1), sizeof($type), $descriptor)))) {
%variable_fail(SWIG_TypeError, "$type", "$name"); %variable_fail(SWIG_TypeError, "$type", "$name");
} }
} }
@ -484,7 +484,7 @@
/* directorout */ /* directorout */
%typemap(directorout,noblock=1) SWIGTYPE (CLASS::*) { %typemap(directorout,noblock=1) SWIGTYPE (CLASS::*) {
if (!SWIG_IsOK(SWIG_ConvertMember($input,%as_voidptr(&$result), sizeof($type), $descriptor))) { if (!SWIG_IsOK((SWIG_ConvertMember($input,%as_voidptr(&$result), sizeof($type), $descriptor)))) {
%dirout_fail(SWIG_TypeError,"$type"); %dirout_fail(SWIG_TypeError,"$type");
} }
$result = %reinterpret_cast(argp, $ltype); $result = %reinterpret_cast(argp, $ltype);
@ -501,7 +501,7 @@
some providences. some providences.
*/ */
%typemap(in, noblock=1) SWIGTYPE ((*)(ANY)) { %typemap(in, noblock=1) SWIGTYPE ((*)(ANY)) {
if (!SWIG_IsOK(SWIG_ConvertFunctionPtr($input, (void**)(&$1), $descriptor))) { if (!SWIG_IsOK((SWIG_ConvertFunctionPtr($input, (void**)(&$1), $descriptor)))) {
%argument_fail(SWIG_TypeError,"$type",$argnum); %argument_fail(SWIG_TypeError,"$type",$argnum);
} }
} }
@ -518,7 +518,7 @@
} }
%typemap(varin,noblock=1) SWIGTYPE ((*)(ANY)) { %typemap(varin,noblock=1) SWIGTYPE ((*)(ANY)) {
if (!SWIG_IsOK(SWIG_ConvertFunctionPtr($input, (void**)(&$1), $descriptor))) { if (!SWIG_IsOK((SWIG_ConvertFunctionPtr($input, (void**)(&$1), $descriptor)))) {
%variable_fail(SWIG_TypeError, "$type", "$name"); %variable_fail(SWIG_TypeError, "$type", "$name");
} }
} }
@ -542,7 +542,7 @@
/* directorout */ /* directorout */
%typemap(directorout,noblock=1) SWIGTYPE ((*)(ANY)) { %typemap(directorout,noblock=1) SWIGTYPE ((*)(ANY)) {
if (!SWIG_IsOK(SWIG_ConvertFunctionPtr($input,(void**)(&$result),$descriptor))) { if (!SWIG_IsOK((SWIG_ConvertFunctionPtr($input,(void**)(&$result),$descriptor)))) {
%dirout_fail(SWIG_TypeError,"$type"); %dirout_fail(SWIG_TypeError,"$type");
} }
} }
@ -561,14 +561,14 @@
/* DISOWN typemap */ /* DISOWN typemap */
%typemap(in, noblock=1) SWIGTYPE *DISOWN { %typemap(in, noblock=1) SWIGTYPE *DISOWN {
if (!SWIG_IsOK(SWIG_ConvertPtr($input, %as_voidptrptr(&$1), $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, %as_voidptrptr(&$1), $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags)))) {
%argument_fail(SWIG_TypeError,"$type", $argnum); %argument_fail(SWIG_TypeError,"$type", $argnum);
} }
} }
%typemap(varin,noblock=1) SWIGTYPE *DISOWN { %typemap(varin,noblock=1) SWIGTYPE *DISOWN {
void *temp = 0; void *temp = 0;
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &temp, $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, &temp, $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags)))) {
%variable_fail(SWIG_TypeError, "$type", "$name"); %variable_fail(SWIG_TypeError, "$type", "$name");
} }
$1 = ($ltype) temp; $1 = ($ltype) temp;

View file

@ -5,14 +5,14 @@
/* in */ /* in */
%typemap(in,noblock=1) void * { %typemap(in,noblock=1) void * {
if (!SWIG_IsOK(SWIG_ConvertPtr($input,%as_voidptrptr(&$1), 0, $disown))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input,%as_voidptrptr(&$1), 0, $disown)))) {
%argument_fail(SWIG_TypeError, "$type", $argnum); %argument_fail(SWIG_TypeError, "$type", $argnum);
} }
} }
%typemap(freearg) void * ""; %typemap(freearg) void * "";
%typemap(in,noblock=1) void * const& ($*ltype temp) { %typemap(in,noblock=1) void * const& ($*ltype temp) {
if (!SWIG_IsOK(SWIG_ConvertPtr($input, %as_voidptrptr(&temp), 0, $disown))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, %as_voidptrptr(&temp), 0, $disown)))) {
%argument_fail(SWIG_TypeError, "Stype", $argnum); %argument_fail(SWIG_TypeError, "Stype", $argnum);
} }
$1 = &temp; $1 = &temp;
@ -32,7 +32,7 @@
%typemap(varin,noblock=1) void * { %typemap(varin,noblock=1) void * {
void *temp = 0; void *temp = 0;
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &temp, 0, SWIG_POINTER_DISOWN))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, &temp, 0, SWIG_POINTER_DISOWN)))) {
%variable_fail(SWIG_TypeError, "$type", "$name"); %variable_fail(SWIG_TypeError, "$type", "$name");
} }
$1 = ($1_ltype) temp; $1 = ($1_ltype) temp;
@ -59,14 +59,14 @@
/* directorout */ /* directorout */
%typemap(directorout,noblock=1) void * (void *argp) { %typemap(directorout,noblock=1) void * (void *argp) {
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &argp, 0, 0))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp, 0, 0)))) {
%dirout_fail(SWIG_TypeError,"$type"); %dirout_fail(SWIG_TypeError,"$type");
} }
$result = %reinterpret_cast(argp, $ltype); $result = %reinterpret_cast(argp, $ltype);
} }
%typemap(directorout,noblock=1,warning=SWIG_WARN_TYPEMAP_DIRECTOROUT_PTR) void * const& (void *argp) { %typemap(directorout,noblock=1,warning=SWIG_WARN_TYPEMAP_DIRECTOROUT_PTR) void * const& (void *argp) {
if (!SWIG_IsOK(SWIG_ConvertPtr($input, &argp, 0, $disown))) { if (!SWIG_IsOK((SWIG_ConvertPtr($input, &argp, 0, $disown)))) {
%dirout_fail(SWIG_TypeError,"$type"); %dirout_fail(SWIG_TypeError,"$type");
} }
static $*ltype temp = %reinterpret_cast(argp, $*ltype); static $*ltype temp = %reinterpret_cast(argp, $*ltype);