Fix tst_qtendian autotest build for WEC7.

MSVC2008 compiler fo ARM targets fail to compile qToUnaligned when
using sizeof(T) inside memcpy fynction. The compiler fails at least
when the code is reached through the following macros and templates:
    -> tst_QtEndian::toLittleEndian
        -> qToLittleEndian(T src, uchar *dest)
            -> qToUnaligned(const T src, uchar *dest)

The above sequence produces internal compiler error with
MSVC2008/ARM builds when called from tst_endian.

As a workaround sizeof(T) is called outside memcpy function.

Change-Id: Ib4d382c2cebecb6e54bb99fc8fad72db93825fcd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
Janne Anttila 2013-04-17 14:26:37 +03:00 committed by The Qt Project
parent de3d449dcf
commit 20d08a96c8

View File

@ -78,7 +78,10 @@ template <typename T> inline void qbswap(const T src, uchar *dest)
// If you want to avoid the memcopy, you must write specializations for this function
template <typename T> inline void qToUnaligned(const T src, uchar *dest)
{
memcpy(dest, &src, sizeof(T));
// Using sizeof(T) inside memcpy function produces internal compiler error with
// MSVC2008/ARM in tst_endian -> use extra indirection to resolve size of T.
const size_t size = sizeof(T);
memcpy(dest, &src, size);
}
/* T qFromLittleEndian(const uchar *src)