summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin/qfactoryloader.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2012-09-26 10:32:52 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-14 19:40:18 (GMT)
commitc7e34fccc4366391487d6d9eb4bb58dd374e8035 (patch)
treefb83fc96b73e0922ae5b7f661f99c2db51a81259 /src/corelib/plugin/qfactoryloader.cpp
parent13e58608d1e139bc5b10489cf0161798d4c93e43 (diff)
downloadQt-c7e34fccc4366391487d6d9eb4bb58dd374e8035.zip
Qt-c7e34fccc4366391487d6d9eb4bb58dd374e8035.tar.gz
Qt-c7e34fccc4366391487d6d9eb4bb58dd374e8035.tar.bz2
Prevent an overflow warning in assertions.
Functions like QByteArray::at() assert the given index: Q_ASSERT(i >= 0 && i < size(); These functions typically get inlined. Now if the index is e.g. size() - 2, then gcc will emit an ugly warning in client code ("assuming signed overflow does not occur when assuming that (X - c) > X is always false"). This can be easily prevented by casting both sides of the second comparison in the assertion to their unsigned type. The explicit comparison to zero is then no longer necessary, since that condition is tested implicitly by the other comparison due to unsigned arithmetic. Change-Id: Ic7244e1fa5da00a47d1fe0ed56fb81c23d444dfe Reviewed-by: hjk <qthjk@ovi.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from qtbase/8e90e0805f2981014d3382d8841617b4c56dfc50)
Diffstat (limited to 'src/corelib/plugin/qfactoryloader.cpp')
0 files changed, 0 insertions, 0 deletions