Fixed #1300 clang warning in SWIG_Python_ConvertPtrAndOwn.

This commit is contained in:
Michel Zou 2013-02-22 10:11:50 +01:00
commit 8e340c158c
2 changed files with 11 additions and 4 deletions

View file

@ -1231,10 +1231,10 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
*ptr = vptr;
/* transfer the ownership to 'ptr' */
iobj->own = 0;
res = SWIG_AddCast(res);
SWIG_AddCastInplace(&res);
res = SWIG_AddNewMask(res);
} else {
res = SWIG_AddCast(res);
SWIG_AddCastInplace(&res);
}
}
}

View file

@ -161,13 +161,20 @@
# endif
# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
SWIGINTERNINLINE int SWIG_AddCast(int r) {
return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
SWIGINTERNINLINE int SWIG_AddCastInplace(int *r) {
if (SWIG_IsOK(*r)) {
*r = (SWIG_CastRank(*r) < SWIG_MAXCASTRANK) ? (*r + 1) : SWIG_ERROR;
}
}
SWIGINTERNINLINE int SWIG_AddCast(int r) {
SWIG_AddCastInplace(&r);
return r;
}
SWIGINTERNINLINE int SWIG_CheckState(int r) {
return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
}
#else /* no cast-rank mode */
# define SWIG_AddCastInplace(r)
# define SWIG_AddCast
# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
#endif