summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qglobal.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/global/qglobal.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/global/qglobal.h')
-rw-r--r--src/corelib/global/qglobal.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index b97b9d1..897dcea 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1081,10 +1081,10 @@ inline int qRound(qreal d)
#if defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN)
inline qint64 qRound64(double d)
-{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qint64(d-1) + 0.5) + qint64(d-1); }
+{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qreal(qint64(d-1)) + 0.5) + qint64(d-1); }
#else
inline qint64 qRound64(qreal d)
-{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qint64(d-1) + 0.5) + qint64(d-1); }
+{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qreal(qint64(d-1)) + 0.5) + qint64(d-1); }
#endif
template <typename T>