diff options
author | David Faure <faure@kde.org> | 2009-09-13 10:18:57 +0200 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-09-13 10:18:57 +0200 |
commit | b2f2967411bcb23a807f6a17b042b4c58701af95 (patch) | |
tree | 7db490cf7846973e8b9850a87a0abd0e54944c0c /src/corelib/tools/qlist.h | |
parent | 139cffbfe1598b32ffe658968694d163dc53e3dd (diff) |
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/qlist.h')
-rw-r--r-- | src/corelib/tools/qlist.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 31114260ea..49b5c0d019 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -202,7 +202,7 @@ public: inline iterator &operator-=(int j) { i-=j; return *this; } inline iterator operator+(int j) const { return iterator(i+j); } inline iterator operator-(int j) const { return iterator(i-j); } - inline int operator-(iterator j) const { return i - j.i; } + inline int operator-(iterator j) const { return int(i - j.i); } }; friend class iterator; @@ -420,7 +420,7 @@ Q_INLINE_TEMPLATE QList<T> &QList<T>::operator=(const QList<T> &l) template <typename T> inline typename QList<T>::iterator QList<T>::insert(iterator before, const T &t) { - int iBefore = before.i - reinterpret_cast<Node *>(p.begin()); + int iBefore = int(before.i - reinterpret_cast<Node *>(p.begin())); Node *n = reinterpret_cast<Node *>(p.insert(iBefore)); QT_TRY { node_construct(n, t); @@ -706,7 +706,7 @@ Q_OUTOFLINE_TEMPLATE QList<T> &QList<T>::operator+=(const QList<T> &l) node_copy(n, reinterpret_cast<Node *>(p.end()), reinterpret_cast<Node *>(l.p.begin())); } QT_CATCH(...) { // restore the old end - d->end -= (reinterpret_cast<Node *>(p.end()) - n); + d->end -= int(reinterpret_cast<Node *>(p.end()) - n); QT_RETHROW; } return *this; @@ -728,7 +728,7 @@ Q_OUTOFLINE_TEMPLATE int QList<T>::indexOf(const T &t, int from) const Node *e = reinterpret_cast<Node *>(p.end()); while (++n != e) if (n->t() == t) - return n - reinterpret_cast<Node *>(p.begin()); + return int(n - reinterpret_cast<Node *>(p.begin())); } return -1; } |