Remove some qBinaryFind usages from the CUPS printing code

This is done per the mailing list discussion at
http://www.mail-archive.com/development@qt-project.org/msg01603.html

Change-Id: I0f9c8db3ede32570a1fd6cc43a31e2fc76ab2a0a
Reviewed-by: John Layt <jlayt@kde.org>
This commit is contained in:
Giuseppe D'Angelo 2013-09-20 16:22:12 +02:00 committed by The Qt Project
parent b768c0c801
commit 7a6a902e2d

View File

@ -50,6 +50,8 @@
#endif
#include <qtextcodec.h>
#include <algorithm>
QT_BEGIN_NAMESPACE
extern double qt_multiplierForUnit(QPrinter::Unit unit, int resolution);
@ -659,8 +661,8 @@ inline bool operator<(const NamedPaperSize &data, const char *name)
static inline QPrinter::PaperSize string2PaperSize(const char *name)
{
const NamedPaperSize *r = qBinaryFind(named_sizes_map, named_sizes_map + QPrinter::NPageSize, name);
if (r - named_sizes_map != QPrinter::NPageSize)
const NamedPaperSize *r = std::lower_bound(named_sizes_map, named_sizes_map + QPrinter::NPageSize, name);
if ((r != named_sizes_map + QPrinter::NPageSize) && !(name < *r))
return r->size;
return QPrinter::Custom;
}