diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-07-03 08:24:42 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-07-03 08:24:47 +0200 |
commit | 67d635fe2cc2c89c30486a2e26dea4106a9d9c16 (patch) | |
tree | b26f1bb7a9639f2b2a875c0cb2b937858b700add /sources/shiboken2/libshiboken/typespec.cpp | |
parent | ffd068caf7063799e0196602e31ca7b1781c3f97 (diff) | |
parent | 75f824b13a2ef12a9a5a33db19216b4e43a72922 (diff) |
Merge remote-tracking branch 'origin/5.13' into dev
Change-Id: I389468b76913ac3c8113ab89833c756a7a72e54f
Diffstat (limited to 'sources/shiboken2/libshiboken/typespec.cpp')
-rw-r--r-- | sources/shiboken2/libshiboken/typespec.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sources/shiboken2/libshiboken/typespec.cpp b/sources/shiboken2/libshiboken/typespec.cpp index a67daf12d..6dc5b00bc 100644 --- a/sources/shiboken2/libshiboken/typespec.cpp +++ b/sources/shiboken2/libshiboken/typespec.cpp @@ -599,17 +599,16 @@ offsetof(PyHeapTypeObject, as_sequence.sq_slice), PyObject * PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases) { - PyHeapTypeObject *res = (PyHeapTypeObject*)PyType_GenericAlloc(&PyType_Type, 0); + auto res = reinterpret_cast<PyHeapTypeObject *>(PyType_GenericAlloc(&PyType_Type, 0)); PyTypeObject *type, *base; PyObject *modname; - char *s; - char *res_start = (char*)res; + auto res_start = reinterpret_cast<char *>(res); PyType_Slot *slot; /* Set the type name and qualname */ - s = (char *)strrchr(spec->name, '.'); // C++11 + auto s = const_cast<char *>(strrchr(spec->name, '.')); // C++11 if (s == NULL) - s = (char*)spec->name; + s = const_cast<char *>(spec->name); else s++; @@ -686,7 +685,7 @@ PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases) if (slot->slot == Py_tp_base || slot->slot == Py_tp_bases) /* Processed above */ continue; - *(void**)(res_start + slotoffsets[slot->slot]) = slot->pfunc; + *reinterpret_cast<void **>(res_start + slotoffsets[slot->slot]) = slot->pfunc; /* need to make a copy of the docstring slot, which usually points to a static string literal */ @@ -746,7 +745,7 @@ PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases) goto fail; } - return (PyObject*)res; + return reinterpret_cast<PyObject *>(res); fail: Py_DECREF(res); @@ -770,7 +769,7 @@ PyType_GetSlot(PyTypeObject *type, int slot) /* Extension module requesting slot from a future version */ return NULL; } - return *(void**)(((char*)type) + slotoffsets[slot]); + return *reinterpret_cast<void **>(reinterpret_cast<char *>(type) + slotoffsets[slot]); } } // extern "C" |