diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-09-01 15:33:58 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-09-02 10:05:35 +0200 |
| commit | e5410148fa4b1ac165df9ea7d3682029b4bfec03 (patch) | |
| tree | 5a5c37e3ebe5b2eca93ad6a38a0b9bc82055c681 /sources/pyside6 | |
| parent | 6a6cf8d6c66e130b541f3d041d0da609f8b97dd0 (diff) | |
Use the C-string functions from namespace std, consistently
Complements 5608c60f47f6c39a6c1dee5fb165c6d70bd1ee3f.
Task-number: PYSIDE-3171
Pick-to: 6.9 6.8
Change-Id: I57f0d8bbd8d0f82367f03d0f55297e74361c44da
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6')
| -rw-r--r-- | sources/pyside6/PySide6/QtCore/glue/core_snippets.cpp | 4 | ||||
| -rw-r--r-- | sources/pyside6/libpyside/dynamicqmetaobject.cpp | 4 | ||||
| -rw-r--r-- | sources/pyside6/libpyside/feature_select.cpp | 6 | ||||
| -rw-r--r-- | sources/pyside6/libpyside/pyside.cpp | 2 | ||||
| -rw-r--r-- | sources/pyside6/libpyside/pysideqenum.cpp | 7 | ||||
| -rw-r--r-- | sources/pyside6/libpyside/pysidesignal.cpp | 6 | ||||
| -rw-r--r-- | sources/pyside6/libpysideremoteobjects/pysidedynamicclass.cpp | 9 |
7 files changed, 23 insertions, 15 deletions
diff --git a/sources/pyside6/PySide6/QtCore/glue/core_snippets.cpp b/sources/pyside6/PySide6/QtCore/glue/core_snippets.cpp index 9b2b40e82..23f932d26 100644 --- a/sources/pyside6/PySide6/QtCore/glue/core_snippets.cpp +++ b/sources/pyside6/PySide6/QtCore/glue/core_snippets.cpp @@ -20,6 +20,8 @@ #include <QtCore/QRegularExpression> #include <QtCore/QStack> +#include <cstring> + // Helpers for qAddPostRoutine namespace PySide { @@ -142,7 +144,7 @@ QString qObjectTr(PyTypeObject *type, const char *sourceText, const char *disamb if (type == sbkObjectType) continue; const char *context = type->tp_name; - const char *dotpos = strrchr(context, '.'); + const char *dotpos = std::strrchr(context, '.'); if (dotpos != nullptr) context = dotpos + 1; result = QCoreApplication::translate(context, sourceText, disambiguation, n); diff --git a/sources/pyside6/libpyside/dynamicqmetaobject.cpp b/sources/pyside6/libpyside/dynamicqmetaobject.cpp index 61327cc1b..1c78394f9 100644 --- a/sources/pyside6/libpyside/dynamicqmetaobject.cpp +++ b/sources/pyside6/libpyside/dynamicqmetaobject.cpp @@ -116,11 +116,11 @@ MetaObjectBuilder::MetaObjectBuilder(PyTypeObject *type, const QMetaObject *meta { m_d->m_baseObject = metaObject; const char *className = type->tp_name; - if (const char *lastDot = strrchr(type->tp_name, '.')) + if (const char *lastDot = std::strrchr(type->tp_name, '.')) className = lastDot + 1; // Different names indicate a Python class inheriting a Qt class. // Parse the type. - if (strcmp(className, metaObject->className()) != 0) { + if (std::strcmp(className, metaObject->className()) != 0) { m_d->m_builder = new QMetaObjectBuilder(); m_d->m_builder->setClassName(className); m_d->m_builder->setSuperClass(metaObject); diff --git a/sources/pyside6/libpyside/feature_select.cpp b/sources/pyside6/libpyside/feature_select.cpp index 2af02beca..f1dd0972b 100644 --- a/sources/pyside6/libpyside/feature_select.cpp +++ b/sources/pyside6/libpyside/feature_select.cpp @@ -14,6 +14,8 @@ #include <QtCore/qstringlist.h> +#include <cstring> + ////////////////////////////////////////////////////////////////////////////// // // PYSIDE-1019: Support switchable extensions @@ -446,9 +448,9 @@ static PyObject *methodWithNewName(PyTypeObject *type, * Create a method with a lower case name. */ auto *obtype = reinterpret_cast<PyObject *>(type); - const auto len = strlen(new_name); + const auto len = std::strlen(new_name); auto *name = new char[len + 1]; - strcpy(name, new_name); + std::strcpy(name, new_name); auto *new_meth = new PyMethodDef; new_meth->ml_name = name; new_meth->ml_meth = meth->ml_meth; diff --git a/sources/pyside6/libpyside/pyside.cpp b/sources/pyside6/libpyside/pyside.cpp index 1ef492eaf..ca09fef1c 100644 --- a/sources/pyside6/libpyside/pyside.cpp +++ b/sources/pyside6/libpyside/pyside.cpp @@ -677,7 +677,7 @@ PyObject *getHiddenDataFromQObject(QObject *cppSelf, PyObject *self, PyObject *n bool inherits(PyTypeObject *objType, const char *class_name) { - if (strcmp(objType->tp_name, class_name) == 0) + if (std::strcmp(objType->tp_name, class_name) == 0) return true; PyTypeObject *base = objType->tp_base; diff --git a/sources/pyside6/libpyside/pysideqenum.cpp b/sources/pyside6/libpyside/pysideqenum.cpp index f15074d59..9576ec715 100644 --- a/sources/pyside6/libpyside/pysideqenum.cpp +++ b/sources/pyside6/libpyside/pysideqenum.cpp @@ -9,12 +9,13 @@ #include <sbkstaticstrings.h> #include <sbkstring.h> -#include <map> - #include <QtCore/qmetatype.h> #include <QtCore/qdebug.h> #include <QtCore/qlist.h> +#include <map> +#include <cstring> + /////////////////////////////////////////////////////////////// // // PYSIDE-957: Create QEnum dynamically from Python Enum @@ -99,7 +100,7 @@ static bool is_module_code() if (ob_name.isNull()) return false; const char *codename = Shiboken::String::toCString(ob_name); - return strcmp(codename, "<module>") == 0; + return std::strcmp(codename, "<module>") == 0; } } // extern "C" diff --git a/sources/pyside6/libpyside/pysidesignal.cpp b/sources/pyside6/libpyside/pysidesignal.cpp index a4d1b66b5..5949e7ff3 100644 --- a/sources/pyside6/libpyside/pysidesignal.cpp +++ b/sources/pyside6/libpyside/pysidesignal.cpp @@ -450,7 +450,7 @@ static FunctionArgumentsResult extractFunctionArgumentsFromSlot(PyObject *slot) // it being actually being that. if (ret.objCode == nullptr) ret.function = nullptr; - } else if (strcmp(Py_TYPE(slot)->tp_name, "compiled_function") == 0) { + } else if (std::strcmp(Py_TYPE(slot)->tp_name, "compiled_function") == 0) { ret.isMethod = false; ret.function = slot; @@ -1259,7 +1259,7 @@ QByteArray getCallbackSignature(QMetaMethod signal, QObject *receiver, prefix += '('; for (int i = 0; i < mo->methodCount(); i++) { QMetaMethod me = mo->method(i); - if ((strncmp(me.methodSignature(), prefix, prefix.size()) == 0) && + if ((std::strncmp(me.methodSignature(), prefix, prefix.size()) == 0) && QMetaObject::checkConnectArgs(signal, me.methodSignature())) { numArgs = me.parameterTypes().size() + useSelf; break; @@ -1279,7 +1279,7 @@ QByteArray getCallbackSignature(QMetaMethod signal, QObject *receiver, prefix += '('; for (int i = 0, count = mo->methodCount(); i < count; ++i) { QMetaMethod me = mo->method(i); - if ((strncmp(me.methodSignature(), prefix, prefix.size()) == 0) && + if ((std::strncmp(me.methodSignature(), prefix, prefix.size()) == 0) && QMetaObject::checkConnectArgs(signal, me)) { numArgs = me.parameterTypes().size() + useSelf; break; diff --git a/sources/pyside6/libpysideremoteobjects/pysidedynamicclass.cpp b/sources/pyside6/libpysideremoteobjects/pysidedynamicclass.cpp index 941e38c6e..8e888ed47 100644 --- a/sources/pyside6/libpysideremoteobjects/pysidedynamicclass.cpp +++ b/sources/pyside6/libpysideremoteobjects/pysidedynamicclass.cpp @@ -25,6 +25,9 @@ #include <QtRemoteObjects/qremoteobjectpendingcall.h> #include <QtRemoteObjects/qremoteobjectreplica.h> +#include <cstring> +#include <cctype> + using namespace Shiboken; class FriendlyReplica : public QRemoteObjectReplica @@ -167,7 +170,7 @@ struct SourceDefs auto name = callData->name.sliced(4); auto index = metaObject->indexOfProperty(name.constData()); if (index < 0) { - name[0] = tolower(name[0]); // Try lower case + name[0] = std::tolower(name[0]); // Try lower case index = metaObject->indexOfProperty(name.constData()); } // It is possible a .rep names a Slot "push" or "pushSomething" that @@ -478,9 +481,9 @@ PyTypeObject *createDynamicClassImpl(QMetaObject *meta) PyTypeObject *createDynamicClass(QMetaObject *meta, PyObject *properties_capsule) { bool isSource; - if (strncmp(meta->superClass()->className(), "QObject", 7) == 0) { + if (std::strncmp(meta->superClass()->className(), "QObject", 7) == 0) { isSource = true; - } else if (strncmp(meta->superClass()->className(), "QRemoteObjectReplica", 20) == 0) { + } else if (std::strncmp(meta->superClass()->className(), "QRemoteObjectReplica", 20) == 0) { isSource = false; } else { PyErr_SetString(PyExc_RuntimeError, |
