diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-05-02 15:25:38 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-05-02 15:25:38 +0200 |
commit | e0f976c5897ca27d758e678e831174dc1349a04a (patch) | |
tree | 236bbe4b9a64fb416a6c3838c782528083a8099b /plugingui/image.cc | |
parent | e786263a0877472558645a9aad023da2704bb4d8 (diff) |
Fix 64bit type errors.
Diffstat (limited to 'plugingui/image.cc')
-rw-r--r-- | plugingui/image.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/plugingui/image.cc b/plugingui/image.cc index 8006317..4986027 100644 --- a/plugingui/image.cc +++ b/plugingui/image.cc @@ -31,6 +31,7 @@ #include <stdio.h> #include <string.h> #include <stdarg.h> +#include <stdint.h> #include <hugin.hpp> @@ -61,8 +62,13 @@ void GUI::Image::setError(int err) const unsigned char *p = (const unsigned char *)rc.data(); - memcpy(&w, p, 4); p += 4; - memcpy(&h, p, 4); p += 4; + uint32_t iw, ih; + + memcpy(&iw, p, sizeof(uint32_t)); p += sizeof(uint32_t); + memcpy(&ih, p, sizeof(uint32_t)); p += sizeof(uint32_t); + + w = iw; + h = ih; DEBUG(image, "w:%d, h:%d\n", (int)w, (int)h); @@ -74,8 +80,11 @@ void GUI::Image::load(const char* data, size_t size) { //unsigned lodepng_decode32(unsigned char** out, unsigned* w, unsigned* h, // const unsigned char* in, size_t insize); + unsigned iw, ih; unsigned res = lodepng_decode32((unsigned char**)&image_data, &w, &h, - (const unsigned char*)data, size); + (const unsigned char*)data, (size_t)size); + w = iw; + h = ih; if(res != 0) { ERR(image, "[read_png_file] Error during init_io"); |