diff options
author | David Faure <faure@kde.org> | 2009-09-13 08:18:57 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-09-13 08:18:57 (GMT) |
commit | b2f2967411bcb23a807f6a17b042b4c58701af95 (patch) | |
tree | 7db490cf7846973e8b9850a87a0abd0e54944c0c /src/corelib/tools/qalgorithms.h | |
parent | 139cffbfe1598b32ffe658968694d163dc53e3dd (diff) | |
download | Qt-b2f2967411bcb23a807f6a17b042b4c58701af95.zip Qt-b2f2967411bcb23a807f6a17b042b4c58701af95.tar.gz Qt-b2f2967411bcb23a807f6a17b042b4c58701af95.tar.bz2 |
Fix -Wconversion warnings where possible.
In order to detect "int foo = myQReal" mistakes, one needs to compile with -Wconversion.
However that flag triggers many warnings inside Qt. This commit fixes many of them, like
qchar.h:295: warning: conversion to 'ushort' from 'unsigned int' may alter its value
qglobal.h:1026: warning: conversion to 'qreal' from 'qint64' may alter its value
qbytearray.h:441: warning: conversion to 'char' from 'int' may alter its value
Other warnings remain (such as those coming from bitfields)
Merge-request: 1460
Reviewed-by: Thiago Macieira <thiago.macieira@nokia.com>
Diffstat (limited to 'src/corelib/tools/qalgorithms.h')
-rw-r--r-- | src/corelib/tools/qalgorithms.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h index 312cd4c..a68ce27 100644 --- a/src/corelib/tools/qalgorithms.h +++ b/src/corelib/tools/qalgorithms.h @@ -227,7 +227,7 @@ template <typename RandomAccessIterator, typename T> Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value) { // Implementation is duplicated from QAlgorithmsPrivate to keep existing code - // compiling. We have to allow using *begin and value with different types, + // compiling. We have to allow using *begin and value with different types, // and then implementing operator< for those types. RandomAccessIterator middle; int n = end - begin; @@ -351,7 +351,7 @@ template <typename RandomAccessIterator, typename T, typename LessThan> Q_OUTOFLINE_TEMPLATE void qSortHelper(RandomAccessIterator start, RandomAccessIterator end, const T &t, LessThan lessThan) { top: - int span = end - start; + int span = int(end - start); if (span < 2) return; @@ -417,9 +417,9 @@ Q_OUTOFLINE_TEMPLATE void qReverse(RandomAccessIterator begin, RandomAccessItera template <typename RandomAccessIterator> Q_OUTOFLINE_TEMPLATE void qRotate(RandomAccessIterator begin, RandomAccessIterator middle, RandomAccessIterator end) { - qReverse(begin, middle); - qReverse(middle, end); - qReverse(begin, end); + qReverse(begin, middle); + qReverse(middle, end); + qReverse(begin, end); } template <typename RandomAccessIterator, typename T, typename LessThan> @@ -463,7 +463,7 @@ Q_OUTOFLINE_TEMPLATE void qStableSortHelper(RandomAccessIterator begin, RandomAc const int span = end - begin; if (span < 2) return; - + const RandomAccessIterator middle = begin + span / 2; qStableSortHelper(begin, middle, t, lessThan); qStableSortHelper(middle, end, t, lessThan); @@ -480,7 +480,7 @@ template <typename RandomAccessIterator, typename T, typename LessThan> Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBoundHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan) { RandomAccessIterator middle; - int n = end - begin; + int n = int(end - begin); int half; while (n > 0) { |