libpng: use the public api to retrieve io_ptr

This commit is contained in:
scribam 2020-03-25 18:01:27 +01:00
parent f4aefe4fd1
commit 3ccd8c624f
2 changed files with 2 additions and 4 deletions

View File

@ -14,7 +14,6 @@
#include <xxhash.h>
#include "CustomTexture.h"
#include <png.h>
#include <pngstruct.h>
u8* vq_codebook;
u32 palette_index;
@ -1066,7 +1065,7 @@ static size_t png_offset;
static void png_read_vector(png_structp png_ptr, png_bytep data, png_size_t length)
{
const std::vector<u8> *v = (const std::vector<u8> *)png_ptr->io_ptr;
const std::vector<u8> *v = (const std::vector<u8> *)png_get_io_ptr(png_ptr);
memcpy(data, v->data() + png_offset, length);
png_offset += length;
}
@ -1079,7 +1078,7 @@ u8* loadPNGData(const std::vector<u8>& data, int &width, int &height)
static void png_cstd_read(png_structp png_ptr, png_bytep data, png_size_t length)
{
if (fread(data, 1, length, (FILE *)png_ptr->io_ptr) != length)
if (fread(data, 1, length, (FILE *)png_get_io_ptr(png_ptr)) != length)
png_error(png_ptr, "Truncated read error");
}

View File

@ -16,7 +16,6 @@
#define GL_MAJOR_VERSION 0x821B
#endif
#endif
#include <png.h>
#include "oslib/oslib.h"
#include "rend/rend.h"