summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Cowgill <jcowgill@debian.org>2017-10-14 14:04:49 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2017-10-14 14:04:49 +0200
commitaab40a86534b57fae7c309b992d7a11932433a6f (patch)
tree12d7d4223c14a0ee9567d1a6be0e3ce809790ebf
parentd0d4b51651dd5a10f05844bbcf41f87c62567673 (diff)
Fix imagecachetest on big-endian systems. The original code used memcpy which is incorrect on big-endian systems.
-rw-r--r--plugingui/image.cc10
1 files changed, 8 insertions, 2 deletions
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;