summaryrefslogtreecommitdiffstats
path: root/src/printsupport/kernel/qcups.cpp
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
commit7a6a902e2d7fc6da7e91ab49d75291f905b846ce (patch)
treed015a6f4400808d2745b6faad745d15295dbc552 /src/printsupport/kernel/qcups.cpp
parentb768c0c801a99be7ada0553cbf4a64aca2853444 (diff)
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>
Diffstat (limited to 'src/printsupport/kernel/qcups.cpp')
-rw-r--r--src/printsupport/kernel/qcups.cpp6
1 files 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 <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;
}