diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2013-09-20 16:22:12 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-23 21:20:47 +0200 |
commit | cc778e1d2108806ef5d14b87eddd3ce8999c27ee (patch) | |
tree | 3dc7c17b8f6916ce9aa931b7c07b6e83665db0e0 /src/gui | |
parent | 505579ebe4acc7d3719683e257b0397bc6421925 (diff) |
Remove some qBinaryFind usages from QtGui
This is done per the mailing list discussion at
http://www.mail-archive.com/development@qt-project.org/msg01603.html
Change-Id: I9cbb1790f94e7726e127b9ad1bd5a58c433055a8
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/image/qxpmhandler.cpp | 6 | ||||
-rw-r--r-- | src/gui/kernel/qkeysequence.cpp | 6 | ||||
-rw-r--r-- | src/gui/painting/qcolor_p.cpp | 6 |
3 files changed, 12 insertions, 6 deletions
diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp index 0ff3c6239d..528bd4ebb1 100644 --- a/src/gui/image/qxpmhandler.cpp +++ b/src/gui/image/qxpmhandler.cpp @@ -49,6 +49,8 @@ #include <qtextstream.h> #include <qvariant.h> +#include <algorithm> + QT_BEGIN_NAMESPACE static quint64 xpmHash(const QString &str) @@ -747,8 +749,8 @@ inline bool operator<(const XPMRGBData &data, const char *name) static inline bool qt_get_named_xpm_rgb(const char *name_no_space, QRgb *rgb) { - const XPMRGBData *r = qBinaryFind(xpmRgbTbl, xpmRgbTbl + xpmRgbTblSize, name_no_space); - if (r != xpmRgbTbl + xpmRgbTblSize) { + const XPMRGBData *r = std::lower_bound(xpmRgbTbl, xpmRgbTbl + xpmRgbTblSize, name_no_space); + if ((r != xpmRgbTbl + xpmRgbTblSize) && !(name_no_space < *r)) { *rgb = r->value; return true; } else { diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 9464d97932..16324b3659 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -60,6 +60,8 @@ #include <Carbon/Carbon.h> #endif +#include <algorithm> + QT_BEGIN_NAMESPACE #if defined(Q_OS_MACX) @@ -107,8 +109,8 @@ static const MacSpecialKey * const MacSpecialKeyEntriesEnd = entries + NumEntrie QChar qt_macSymbolForQtKey(int key) { - const MacSpecialKey *i = qBinaryFind(entries, MacSpecialKeyEntriesEnd, key); - if (i == MacSpecialKeyEntriesEnd) + const MacSpecialKey *i = std::lower_bound(entries, MacSpecialKeyEntriesEnd, key); + if ((i == MacSpecialKeyEntriesEnd) || (key < *i)) return QChar(); ushort macSymbol = i->macSymbol; if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta) diff --git a/src/gui/painting/qcolor_p.cpp b/src/gui/painting/qcolor_p.cpp index b913f5338c..ca5c56e07e 100644 --- a/src/gui/painting/qcolor_p.cpp +++ b/src/gui/painting/qcolor_p.cpp @@ -49,6 +49,8 @@ #include "qrgb.h" #include "qstringlist.h" +#include <algorithm> + QT_BEGIN_NAMESPACE static inline int h2i(char hex) @@ -301,8 +303,8 @@ inline bool operator<(const RGBData &data, const char *name) static bool get_named_rgb(const char *name_no_space, QRgb *rgb) { QByteArray name = QByteArray(name_no_space).toLower(); - const RGBData *r = qBinaryFind(rgbTbl, rgbTbl + rgbTblSize, name.constData()); - if (r != rgbTbl + rgbTblSize) { + const RGBData *r = std::lower_bound(rgbTbl, rgbTbl + rgbTblSize, name.constData()); + if ((r != rgbTbl + rgbTblSize) && !(name.constData() < *r)) { *rgb = r->value; return true; } |