From aab40a86534b57fae7c309b992d7a11932433a6f Mon Sep 17 00:00:00 2001 From: James Cowgill Date: Sat, 14 Oct 2017 14:04:49 +0200 Subject: Fix imagecachetest on big-endian systems. The original code used memcpy which is incorrect on big-endian systems. --- plugingui/image.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'plugingui') diff --git a/plugingui/image.cc b/plugingui/image.cc index 22d1aca..3770fae 100644 --- a/plugingui/image.cc +++ b/plugingui/image.cc @@ -86,10 +86,16 @@ void Image::setError() std::uint32_t iw, ih; - std::memcpy(&iw, ptr, sizeof(uint32_t)); + iw = (uint32_t) ptr[0] | + (uint32_t) ptr[1] << 8 | + (uint32_t) ptr[2] << 16 | + (uint32_t) ptr[3] << 24; ptr += sizeof(uint32_t); - std::memcpy(&ih, ptr, sizeof(uint32_t)); + ih = (uint32_t) ptr[0] | + (uint32_t) ptr[1] << 8 | + (uint32_t) ptr[2] << 16 | + (uint32_t) ptr[3] << 24; ptr += sizeof(uint32_t); _width = iw; -- cgit v1.2.3