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/PySide2/glue/qtopengl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sources/pyside2/PySide2/glue/qtopengl.cpp') diff --git a/sources/pyside2/PySide2/glue/qtopengl.cpp b/sources/pyside2/PySide2/glue/qtopengl.cpp index 6c106522c..25b6ee096 100644 --- a/sources/pyside2/PySide2/glue/qtopengl.cpp +++ b/sources/pyside2/PySide2/glue/qtopengl.cpp @@ -39,7 +39,7 @@ // @snippet qglbuffer-allocate int size = (%2 < 0) ? %1.size() : %2; -%CPPSELF.allocate((const void*) %1.data(), size); +%CPPSELF.allocate(static_cast(%1.data()), size); // @snippet qglbuffer-allocate // @snippet qglbuffer-read @@ -47,7 +47,7 @@ char *data = new char[%3]; bool result = %CPPSELF.read(%1, data, %3); QByteArray ret; if (result) - ret.append((const char*)data, %3); + ret.append(data, %3); %PYARG_0 = PyTuple_New(2); PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[bool](result)); PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QByteArray](ret)); @@ -56,12 +56,12 @@ delete[] data; // @snippet qglbuffer-write int size = (%3 < 0) ? %2.size() : %3; -%CPPSELF.write(%1, (const void*) %2.data(), size); +%CPPSELF.write(%1, static_cast(%2.data()), size); // @snippet qglbuffer-write // @snippet qglbuffer-map Py_ssize_t dataSize = %CPPSELF.size(); -void* data = %CPPSELF.map(%1); +void *data = %CPPSELF.map(%1); if (!data) { Py_INCREF(Py_None); -- cgit v1.2.3