diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2015-03-05 22:25:45 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2015-07-20 15:54:19 +0000 |
commit | 28f5207ca08bed5c16474091a205bc8351574584 (patch) | |
tree | 28512396f684a5e57eaedf18614a0e08456f4b49 /src/corelib/kernel | |
parent | 826a83937da18616ca5358f66598ad991b7c2cee (diff) |
QtCore: Fix const correctness in old style casts
Found with GCC's -Wcast-qual.
Change-Id: Ia0aac2f09e9245339951ffff13c8d4b2920a11fb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qmetatype.cpp | 3 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 8f58d1b7ad..37a26cf556 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -438,7 +438,7 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint static const char *const empty = ""; if (argc == 0 || argv == 0) { argc = 0; - argv = (char **)∅ + argv = const_cast<char **>(&empty); } #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) if (!isArgvModified(argc, argv)) { diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 58912e3fb7..729ca0e0d1 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -1840,7 +1840,8 @@ public: void delegate(const T *where) { DestructorImpl<T>::Destruct(m_type, const_cast<T*>(where)); } void delegate(const void *) {} void delegate(const QMetaTypeSwitcher::UnknownType*) {} - void delegate(const QMetaTypeSwitcher::NotBuiltinType *where) { customTypeDestructor(m_type, (void*)where); } + void delegate(const QMetaTypeSwitcher::NotBuiltinType *where) + { customTypeDestructor(m_type, const_cast<void *>(static_cast<const void *>(where))); } private: static void customTypeDestructor(const int type, void *where) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index cc6970eaeb..d07120e5a8 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -4093,7 +4093,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) QDebugStateSaver saver(dbg); if (!o) return dbg << "QObject(0x0)"; - dbg.nospace() << o->metaObject()->className() << '(' << (void *)o; + dbg.nospace() << o->metaObject()->className() << '(' << (const void *)o; if (!o->objectName().isEmpty()) dbg << ", name = " << o->objectName(); dbg << ')'; |