From 380c65e62de0e60da667dc0d87935171b91b9c6c Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Sun, 16 Jun 2019 12:05:39 +0200 Subject: Cleanup pointer whitespace everywhere Among other files to fix, basewrapper.(cpp|h) was full of uncommon pointer whitespace. After fixing that, I could not resist and fixed also libshiboken, generators, and after acceptance also PySide. Most of the time, this regex worked fine (\w\w+)([*&]+)[ ]*(?![&*]*[/=]) replaced with \1 \2 but everything was checked by hand. I did not touch the shiboken tests which are quite hairy. It turned out that inserting a space between a variable and asterisk causes a crash of shiboken, if the same line contains "CONVERTTOCPP". This was temporarily fixed by adding another space after it. Example.. sources/pyside2/PySide2/glue/qtcore.cpp line 977 QByteArray * cppSelf = %CONVERTTOCPP[QByteArray *](obj); //XXX /|\ omitting this space crashes shiboken! cppgenerator.cpp was special, since it was modified to _generate_ correct pointer whitespace. This caused a few testcases to fail, which had to be adjusted, again. This was difficult since some internal names must end on "*" and generated code normally not. Removing the last errors involved binary search on path sets... Apply C++ 11 fixits to the changed code, where applicable. Done-with: Friedemann.Kleint@qt.io Task-number: PYSIDE-1037 Change-Id: I4ac070f52c5efb296c05d581c9d46e6f397a6c81 Reviewed-by: Qt CI Bot Reviewed-by: Friedemann Kleint --- sources/pyside2/libpyside/pysideqflags.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'sources/pyside2/libpyside/pysideqflags.cpp') diff --git a/sources/pyside2/libpyside/pysideqflags.cpp b/sources/pyside2/libpyside/pysideqflags.cpp index cb57031b0..fd0ed005f 100644 --- a/sources/pyside2/libpyside/pysideqflags.cpp +++ b/sources/pyside2/libpyside/pysideqflags.cpp @@ -47,8 +47,8 @@ extern "C" { struct PySideQFlagsTypePrivate { - SbkConverter** converterPtr; - SbkConverter* converter; + SbkConverter **converterPtr; + SbkConverter *converter; }; /** * Type of all QFlags @@ -58,13 +58,13 @@ extern "C" { PyTypeObject type; }; - #define PYSIDE_QFLAGS(X) reinterpret_cast(X) + #define PYSIDE_QFLAGS(X) reinterpret_cast(X) PyObject *PySideQFlagsNew(PyTypeObject *type, PyObject *args, PyObject * /* kwds */) { long val = 0; if (PyTuple_GET_SIZE(args)) { - PyObject* arg = PyTuple_GET_ITEM(args, 0); + PyObject *arg = PyTuple_GET_ITEM(args, 0); if (Shiboken::isShibokenEnum(arg)) {// faster call val = Shiboken::Enum::getValue(arg); } else if (PyNumber_Check(arg)) { @@ -75,18 +75,18 @@ extern "C" { return 0; } } - PySideQFlagsObject* self = PyObject_New(PySideQFlagsObject, type); + PySideQFlagsObject *self = PyObject_New(PySideQFlagsObject, type); self->ob_value = val; - return reinterpret_cast(self); + return reinterpret_cast(self); } - static long getNumberValue(PyObject* v) + static long getNumberValue(PyObject *v) { Shiboken::AutoDecRef number(PyNumber_Long(v)); return PyLong_AsLong(number); } - PyObject* PySideQFlagsRichCompare(PyObject* self, PyObject* other, int op) + PyObject *PySideQFlagsRichCompare(PyObject *self, PyObject *other, int op) { int result = 0; if (!PyNumber_Check(other)) { @@ -163,7 +163,7 @@ namespace QFlags SbkNewQFlagsType_slots, }; - PyTypeObject *create(const char* name, PyType_Slot numberMethods[]) + PyTypeObject *create(const char *name, PyType_Slot numberMethods[]) { char qualname[200]; // PYSIDE-747: Here we insert now the full class name. @@ -183,7 +183,7 @@ namespace QFlags PyTypeObject *type = (PyTypeObject *)PyType_FromSpec(newspec); Py_TYPE(type) = &PyType_Type; - PySideQFlagsType* flagsType = reinterpret_cast(type); + PySideQFlagsType *flagsType = reinterpret_cast(type); PepType_PFTP(flagsType)->converterPtr = &PepType_PFTP(flagsType)->converter; if (PyType_Ready(type) < 0) @@ -192,14 +192,14 @@ namespace QFlags return type; } - PySideQFlagsObject* newObject(long value, PyTypeObject* type) + PySideQFlagsObject *newObject(long value, PyTypeObject *type) { - PySideQFlagsObject* qflags = PyObject_New(PySideQFlagsObject, type); + PySideQFlagsObject *qflags = PyObject_New(PySideQFlagsObject, type); qflags->ob_value = value; return qflags; } - long getValue(PySideQFlagsObject* self) + long getValue(PySideQFlagsObject *self) { return self->ob_value; } -- cgit v1.2.3