summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2013-09-20 16:22:12 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-23 21:20:47 +0200
commitddefc7627d70c46dadfa934dd3754a2aff0dbfea (patch)
tree79ab3a703bd894c34a293615cf45b095c181663f /src
parent7a6a902e2d7fc6da7e91ab49d75291f905b846ce (diff)
Remove qBinaryFind usages from QtCore
This is done per the mailing list discussion at http://www.mail-archive.com/development@qt-project.org/msg01603.html Change-Id: I6207982c08c92f3e01fb236d2e7546a1c9acd287 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/animation/qvariantanimation.cpp4
-rw-r--r--src/corelib/codecs/qeuckrcodec.cpp6
-rw-r--r--src/corelib/io/qurlidna.cpp9
3 files changed, 11 insertions, 8 deletions
diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp
index a6d013b11a..a23a6a7cda 100644
--- a/src/corelib/animation/qvariantanimation.cpp
+++ b/src/corelib/animation/qvariantanimation.cpp
@@ -310,8 +310,8 @@ void QVariantAnimationPrivate::setCurrentValueForProgress(const qreal progress)
QVariant QVariantAnimationPrivate::valueAt(qreal step) const
{
QVariantAnimation::KeyValues::const_iterator result =
- qBinaryFind(keyValues.begin(), keyValues.end(), qMakePair(step, QVariant()), animationValueLessThan);
- if (result != keyValues.constEnd())
+ std::lower_bound(keyValues.constBegin(), keyValues.constEnd(), qMakePair(step, QVariant()), animationValueLessThan);
+ if (result != keyValues.constEnd() && !animationValueLessThan(qMakePair(step, QVariant()), *result))
return result->second;
return QVariant();
diff --git a/src/corelib/codecs/qeuckrcodec.cpp b/src/corelib/codecs/qeuckrcodec.cpp
index 20ba1e85d6..873b782378 100644
--- a/src/corelib/codecs/qeuckrcodec.cpp
+++ b/src/corelib/codecs/qeuckrcodec.cpp
@@ -70,6 +70,8 @@
#include "qeuckrcodec_p.h"
#include "cp949codetbl_p.h"
+#include <algorithm>
+
QT_BEGIN_NAMESPACE
#ifndef QT_NO_BIG_CODECS
@@ -3383,8 +3385,8 @@ QByteArray QCP949Codec::convertFromUnicode(const QChar *uc, int len, ConverterSt
*cursor++ = (j >> 8) | 0x80;
*cursor++ = (j & 0xff) | 0x80;
} else {
- const unsigned short *ptr = qBinaryFind(cp949_icode_to_unicode, cp949_icode_to_unicode + 8822, ch);
- if (ptr == cp949_icode_to_unicode + 8822) {
+ const unsigned short *ptr = std::lower_bound(cp949_icode_to_unicode, cp949_icode_to_unicode + 8822, ch);
+ if (ptr == cp949_icode_to_unicode + 8822 || ch < *ptr) {
// Error
*cursor++ = replacement;
++invalid;
diff --git a/src/corelib/io/qurlidna.cpp b/src/corelib/io/qurlidna.cpp
index e959faccd2..ee95e590f9 100644
--- a/src/corelib/io/qurlidna.cpp
+++ b/src/corelib/io/qurlidna.cpp
@@ -42,6 +42,7 @@
#include "qurl_p.h"
#include <QtCore/qstringlist.h>
+#include <algorithm>
QT_BEGIN_NAMESPACE
@@ -1461,10 +1462,10 @@ static void mapToLowerCase(QString *str, int from)
++i;
}
}
- const NameprepCaseFoldingEntry *entry = qBinaryFind(NameprepCaseFolding,
- NameprepCaseFolding + N,
- uc);
- if ((entry - NameprepCaseFolding) != N) {
+ const NameprepCaseFoldingEntry *entry = std::lower_bound(NameprepCaseFolding,
+ NameprepCaseFolding + N,
+ uc);
+ if ((entry != NameprepCaseFolding + N) && !(uc < *entry)) {
int l = 1;
while (l < 4 && entry->mapping[l])
++l;