aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-11-10 16:35:23 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:08:58 -0300
commit71b34999be9d1f7db63785a13b3ed00b87f3ddd7 (patch)
tree849659d655338b14180bedf0f02cea5d55c3cdc5 /libshiboken
parentf532843860e96af7f3ce3088ff3ac8ea944d8097 (diff)
Changed signature of cppPointer to receive SbkObject* instead of PyObject*.
Diffstat (limited to 'libshiboken')
-rw-r--r--libshiboken/basewrapper.cpp5
-rw-r--r--libshiboken/basewrapper.h2
-rw-r--r--libshiboken/conversions.h10
3 files changed, 8 insertions, 9 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp
index 0214998a7..af61aa007 100644
--- a/libshiboken/basewrapper.cpp
+++ b/libshiboken/basewrapper.cpp
@@ -666,14 +666,13 @@ void releaseOwnership(PyObject* pyObj)
setSequenceOwnership(pyObj, false);
}
-void* cppPointer(PyObject* pyObj, PyTypeObject* desiredType)
+void* cppPointer(SbkObject* pyObj, PyTypeObject* desiredType)
{
- assert(isShibokenType(pyObj));
PyTypeObject* type = pyObj->ob_type;
int idx = 0;
if (reinterpret_cast<SbkObjectType*>(type)->is_multicpp)
idx = getTypeIndexOnHierarchy(type, desiredType);
- return reinterpret_cast<SbkObject*>(pyObj)->d->cptr[idx];
+ return pyObj->d->cptr[idx];
}
bool setCppPointer(SbkObject* sbkObj, PyTypeObject* desiredType, void* cptr)
diff --git a/libshiboken/basewrapper.h b/libshiboken/basewrapper.h
index bc3ecf53b..0c85e9079 100644
--- a/libshiboken/basewrapper.h
+++ b/libshiboken/basewrapper.h
@@ -206,7 +206,7 @@ LIBSHIBOKEN_API void releaseOwnership(SbkObject* pyObj);
/**
* Get the C++ pointer of type \p desiredType from a Python object.
*/
-LIBSHIBOKEN_API void* cppPointer(PyObject* pyObj, PyTypeObject* desiredType);
+LIBSHIBOKEN_API void* cppPointer(SbkObject* pyObj, PyTypeObject* desiredType);
/**
* Set the C++ pointer of type \p desiredType of a Python object.
diff --git a/libshiboken/conversions.h b/libshiboken/conversions.h
index c52e1e4a8..d8e28371f 100644
--- a/libshiboken/conversions.h
+++ b/libshiboken/conversions.h
@@ -150,7 +150,7 @@ struct Converter<T*>
static T* toCpp(PyObject* pyobj)
{
if (PyObject_TypeCheck(pyobj, SbkType<T>()))
- return (T*) Wrapper::cppPointer(pyobj, SbkType<T>());
+ return (T*) Wrapper::cppPointer(reinterpret_cast<SbkObject*>(pyobj), SbkType<T>());
else if (Converter<T>::isConvertible(pyobj))
return CppObjectCopier<T>::copy(Converter<T>::toCpp(pyobj));
else if (pyobj == Py_None)
@@ -241,7 +241,7 @@ struct ValueTypeConverter
}
assert(false);
}
- return *reinterpret_cast<T*>(Wrapper::cppPointer(pyobj, SbkType<T>()));
+ return *reinterpret_cast<T*>(Wrapper::cppPointer(reinterpret_cast<SbkObject*>(pyobj), SbkType<T>()));
}
};
@@ -275,8 +275,8 @@ struct ObjectTypeConverter
return 0;
SbkObjectType* shiboType = reinterpret_cast<SbkObjectType*>(pyobj->ob_type);
if (shiboType->mi_specialcast)
- return (T*) shiboType->mi_specialcast(Wrapper::cppPointer(pyobj, SbkType<T>()), reinterpret_cast<SbkObjectType*>(SbkType<T>()));
- return (T*) Wrapper::cppPointer(pyobj, SbkType<T>());
+ return (T*) shiboType->mi_specialcast(Wrapper::cppPointer(reinterpret_cast<SbkObject*>(pyobj), SbkType<T>()), reinterpret_cast<SbkObjectType*>(SbkType<T>()));
+ return (T*) Wrapper::cppPointer(reinterpret_cast<SbkObject*>(pyobj), SbkType<T>());
}
};
@@ -585,7 +585,7 @@ struct StdListConverter
static StdList toCpp(PyObject* pyobj)
{
if (PyObject_TypeCheck(pyobj, SbkType<StdList>()))
- return *reinterpret_cast<StdList*>(Wrapper::cppPointer(pyobj, SbkType<StdList>()));
+ return *reinterpret_cast<StdList*>(Wrapper::cppPointer(reinterpret_cast<SbkObject*>(pyobj), SbkType<StdList>()));
StdList result;
for (int i = 0; i < PySequence_Size(pyobj); i++) {