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>
This commit is contained in:
Giuseppe D'Angelo 2013-09-20 16:22:12 +02:00 committed by The Qt Project
parent 505579ebe4
commit cc778e1d21
3 changed files with 12 additions and 6 deletions

View File

@ -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 {

View File

@ -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)

View File

@ -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;
}