diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-11-19 08:17:58 +0100 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-11-19 09:09:23 +0100 |
| commit | 51d27f14f3c18e6ed6be8beb3e2ac185b0fdd161 (patch) | |
| tree | 6a87bbc9c141b4a56d63c3717f828004b492090e /sources/pyside6 | |
| parent | 67e9a16a2233685bbfde4338e3588073e3582db8 (diff) | |
PySide6: Use %s-formatting for qDebug() and friends
It causes less overhead than the previously used stream operator.
Pick-to: 6.8
Change-Id: I3ed1365c7da3dee1af3258391d0150ade8a667f0
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'sources/pyside6')
| -rw-r--r-- | sources/pyside6/PySide6/QtCore/typesystem_core_common.xml | 14 | ||||
| -rw-r--r-- | sources/pyside6/PySide6/glue/qtcore.cpp | 8 |
2 files changed, 10 insertions, 12 deletions
diff --git a/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml b/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml index c7a3efe77..fbf25776d 100644 --- a/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml +++ b/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml @@ -66,20 +66,20 @@ <inject-code class="native" position="beginning" file="../glue/qtcore.cpp" snippet="darwin_permission_plugin"/> - <add-function signature="qDebug(const char*)"> - <inject-code file="../glue/qtcore.cpp" snippet="use-stream-for-format-security"/> + <add-function signature="qDebug(const char*@message@)"> + <inject-code file="../glue/qtcore.cpp" snippet="qdebug-format-string"/> <modify-argument index="1" pyi-type="str"/> </add-function> - <add-function signature="qCritical(const char*)"> - <inject-code file="../glue/qtcore.cpp" snippet="use-stream-for-format-security"/> + <add-function signature="qCritical(const char*@message@)"> + <inject-code file="../glue/qtcore.cpp" snippet="qdebug-format-string"/> <modify-argument index="1" pyi-type="str"/> </add-function> - <add-function signature="qFatal(const char*)"> + <add-function signature="qFatal(const char*@message@)"> <inject-code file="../glue/qtcore.cpp" snippet="qfatal"/> <modify-argument index="1" pyi-type="str"/> </add-function> - <add-function signature="qWarning(const char*)"> - <inject-code file="../glue/qtcore.cpp" snippet="use-stream-for-format-security"/> + <add-function signature="qWarning(const char*@message@)"> + <inject-code file="../glue/qtcore.cpp" snippet="qdebug-format-string"/> <modify-argument index="1" pyi-type="str"/> </add-function> diff --git a/sources/pyside6/PySide6/glue/qtcore.cpp b/sources/pyside6/PySide6/glue/qtcore.cpp index a0b11eac6..c17554d79 100644 --- a/sources/pyside6/PySide6/glue/qtcore.cpp +++ b/sources/pyside6/PySide6/glue/qtcore.cpp @@ -1281,13 +1281,11 @@ QT_END_NAMESPACE %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0); // @snippet qt-qunregisterresourcedata -// @snippet use-stream-for-format-security -// Uses the stream version for security reasons -// see gcc man page at -Wformat-security +// @snippet qdebug-format-string Py_BEGIN_ALLOW_THREADS -%FUNCTION_NAME() << %1; +%FUNCTION_NAME("%s", %1); // Uses placeholder for security reasons Py_END_ALLOW_THREADS -// @snippet use-stream-for-format-security +// @snippet qdebug-format-string // @snippet qresource-registerResource auto ptr = reinterpret_cast<uchar *>(Shiboken::Buffer::getPointer(%PYARG_1)); |
