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/global/qendian.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/global/qendian.h')
-rw-r--r-- | src/corelib/global/qendian.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h index 3c804ce..5d9141f 100644 --- a/src/corelib/global/qendian.h +++ b/src/corelib/global/qendian.h @@ -149,9 +149,9 @@ template <> inline quint32 qFromLittleEndian<quint32>(const uchar *src) template <> inline quint16 qFromLittleEndian<quint16>(const uchar *src) { - return 0 - | src[0] - | src[1] * 0x0100; + return quint16(0 + | src[0] + | src[1] * 0x0100); } // signed specializations @@ -241,9 +241,9 @@ inline quint32 qFromBigEndian<quint32>(const uchar *src) template<> inline quint16 qFromBigEndian<quint16>(const uchar *src) { - return 0 - | src[1] - | src[0] * quint16(0x0100); + return quint16( 0 + | src[1] + | src[0] * quint16(0x0100)); } @@ -288,9 +288,9 @@ template <> inline quint32 qbswap<quint32>(quint32 source) template <> inline quint16 qbswap<quint16>(quint16 source) { - return 0 - | ((source & 0x00ff) << 8) - | ((source & 0xff00) >> 8); + return quint16( 0 + | ((source & 0x00ff) << 8) + | ((source & 0xff00) >> 8) ); } // signed specializations |