aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/libshiboken
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/libshiboken')
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.cpp18
-rw-r--r--sources/shiboken2/libshiboken/bindingmanager.cpp16
-rw-r--r--sources/shiboken2/libshiboken/pep384impl.cpp8
-rw-r--r--sources/shiboken2/libshiboken/sbkarrayconverter.cpp18
-rw-r--r--sources/shiboken2/libshiboken/sbkconverter.cpp6
-rw-r--r--sources/shiboken2/libshiboken/sbkenum.cpp12
-rw-r--r--sources/shiboken2/libshiboken/sbkmodule.cpp8
-rw-r--r--sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp14
-rw-r--r--sources/shiboken2/libshiboken/signature.cpp10
-rw-r--r--sources/shiboken2/libshiboken/voidptr.cpp24
10 files changed, 67 insertions, 67 deletions
diff --git a/sources/shiboken2/libshiboken/basewrapper.cpp b/sources/shiboken2/libshiboken/basewrapper.cpp
index db7d0ad84..6d7bd0c24 100644
--- a/sources/shiboken2/libshiboken/basewrapper.cpp
+++ b/sources/shiboken2/libshiboken/basewrapper.cpp
@@ -207,7 +207,7 @@ PyTypeObject *SbkObjectType_TypeF(void)
static PyObject *SbkObjectGetDict(PyObject *pObj, void *)
{
- SbkObject *obj = reinterpret_cast<SbkObject *>(pObj);
+ auto *obj = reinterpret_cast<SbkObject *>(pObj);
if (!obj->ob_dict)
obj->ob_dict = PyDict_New();
if (!obj->ob_dict)
@@ -223,7 +223,7 @@ static PyGetSetDef SbkObjectGetSetList[] = {
static int SbkObject_traverse(PyObject *self, visitproc visit, void *arg)
{
- SbkObject *sbkSelf = reinterpret_cast<SbkObject *>(self);
+ auto *sbkSelf = reinterpret_cast<SbkObject *>(self);
//Visit children
Shiboken::ParentInfo *pInfo = sbkSelf->d->parentInfo;
@@ -246,7 +246,7 @@ static int SbkObject_traverse(PyObject *self, visitproc visit, void *arg)
static int SbkObject_clear(PyObject *self)
{
- SbkObject *sbkSelf = reinterpret_cast<SbkObject *>(self);
+ auto *sbkSelf = reinterpret_cast<SbkObject *>(self);
Shiboken::Object::removeParent(sbkSelf);
@@ -300,7 +300,7 @@ static int mainThreadDeletionHandler(void *)
static void SbkDeallocWrapperCommon(PyObject *pyObj, bool canDelete)
{
- SbkObject *sbkObj = reinterpret_cast<SbkObject *>(pyObj);
+ auto *sbkObj = reinterpret_cast<SbkObject *>(pyObj);
PyTypeObject *pyType = Py_TYPE(pyObj);
// Need to decref the type if this is the dealloc func; if type
@@ -449,8 +449,8 @@ PyObject *SbkObjectTypeTpNew(PyTypeObject *metatype, PyObject *args, PyObject *k
}
// The meta type creates a new type when the Python programmer extends a wrapped C++ class.
- newfunc type_new = reinterpret_cast<newfunc>(PyType_Type.tp_new);
- SbkObjectType *newType = reinterpret_cast<SbkObjectType *>(type_new(metatype, args, kwds));
+ auto type_new = reinterpret_cast<newfunc>(PyType_Type.tp_new);
+ auto *newType = reinterpret_cast<SbkObjectType *>(type_new(metatype, args, kwds));
if (!newType)
return nullptr;
@@ -842,7 +842,7 @@ introduceWrapperType(PyObject *enclosingObject,
PyObject *heaptype = PyType_FromSpecWithBases(typeSpec, baseTypes);
Py_TYPE(heaptype) = SbkObjectType_TypeF();
Py_INCREF(Py_TYPE(heaptype));
- SbkObjectType *type = reinterpret_cast<SbkObjectType *>(heaptype);
+ auto *type = reinterpret_cast<SbkObjectType *>(heaptype);
if (baseType) {
if (baseTypes) {
for (int i = 0; i < PySequence_Fast_GET_SIZE(baseTypes); ++i)
@@ -862,7 +862,7 @@ introduceWrapperType(PyObject *enclosingObject,
setOriginalName(type, originalName);
setDestructorFunction(type, cppObjDtor);
- PyObject *ob_type = reinterpret_cast<PyObject *>(type);
+ auto *ob_type = reinterpret_cast<PyObject *>(type);
if (wrapperFlags & InnerClass)
return PyDict_SetItemString(enclosingObject, typeName, ob_type) == 0 ? type : nullptr;
@@ -1044,7 +1044,7 @@ void getOwnership(PyObject *pyObj)
void releaseOwnership(SbkObject *self)
{
// skip if the ownership have already moved to c++
- SbkObjectType *selfType = reinterpret_cast<SbkObjectType *>(Py_TYPE(self));
+ auto *selfType = reinterpret_cast<SbkObjectType *>(Py_TYPE(self));
if (!self->d->hasOwnership || Shiboken::Conversions::pythonTypeIsValueType(PepType_SOTP(selfType)->converter))
return;
diff --git a/sources/shiboken2/libshiboken/bindingmanager.cpp b/sources/shiboken2/libshiboken/bindingmanager.cpp
index 92451a153..97ffb1cf2 100644
--- a/sources/shiboken2/libshiboken/bindingmanager.cpp
+++ b/sources/shiboken2/libshiboken/bindingmanager.cpp
@@ -91,7 +91,7 @@ public:
SbkObjectType *identifyType(void **cptr, SbkObjectType *type, SbkObjectType *baseType) const
{
- Edges::const_iterator edgesIt = m_edges.find(type);
+ auto edgesIt = m_edges.find(type);
if (edgesIt != m_edges.end()) {
const NodeList &adjNodes = m_edges.find(type)->second;
for (SbkObjectType *node : adjNodes) {
@@ -154,7 +154,7 @@ bool BindingManager::BindingManagerPrivate::releaseWrapper(void *cptr, SbkObject
// The wrapper argument is checked to ensure that the correct wrapper is released.
// Returns true if the correct wrapper is found and released.
// If wrapper argument is NULL, no such check is performed.
- WrapperMap::iterator iter = wrapperMapper.find(cptr);
+ auto iter = wrapperMapper.find(cptr);
if (iter != wrapperMapper.end() && (wrapper == nullptr || iter->second == wrapper)) {
wrapperMapper.erase(iter);
return true;
@@ -165,7 +165,7 @@ bool BindingManager::BindingManagerPrivate::releaseWrapper(void *cptr, SbkObject
void BindingManager::BindingManagerPrivate::assignWrapper(SbkObject *wrapper, const void *cptr)
{
assert(cptr);
- WrapperMap::iterator iter = wrapperMapper.find(cptr);
+ auto iter = wrapperMapper.find(cptr);
if (iter == wrapperMapper.end())
wrapperMapper.insert(std::make_pair(cptr, wrapper));
}
@@ -238,7 +238,7 @@ void BindingManager::releaseWrapper(SbkObject *sbkObj)
void ** cptrs = reinterpret_cast<SbkObject *>(sbkObj)->d->cptr;
for (int i = 0; i < numBases; ++i) {
- unsigned char *cptr = reinterpret_cast<unsigned char *>(cptrs[i]);
+ auto *cptr = reinterpret_cast<unsigned char *>(cptrs[i]);
m_d->releaseWrapper(cptr, sbkObj);
if (d && d->mi_offsets) {
int *offset = d->mi_offsets;
@@ -266,7 +266,7 @@ void BindingManager::addToDeletionInMainThread(const DestructorEntry &e)
SbkObject *BindingManager::retrieveWrapper(const void *cptr)
{
- WrapperMap::iterator iter = m_d->wrapperMapper.find(cptr);
+ auto iter = m_d->wrapperMapper.find(cptr);
if (iter == m_d->wrapperMapper.end())
return nullptr;
return iter->second;
@@ -299,7 +299,7 @@ PyObject *BindingManager::getOverride(const void *cptr, const char *methodName)
// The first class in the mro (index 0) is the class being checked and it should not be tested.
// The last class in the mro (size - 1) is the base Python object class which should not be tested also.
for (int i = 1; i < PyTuple_GET_SIZE(mro) - 1; i++) {
- PyTypeObject *parent = reinterpret_cast<PyTypeObject *>(PyTuple_GET_ITEM(mro, i));
+ auto *parent = reinterpret_cast<PyTypeObject *>(PyTuple_GET_ITEM(mro, i));
if (parent->tp_dict) {
defaultMethod = PyDict_GetItem(parent->tp_dict, pyMethodName);
if (defaultMethod && PyMethod_GET_FUNCTION(method) != defaultMethod) {
@@ -335,7 +335,7 @@ std::set<PyObject *> BindingManager::getAllPyObjects()
{
std::set<PyObject *> pyObjects;
const WrapperMap &wrappersMap = m_d->wrapperMapper;
- WrapperMap::const_iterator it = wrappersMap.begin();
+ auto it = wrappersMap.begin();
for (; it != wrappersMap.end(); ++it)
pyObjects.insert(reinterpret_cast<PyObject *>(it->second));
@@ -345,7 +345,7 @@ std::set<PyObject *> BindingManager::getAllPyObjects()
void BindingManager::visitAllPyObjects(ObjectVisitor visitor, void *data)
{
WrapperMap copy = m_d->wrapperMapper;
- for (WrapperMap::iterator it = copy.begin(); it != copy.end(); ++it) {
+ for (auto it = copy.begin(); it != copy.end(); ++it) {
if (hasWrapper(it->first))
visitor(it->second, data);
}
diff --git a/sources/shiboken2/libshiboken/pep384impl.cpp b/sources/shiboken2/libshiboken/pep384impl.cpp
index 8a2930fc8..ed205626b 100644
--- a/sources/shiboken2/libshiboken/pep384impl.cpp
+++ b/sources/shiboken2/libshiboken/pep384impl.cpp
@@ -123,13 +123,13 @@ static PyType_Spec typeprobe_spec = {
static void
check_PyTypeObject_valid(void)
{
- PyObject *obtype = reinterpret_cast<PyObject *>(&PyType_Type);
- PyTypeObject *probe_tp_base = reinterpret_cast<PyTypeObject *>(
+ auto *obtype = reinterpret_cast<PyObject *>(&PyType_Type);
+ auto *probe_tp_base = reinterpret_cast<PyTypeObject *>(
PyObject_GetAttrString(obtype, "__base__"));
PyObject *probe_tp_bases = PyObject_GetAttrString(obtype, "__bases__");
- PyTypeObject *check = reinterpret_cast<PyTypeObject *>(
+ auto *check = reinterpret_cast<PyTypeObject *>(
PyType_FromSpecWithBases(&typeprobe_spec, probe_tp_bases));
- PyTypeObject *typetype = reinterpret_cast<PyTypeObject *>(obtype);
+ auto *typetype = reinterpret_cast<PyTypeObject *>(obtype);
PyObject *w = PyObject_GetAttrString(obtype, "__weakrefoffset__");
long probe_tp_weakrefoffset = PyLong_AsLong(w);
PyObject *d = PyObject_GetAttrString(obtype, "__dictoffset__");
diff --git a/sources/shiboken2/libshiboken/sbkarrayconverter.cpp b/sources/shiboken2/libshiboken/sbkarrayconverter.cpp
index 58e0b18a8..fd09efdae 100644
--- a/sources/shiboken2/libshiboken/sbkarrayconverter.cpp
+++ b/sources/shiboken2/libshiboken/sbkarrayconverter.cpp
@@ -83,7 +83,7 @@ inline void convertPySequence(PyObject *pyIn, Converter c, T *out)
// Internal, for usage by numpy
SbkArrayConverter *createArrayConverter(IsArrayConvertibleToCppFunc toCppCheckFunc)
{
- SbkArrayConverter *result = new SbkArrayConverter;
+ auto *result = new SbkArrayConverter;
result->toCppConversions.push_back(toCppCheckFunc);
return result;
}
@@ -115,7 +115,7 @@ static short toShort(PyObject *pyIn) { return short(PyLong_AsLong(pyIn)); }
static void sequenceToCppShortArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<short> *handle = reinterpret_cast<ArrayHandle<short> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<short> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, toShort, handle->data());
}
@@ -148,7 +148,7 @@ static short toUnsignedShort(PyObject *pyIn) { return static_cast<unsigned short
static void sequenceToCppUnsignedShortArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<unsigned short> *handle = reinterpret_cast<ArrayHandle<unsigned short> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<unsigned short> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, toUnsignedShort, handle->data());
}
@@ -160,7 +160,7 @@ static PythonToCppFunc sequenceToCppUnsignedShortArrayCheck(PyObject *pyIn, int
static void sequenceToCppIntArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<int> *handle = reinterpret_cast<ArrayHandle<int> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<int> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, _PepLong_AsInt, handle->data());
}
@@ -172,7 +172,7 @@ static PythonToCppFunc sequenceToCppIntArrayCheck(PyObject *pyIn, int dim1, int
static void sequenceToCppUnsignedArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<unsigned> *handle = reinterpret_cast<ArrayHandle<unsigned> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<unsigned> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, PyLong_AsUnsignedLong, handle->data());
}
@@ -184,7 +184,7 @@ static PythonToCppFunc sequenceToCppUnsignedArrayCheck(PyObject *pyIn, int dim1,
static void sequenceToCppLongLongArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<long long> *handle = reinterpret_cast<ArrayHandle<long long> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<long long> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, PyLong_AsLongLong, handle->data());
}
@@ -196,7 +196,7 @@ static PythonToCppFunc sequenceToCppLongLongArrayCheck(PyObject *pyIn, int dim1,
static void sequenceToCppUnsignedLongLongArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<unsigned long long> *handle = reinterpret_cast<ArrayHandle<unsigned long long> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<unsigned long long> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, PyLong_AsUnsignedLongLong, handle->data());
}
@@ -218,7 +218,7 @@ static inline bool floatArrayCheck(PyObject *pyIn, int expectedSize = -1)
static void sequenceToCppDoubleArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<double> *handle = reinterpret_cast<ArrayHandle<double> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<double> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, PyFloat_AsDouble, handle->data());
}
@@ -227,7 +227,7 @@ static inline float pyToFloat(PyObject *pyIn) { return float(PyFloat_AsDouble(py
static void sequenceToCppFloatArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<float> *handle = reinterpret_cast<ArrayHandle<float> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<float> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, pyToFloat, handle->data());
}
diff --git a/sources/shiboken2/libshiboken/sbkconverter.cpp b/sources/shiboken2/libshiboken/sbkconverter.cpp
index 45551666a..b5246932f 100644
--- a/sources/shiboken2/libshiboken/sbkconverter.cpp
+++ b/sources/shiboken2/libshiboken/sbkconverter.cpp
@@ -206,7 +206,7 @@ PyObject *referenceToPython(const SbkConverter *converter, const void *cppIn)
{
assert(cppIn);
- PyObject *pyOut = reinterpret_cast<PyObject *>(BindingManager::instance().retrieveWrapper(cppIn));
+ auto *pyOut = reinterpret_cast<PyObject *>(BindingManager::instance().retrieveWrapper(cppIn));
if (pyOut) {
Py_INCREF(pyOut);
return pyOut;
@@ -295,7 +295,7 @@ void *cppPointer(PyTypeObject *desiredType, SbkObject *pyIn)
assert(pyIn);
if (!ObjectType::checkType(desiredType))
return pyIn;
- SbkObjectType *inType = reinterpret_cast<SbkObjectType *>(Py_TYPE(pyIn));
+ auto *inType = reinterpret_cast<SbkObjectType *>(Py_TYPE(pyIn));
if (ObjectType::hasCast(inType))
return ObjectType::cast(inType, pyIn, desiredType);
return Object::cppPointer(pyIn, desiredType);
@@ -367,7 +367,7 @@ bool isImplicitConversion(SbkObjectType *type, PythonToCppFunc toCppFunc)
void registerConverterName(SbkConverter *converter , const char *typeName)
{
- ConvertersMap::iterator iter = converters.find(typeName);
+ auto iter = converters.find(typeName);
if (iter == converters.end())
converters.insert(std::make_pair(typeName, converter));
}
diff --git a/sources/shiboken2/libshiboken/sbkenum.cpp b/sources/shiboken2/libshiboken/sbkenum.cpp
index 78dba3c54..8f24cc19a 100644
--- a/sources/shiboken2/libshiboken/sbkenum.cpp
+++ b/sources/shiboken2/libshiboken/sbkenum.cpp
@@ -86,7 +86,7 @@ static PyObject *SbkEnumObject_repr(PyObject *self)
static PyObject *SbkEnumObject_name(PyObject *self, void *)
{
- SbkEnumObject *enum_self = SBK_ENUM(self);
+ auto *enum_self = SBK_ENUM(self);
if (enum_self->ob_name == nullptr)
Py_RETURN_NONE;
@@ -326,7 +326,7 @@ void SbkEnumTypeDealloc(PyObject *pyObj)
PyObject *SbkEnumTypeTpNew(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
{
- newfunc type_new = reinterpret_cast<newfunc>(PyType_GetSlot(&PyType_Type, Py_tp_new));
+ auto type_new = reinterpret_cast<newfunc>(PyType_GetSlot(&PyType_Type, Py_tp_new));
auto newType = reinterpret_cast<SbkEnumType *>(type_new(metatype, args, kwds));
if (!newType)
return nullptr;
@@ -368,7 +368,7 @@ PyObject *getEnumItemFromValue(PyTypeObject *enumType, long itemValue)
PyObject *values = PyDict_GetItemString(enumType->tp_dict, const_cast<char *>("values"));
while (PyDict_Next(values, &pos, &key, &value)) {
- SbkEnumObject *obj = reinterpret_cast<SbkEnumObject *>(value);
+ auto *obj = reinterpret_cast<SbkEnumObject *>(value);
if (obj->ob_value == itemValue) {
Py_INCREF(obj);
return value;
@@ -587,7 +587,7 @@ newTypeWithName(const char *name,
{
// Careful: PyType_FromSpec does not allocate the string.
PyType_Slot newslots[99] = {}; // enough but not too big for the stack
- PyType_Spec *newspec = new PyType_Spec;
+ auto *newspec = new PyType_Spec;
newspec->name = strdup(name);
newspec->basicsize = SbkNewType_spec.basicsize;
newspec->itemsize = SbkNewType_spec.itemsize;
@@ -602,11 +602,11 @@ newTypeWithName(const char *name,
if (numbers_fromFlag)
copyNumberMethods(numbers_fromFlag, newslots, &idx);
newspec->slots = newslots;
- PyTypeObject *type = reinterpret_cast<PyTypeObject *>(PyType_FromSpec(newspec));
+ auto *type = reinterpret_cast<PyTypeObject *>(PyType_FromSpec(newspec));
Py_TYPE(type) = SbkEnumType_TypeF();
Py_INCREF(Py_TYPE(type));
- SbkEnumType *enumType = reinterpret_cast<SbkEnumType *>(type);
+ auto *enumType = reinterpret_cast<SbkEnumType *>(type);
PepType_SETP(enumType)->cppName = cppName;
PepType_SETP(enumType)->converterPtr = &PepType_SETP(enumType)->converter;
DeclaredEnumTypes::instance().addEnumType(type);
diff --git a/sources/shiboken2/libshiboken/sbkmodule.cpp b/sources/shiboken2/libshiboken/sbkmodule.cpp
index 7bfbf51a8..7864471c0 100644
--- a/sources/shiboken2/libshiboken/sbkmodule.cpp
+++ b/sources/shiboken2/libshiboken/sbkmodule.cpp
@@ -84,27 +84,27 @@ PyObject *create(const char *moduleName, void *moduleData)
void registerTypes(PyObject *module, PyTypeObject **types)
{
- ModuleTypesMap::iterator iter = moduleTypes.find(module);
+ auto iter = moduleTypes.find(module);
if (iter == moduleTypes.end())
moduleTypes.insert(std::make_pair(module, types));
}
PyTypeObject **getTypes(PyObject *module)
{
- ModuleTypesMap::iterator iter = moduleTypes.find(module);
+ auto iter = moduleTypes.find(module);
return (iter == moduleTypes.end()) ? 0 : iter->second;
}
void registerTypeConverters(PyObject *module, SbkConverter **converters)
{
- ModuleConvertersMap::iterator iter = moduleConverters.find(module);
+ auto iter = moduleConverters.find(module);
if (iter == moduleConverters.end())
moduleConverters.insert(std::make_pair(module, converters));
}
SbkConverter **getTypeConverters(PyObject *module)
{
- ModuleConvertersMap::iterator iter = moduleConverters.find(module);
+ auto iter = moduleConverters.find(module);
return (iter == moduleConverters.end()) ? 0 : iter->second;
}
diff --git a/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp b/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp
index 8bc680796..996968fa1 100644
--- a/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp
+++ b/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp
@@ -138,7 +138,7 @@ static bool isPrimitiveArray(PyObject *pyIn, int expectedNpType)
{
if (!PyArray_Check(pyIn))
return false;
- PyArrayObject *pya = reinterpret_cast<PyArrayObject *>(pyIn);
+ auto *pya = reinterpret_cast<PyArrayObject *>(pyIn);
if (debugNumPy) {
std::cerr << __FUNCTION__ << "(expectedNpType=" << expectedNpType;
if (const char *name = npTypeName(expectedNpType))
@@ -176,7 +176,7 @@ static inline bool primitiveArrayCheck1(PyObject *pyIn, int expectedNpType, int
if (!isPrimitiveArray<1>(pyIn, expectedNpType))
return false;
if (expectedSize >= 0) {
- PyArrayObject *pya = reinterpret_cast<PyArrayObject *>(pyIn);
+ auto *pya = reinterpret_cast<PyArrayObject *>(pyIn);
const int size = int(PyArray_DIMS(pya)[0]);
if (size < expectedSize) {
warning(PyExc_RuntimeWarning, 0, "A numpy array of size %d was passed to a function expects %d.",
@@ -191,8 +191,8 @@ static inline bool primitiveArrayCheck1(PyObject *pyIn, int expectedNpType, int
template <class T>
static void convertArray1(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<T> *handle = reinterpret_cast<ArrayHandle<T> *>(cppOut);
- PyArrayObject *pya = reinterpret_cast<PyArrayObject *>(pyIn);
+ auto *handle = reinterpret_cast<ArrayHandle<T> *>(cppOut);
+ auto *pya = reinterpret_cast<PyArrayObject *>(pyIn);
const npy_intp size = PyArray_DIMS(pya)[0];
if (debugNumPy)
std::cerr << __FUNCTION__ << ' ' << size << '\n';
@@ -204,8 +204,8 @@ template <class T>
static void convertArray2(PyObject *pyIn, void *cppOut)
{
typedef typename Array2Handle<T, 1>::RowType RowType;
- Array2Handle<T, 1> *handle = reinterpret_cast<Array2Handle<T, 1> *>(cppOut);
- PyArrayObject *pya = reinterpret_cast<PyArrayObject *>(pyIn);
+ auto *handle = reinterpret_cast<Array2Handle<T, 1> *>(cppOut);
+ auto *pya = reinterpret_cast<PyArrayObject *>(pyIn);
handle->setData(reinterpret_cast<RowType *>(PyArray_DATA(pya)));
}
@@ -220,7 +220,7 @@ static inline bool primitiveArrayCheck2(PyObject *pyIn, int expectedNpType, int
if (!isPrimitiveArray<2>(pyIn, expectedNpType))
return false;
if (expectedDim2 >= 0) {
- PyArrayObject *pya = reinterpret_cast<PyArrayObject *>(pyIn);
+ auto *pya = reinterpret_cast<PyArrayObject *>(pyIn);
const int dim1 = int(PyArray_DIMS(pya)[0]);
const int dim2 = int(PyArray_DIMS(pya)[1]);
if (dim1 != expectedDim1 || dim2 != expectedDim2) {
diff --git a/sources/shiboken2/libshiboken/signature.cpp b/sources/shiboken2/libshiboken/signature.cpp
index 6d40ce42c..ad53458c3 100644
--- a/sources/shiboken2/libshiboken/signature.cpp
+++ b/sources/shiboken2/libshiboken/signature.cpp
@@ -234,7 +234,7 @@ compute_name_key(PyObject *ob)
static int
build_name_key_to_func(PyObject *obtype)
{
- PyTypeObject *type = reinterpret_cast<PyTypeObject *>(obtype);
+ auto *type = reinterpret_cast<PyTypeObject *>(obtype);
PyMethodDef *meth = type->tp_methods;
if (meth == nullptr)
@@ -457,7 +457,7 @@ static safe_globals_struc *
init_phase_1(void)
{
{
- safe_globals_struc *p = reinterpret_cast<safe_globals_struc *>
+ auto *p = reinterpret_cast<safe_globals_struc *>
(malloc(sizeof(safe_globals_struc)));
if (p == nullptr)
goto error;
@@ -675,7 +675,7 @@ handle_doc(PyObject *ob, PyObject *old_descr)
init_module_1();
init_module_2();
Shiboken::AutoDecRef ob_type(GetClassOfFunc(ob));
- PyTypeObject *type = reinterpret_cast<PyTypeObject *>(ob_type.object());
+ auto *type = reinterpret_cast<PyTypeObject *>(ob_type.object());
if (handle_doc_in_progress || strncmp(type->tp_name, "PySide2.", 8) != 0)
return PyObject_CallMethod(old_descr, const_cast<char *>("__get__"), const_cast<char *>("(O)"), ob);
handle_doc_in_progress++;
@@ -1056,7 +1056,7 @@ _build_func_to_type(PyObject *obtype)
* and record the mapping from static method to this type in a dict.
* We also check for hidden methods, see below.
*/
- PyTypeObject *type = reinterpret_cast<PyTypeObject *>(obtype);
+ auto *type = reinterpret_cast<PyTypeObject *>(obtype);
PyObject *dict = type->tp_dict;
PyMethodDef *meth = type->tp_methods;
@@ -1128,7 +1128,7 @@ SbkSpecial_Type_Ready(PyObject *module, PyTypeObject *type,
{
if (PyType_Ready(type) < 0)
return -1;
- PyObject *ob_type = reinterpret_cast<PyObject *>(type);
+ auto *ob_type = reinterpret_cast<PyObject *>(type);
int ret = PySide_BuildSignatureArgs(ob_type, signatures);
if (ret < 0) {
PyErr_Print();
diff --git a/sources/shiboken2/libshiboken/voidptr.cpp b/sources/shiboken2/libshiboken/voidptr.cpp
index 0dceefc29..2728b24c8 100644
--- a/sources/shiboken2/libshiboken/voidptr.cpp
+++ b/sources/shiboken2/libshiboken/voidptr.cpp
@@ -61,7 +61,7 @@ PyObject *SbkVoidPtrObject_new(PyTypeObject *type, PyObject *args, PyObject *kwd
// SbkVoidPtrObject *self =
// reinterpret_cast<SbkVoidPtrObject *>(type->tp_alloc);
PyObject *ob = type->tp_alloc(type, 0);
- SbkVoidPtrObject *self = reinterpret_cast<SbkVoidPtrObject *>(ob);
+ auto *self = reinterpret_cast<SbkVoidPtrObject *>(ob);
if (self != nullptr) {
self->cptr = nullptr;
@@ -80,7 +80,7 @@ int SbkVoidPtrObject_init(PyObject *self, PyObject *args, PyObject *kwds)
PyObject *addressObject;
Py_ssize_t size = -1;
int isWritable = 0;
- SbkVoidPtrObject *sbkSelf = reinterpret_cast<SbkVoidPtrObject *>(self);
+ auto *sbkSelf = reinterpret_cast<SbkVoidPtrObject *>(self);
static const char *kwlist[] = {"address", "size", "writeable", nullptr};
@@ -90,7 +90,7 @@ int SbkVoidPtrObject_init(PyObject *self, PyObject *args, PyObject *kwds)
// Void pointer.
if (SbkVoidPtr_Check(addressObject)) {
- SbkVoidPtrObject *sbkOther = reinterpret_cast<SbkVoidPtrObject *>(addressObject);
+ auto *sbkOther = reinterpret_cast<SbkVoidPtrObject *>(addressObject);
sbkSelf->cptr = sbkOther->cptr;
sbkSelf->size = sbkOther->size;
sbkSelf->isWritable = sbkOther->isWritable;
@@ -112,7 +112,7 @@ int SbkVoidPtrObject_init(PyObject *self, PyObject *args, PyObject *kwds)
}
// Shiboken::Object wrapper.
else if (Shiboken::Object::checkType(addressObject)) {
- SbkObject *sbkOther = reinterpret_cast<SbkObject *>(addressObject);
+ auto *sbkOther = reinterpret_cast<SbkObject *>(addressObject);
sbkSelf->cptr = sbkOther->d->cptr[0];
sbkSelf->size = size;
sbkSelf->isWritable = isWritable > 0 ? true : false;
@@ -178,13 +178,13 @@ PyObject *SbkVoidPtrObject_richcmp(PyObject *obj1, PyObject *obj2, int op)
PyObject *SbkVoidPtrObject_int(PyObject *v)
{
- SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
+ auto *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
return PyLong_FromVoidPtr(sbkObject->cptr);
}
PyObject *toBytes(PyObject *self, PyObject *args)
{
- SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(self);
+ auto *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(self);
if (sbkObject->size < 0) {
PyErr_SetString(PyExc_IndexError, "VoidPtr does not have a size set.");
return nullptr;
@@ -202,7 +202,7 @@ static struct PyMethodDef SbkVoidPtrObject_methods[] = {
static Py_ssize_t SbkVoidPtrObject_length(PyObject *v)
{
- SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
+ auto *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
if (sbkObject->size < 0) {
PyErr_SetString(PyExc_IndexError, "VoidPtr does not have a size set.");
return -1;
@@ -218,7 +218,7 @@ PyObject *SbkVoidPtrObject_repr(PyObject *v)
{
- SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
+ auto *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
#ifdef IS_PY3K
PyObject *s = PyUnicode_FromFormat("%s(%p, %zd, %s)",
#else
@@ -234,7 +234,7 @@ PyObject *SbkVoidPtrObject_repr(PyObject *v)
PyObject *SbkVoidPtrObject_str(PyObject *v)
{
- SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
+ auto *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
#ifdef IS_PY3K
PyObject *s = PyUnicode_FromFormat("%s(Address %p, Size %zd, isWritable %s)",
#else
@@ -254,7 +254,7 @@ static int SbkVoidPtrObject_getbuffer(PyObject *obj, Py_buffer *view, int flags)
if (view == nullptr)
return -1;
- SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(obj);
+ auto *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(obj);
if (sbkObject->size < 0)
return -1;
@@ -410,7 +410,7 @@ static PyObject *toPython(const void *cppIn)
static void VoidPtrToCpp(PyObject *pyIn, void *cppOut)
{
- SbkVoidPtrObject *sbkIn = reinterpret_cast<SbkVoidPtrObject *>(pyIn);
+ auto *sbkIn = reinterpret_cast<SbkVoidPtrObject *>(pyIn);
*reinterpret_cast<void **>(cppOut) = sbkIn->cptr;
}
@@ -421,7 +421,7 @@ static PythonToCppFunc VoidPtrToCppIsConvertible(PyObject *pyIn)
static void SbkObjectToCpp(PyObject *pyIn, void *cppOut)
{
- SbkObject *sbkIn = reinterpret_cast<SbkObject *>(pyIn);
+ auto *sbkIn = reinterpret_cast<SbkObject *>(pyIn);
*reinterpret_cast<void **>(cppOut) = sbkIn->d->cptr[0];
}