aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2010-10-13 22:18:57 +0000
committerMax Horn2010-10-13 22:18:57 +0000
commit9ca0a6147b0ce336c125ae1c5f9a79c906c6876d (patch)
treeeee2f4a5621de45b122e6a42418abe83926add72
parent810f0875997686157e88445448544da6a47428ca (diff)
downloadscummvm-rg350-9ca0a6147b0ce336c125ae1c5f9a79c906c6876d.tar.gz
scummvm-rg350-9ca0a6147b0ce336c125ae1c5f9a79c906c6876d.tar.bz2
scummvm-rg350-9ca0a6147b0ce336c125ae1c5f9a79c906c6876d.zip
SWORD25: Get rid of (deprecated) access to libpng io_ptr
Unfortunately I cannot test this, so watch our for regressions. svn-id: r53451
-rw-r--r--engines/sword25/gfx/image/pngloader.cpp11
-rw-r--r--engines/sword25/gfx/screenshot.cpp2
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) {