summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qbitarray.h
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2009-09-13 08:18:57 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-09-13 08:18:57 (GMT)
commitb2f2967411bcb23a807f6a17b042b4c58701af95 (patch)
tree7db490cf7846973e8b9850a87a0abd0e54944c0c /src/corelib/tools/qbitarray.h
parent139cffbfe1598b32ffe658968694d163dc53e3dd (diff)
downloadQt-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/qbitarray.h')
-rw-r--r--src/corelib/tools/qbitarray.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/tools/qbitarray.h b/src/corelib/tools/qbitarray.h
index c922262..2ae77b7 100644
--- a/src/corelib/tools/qbitarray.h
+++ b/src/corelib/tools/qbitarray.h
@@ -121,19 +121,19 @@ inline bool QBitArray::testBit(int i) const
inline void QBitArray::setBit(int i)
{ Q_ASSERT(i >= 0 && i < size());
- *(reinterpret_cast<uchar*>(d.data())+1+(i>>3)) |= (1 << (i & 7)); }
+ *(reinterpret_cast<uchar*>(d.data())+1+(i>>3)) |= uchar(1 << (i & 7)); }
inline void QBitArray::clearBit(int i)
{ Q_ASSERT(i >= 0 && i < size());
- *(reinterpret_cast<uchar*>(d.data())+1+(i>>3)) &= ~(1 << (i & 7)); }
+ *(reinterpret_cast<uchar*>(d.data())+1+(i>>3)) &= ~uchar(1 << (i & 7)); }
inline void QBitArray::setBit(int i, bool val)
{ if (val) setBit(i); else clearBit(i); }
inline bool QBitArray::toggleBit(int i)
{ Q_ASSERT(i >= 0 && i < size());
- uchar b = 1<< (i&7); uchar* p = reinterpret_cast<uchar*>(d.data())+1+(i>>3);
- uchar c = *p&b; *p^=b; return c!=0; }
+ uchar b = uchar(1<<(i&7)); uchar* p = reinterpret_cast<uchar*>(d.data())+1+(i>>3);
+ uchar c = uchar(*p&b); *p^=b; return c!=0; }
inline bool QBitArray::operator[](int i) const { return testBit(i); }
inline bool QBitArray::operator[](uint i) const { return testBit(i); }