From 7a6a902e2d7fc6da7e91ab49d75291f905b846ce Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 20 Sep 2013 16:22:12 +0200 Subject: [PATCH] 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 --- src/printsupport/kernel/qcups.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/printsupport/kernel/qcups.cpp b/src/printsupport/kernel/qcups.cpp index 21029c09e5..643ffef192 100644 --- a/src/printsupport/kernel/qcups.cpp +++ b/src/printsupport/kernel/qcups.cpp @@ -50,6 +50,8 @@ #endif #include +#include + 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; }