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

View File

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

View File

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

View File

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