From 4d9a11f072ae4972799b87853aa47c927c44790a Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Fri, 6 Aug 2021 22:57:03 +0300 Subject: [PATCH 1/3] generic: remove qt3 support leftovers Signed-off-by: Ivailo Monev --- CMakeLists.txt | 1 - kdeui/tests/kstatusbartest.cpp | 3 --- 2 files changed, 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d6e54fb..a327798a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -234,7 +234,6 @@ endif() ######################################################################### add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) -remove_definitions(-DQT3_SUPPORT_WARNINGS -DQT3_SUPPORT) ################# setup the include directories ################# diff --git a/kdeui/tests/kstatusbartest.cpp b/kdeui/tests/kstatusbartest.cpp index 65aed1b5..1953c075 100644 --- a/kdeui/tests/kstatusbartest.cpp +++ b/kdeui/tests/kstatusbartest.cpp @@ -1,6 +1,3 @@ -#define QT3_SUPPORT -#define QT3_SUPPORT_WARNINGS - #include #include #include From c809676fc10e854c73dbaefb5949974598557bee Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Fri, 6 Aug 2021 23:07:36 +0300 Subject: [PATCH 2/3] kdeui: use Q_BYTE_ORDER to determine byte order Signed-off-by: Ivailo Monev --- kdeui/icons/kiconeffect.cpp | 11 ++++++----- kdeui/notifications/kstatusnotifieritem.cpp | 12 ++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/kdeui/icons/kiconeffect.cpp b/kdeui/icons/kiconeffect.cpp index 5c1d20b5..714941ed 100644 --- a/kdeui/icons/kiconeffect.cpp +++ b/kdeui/icons/kiconeffect.cpp @@ -525,15 +525,16 @@ void KIconEffect::semiTransparent(QImage &img) if(img.format() == QImage::Format_ARGB32_Premultiplied) img = img.convertToFormat(QImage::Format_ARGB32); int width = img.width(); - int height = img.height(); + int height = img.height(); if(painterSupportsAntialiasing()){ unsigned char *line; for(y=0; y>= 1; line += 4; diff --git a/kdeui/notifications/kstatusnotifieritem.cpp b/kdeui/notifications/kstatusnotifieritem.cpp index 9ab1727b..8a9075a7 100644 --- a/kdeui/notifications/kstatusnotifieritem.cpp +++ b/kdeui/notifications/kstatusnotifieritem.cpp @@ -967,13 +967,13 @@ KDbusImageStruct KStatusNotifierItemPrivate::imageToStruct(const QImage &image) } //swap to network byte order if we are little endian - if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) { - quint32 *uintBuf = (quint32 *) icon.data.data(); - for (uint i = 0; i < icon.data.size()/sizeof(quint32); ++i) { - *uintBuf = htonl(*uintBuf); - ++uintBuf; - } +#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN + quint32 *uintBuf = (quint32 *) icon.data.data(); + for (uint i = 0; i < icon.data.size()/sizeof(quint32); ++i) { + *uintBuf = htonl(*uintBuf); + ++uintBuf; } +#endif return icon; } From d2caff73ee03c86dfcb0f89cb931d6e993ffdbb6 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sat, 7 Aug 2021 04:01:29 +0300 Subject: [PATCH 3/3] kdecore: remove now redundant copy of QByteArray::indexOf() code Signed-off-by: Ivailo Monev --- kdecore/services/kmimemagicrule.cpp | 47 +---------------------------- 1 file changed, 1 insertion(+), 46 deletions(-) diff --git a/kdecore/services/kmimemagicrule.cpp b/kdecore/services/kmimemagicrule.cpp index b63eeb5c..0221c4df 100644 --- a/kdecore/services/kmimemagicrule.cpp +++ b/kdecore/services/kmimemagicrule.cpp @@ -20,7 +20,6 @@ #include "kmimemagicrule_p.h" #include #include -#include /* * Historical note: @@ -55,50 +54,6 @@ static bool testMatches(QIODevice* device, qint64 deviceSize, QByteArray& availa return false; } -// Taken from QByteArray::indexOf, but that one uses strncmp so it stops on '\0', -// replaced with memcmp here... -static int indexOf(const QByteArray& that, const QByteArray &ba) -{ - const int l = that.size(); - const int ol = ba.size(); - if (ol > l) - return -1; - if (ol == 0) - return 0; - if (ol == 1) - return that.indexOf(*ba.constData()); - - if (l > 500 && ol > 5) - return QByteArrayMatcher(ba).indexIn(that); - - const char *needle = ba.data(); - const char *haystack = that.data(); - const char *end = that.data() + (l - ol); - const uint ol_minus_1 = ol - 1; - uint hashNeedle = 0, hashHaystack = 0; - int idx; - for (idx = 0; idx < ol; ++idx) { - hashNeedle = ((hashNeedle<<1) + needle[idx]); - hashHaystack = ((hashHaystack<<1) + haystack[idx]); - } - hashHaystack -= *(haystack + ol_minus_1); - - while (haystack <= end) { - hashHaystack += *(haystack + ol_minus_1); - if (hashHaystack == hashNeedle && *needle == *haystack - && memcmp(needle, haystack, ol) == 0) - return haystack - that.data(); - - if (ol_minus_1 < sizeof(uint) * 8 /*CHAR_BIT*/) - hashHaystack -= (*haystack) << ol_minus_1; - hashHaystack <<= 1; - - ++haystack; - } - return -1; -} - - bool KMimeMagicRule::match(QIODevice* device, qint64 deviceSize, QByteArray& availableData) const { return testMatches(device, deviceSize, availableData, m_matches, m_mimetype); @@ -153,7 +108,7 @@ bool KMimeMagicMatch::match(QIODevice* device, qint64 deviceSize, QByteArray& av bool found = false; if (m_mask.isEmpty()) { //kDebug() << "m_data=" << m_data; - found = ::indexOf(readData, m_data) != -1; + found = readData.indexOf(m_data) != -1; //if (found) // kDebug() << "Matched readData=" << readData << "with m_data=" << m_data << "so this is" << mimeType; } else {