From afe3e247110dcb790aac1a34f13aa4fe8d5f78c0 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 5 Mar 2015 22:25:45 -0800 Subject: QPA plugins: Fix const correctness in old style casts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Found with GCC's -Wcast-qual. Change-Id: Ia0aac2f09e9245339951ffff13c946899b4ba15b Reviewed-by: Jørgen Lind Reviewed-by: Shawn Rutledge --- src/plugins/imageformats/ico/qicohandler.cpp | 2 +- .../platforminputcontexts/compose/qcomposeplatforminputcontext.cpp | 2 +- src/plugins/platforms/xcb/qxcbclipboard.cpp | 4 ++-- src/plugins/platforms/xcb/qxcbscreen.cpp | 2 +- src/plugins/platforms/xcb/qxcbsessionmanager.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp index 6e5b81ed36..ab03bfeb04 100644 --- a/src/plugins/imageformats/ico/qicohandler.cpp +++ b/src/plugins/imageformats/ico/qicohandler.cpp @@ -524,7 +524,7 @@ QImage ICOReader::iconAt(int index) iod->seek(iconEntry.dwImageOffset); - const QByteArray pngMagic = QByteArray::fromRawData((char*)pngMagicData, sizeof(pngMagicData)); + const QByteArray pngMagic = QByteArray::fromRawData((const char*)pngMagicData, sizeof(pngMagicData)); const bool isPngImage = (iod->read(pngMagic.size()) == pngMagic); if (isPngImage) { diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp index ad226989a0..49fa32004e 100644 --- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp @@ -97,7 +97,7 @@ bool QComposeInputContext::filterEvent(const QEvent *event) if ((m_tableState & TableGenerator::NoErrors) != TableGenerator::NoErrors) return false; - QKeyEvent *keyEvent = (QKeyEvent *)event; + const QKeyEvent *keyEvent = (const QKeyEvent *)event; // should pass only the key presses if (keyEvent->type() != QEvent::KeyPress) { return false; diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp index d4f1c6ae48..2c0a7a11cc 100644 --- a/src/plugins/platforms/xcb/qxcbclipboard.cpp +++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp @@ -97,7 +97,7 @@ protected: that->format_atoms = m_clipboard->getDataInFormat(modeAtom, m_clipboard->atom(QXcbAtom::TARGETS)); if (format_atoms.size() > 0) { - xcb_atom_t *targets = (xcb_atom_t *) format_atoms.data(); + const xcb_atom_t *targets = (const xcb_atom_t *) format_atoms.data(); int size = format_atoms.size() / sizeof(xcb_atom_t); for (int i = 0; i < size; ++i) { @@ -128,7 +128,7 @@ protected: (void)formats(); // trigger update of format list QVector atoms; - xcb_atom_t *targets = (xcb_atom_t *) format_atoms.data(); + const xcb_atom_t *targets = (const xcb_atom_t *) format_atoms.data(); int size = format_atoms.size() / sizeof(xcb_atom_t); atoms.reserve(size); for (int i = 0; i < size; ++i) diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 78ced43af8..08108f1e20 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -703,7 +703,7 @@ Q_XCB_EXPORT QDebug operator<<(QDebug debug, const QXcbScreen *screen) { const QDebugStateSaver saver(debug); debug.nospace(); - debug << "QXcbScreen(" << (void *)screen; + debug << "QXcbScreen(" << (const void *)screen; if (screen) { debug << fixed << qSetRealNumberPrecision(1); debug << ", name=" << screen->name(); diff --git a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp index 33e67a14b1..328b72234a 100644 --- a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp +++ b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp @@ -125,7 +125,7 @@ static void sm_setProperty(const QString &name, const QString &value) QByteArray v = value.toUtf8(); SmPropValue prop; prop.length = v.length(); - prop.value = (SmPointer) v.constData(); + prop.value = (SmPointer) const_cast(v.constData()); sm_setProperty(name.toLatin1().data(), SmARRAY8, 1, &prop); } -- cgit v1.2.3