diff options
Diffstat (limited to 'engines/sword25/gfx')
-rw-r--r-- | engines/sword25/gfx/image/pngloader.cpp | 11 | ||||
-rw-r--r-- | engines/sword25/gfx/screenshot.cpp | 2 |
2 files changed, 8 insertions, 5 deletions
diff --git a/engines/sword25/gfx/image/pngloader.cpp b/engines/sword25/gfx/image/pngloader.cpp index c59d68724d..a2a63fdef0 100644 --- a/engines/sword25/gfx/image/pngloader.cpp +++ b/engines/sword25/gfx/image/pngloader.cpp @@ -56,8 +56,9 @@ PNGLoader::PNGLoader() { // ----------------------------------------------------------------------------- static void png_user_read_data(png_structp png_ptr, png_bytep data, png_size_t length) { - memcpy(data, (char *)png_ptr->io_ptr, length); - png_ptr->io_ptr = (void *)((png_size_t)png_ptr->io_ptr + length); + const byte **ref = (const byte **)png_get_io_ptr(png_ptr); + memcpy(data, *ref, length); + *ref += length; } // ----------------------------------------------------------------------------- @@ -97,7 +98,8 @@ bool PNGLoader::DoDecodeImage(const byte *FileDataPtr, uint FileSize, GraphicEn } // Alternative Lesefunktion benutzen - png_set_read_fn(png_ptr, (void *)FileDataPtr, png_user_read_data); + const byte **ref = &FileDataPtr; + png_set_read_fn(png_ptr, (void *)ref, png_user_read_data); // PNG Header einlesen png_read_info(png_ptr, info_ptr); @@ -234,7 +236,8 @@ bool PNGLoader::DoImageProperties(const byte *FileDataPtr, uint FileSize, Graphi } // Alternative Lesefunktion benutzen - png_set_read_fn(png_ptr, (void *)FileDataPtr, png_user_read_data); + const byte **ref = &FileDataPtr; + png_set_read_fn(png_ptr, (void *)ref, png_user_read_data); // PNG Header einlesen png_read_info(png_ptr, info_ptr); diff --git a/engines/sword25/gfx/screenshot.cpp b/engines/sword25/gfx/screenshot.cpp index 9eea2ec422..941efbdf3c 100644 --- a/engines/sword25/gfx/screenshot.cpp +++ b/engines/sword25/gfx/screenshot.cpp @@ -57,7 +57,7 @@ struct RGB_PIXEL { #include "common/pack-end.h" void userWriteFn(png_structp png_ptr, png_bytep data, png_size_t length) { - static_cast<Common::WriteStream *>(png_ptr->io_ptr)->write(data, length); + static_cast<Common::WriteStream *>(png_get_io_ptr(png_ptr))->write(data, length); } void userFlushFn(png_structp png_ptr) { |