summarylogtreecommitdiffstats
path: root/40-libpng16.patch
diff options
context:
space:
mode:
authorMike Swanson2017-08-26 14:49:08 -0700
committerMike Swanson2017-08-26 14:58:21 -0700
commitc3d7bf13209f076a455eae343e515570fbc723a3 (patch)
tree57d48405ea0d8bb07d6b360bf959850323d386cc /40-libpng16.patch
parent0412e49c1c8ff3f85e96b204038ab801f02cdf0b (diff)
downloadaur-c3d7bf13209f076a455eae343e515570fbc723a3.tar.gz
Update to a git snapshot
Builds with GCC 7.1.1 and some other libraries, via patches from Debian
Diffstat (limited to '40-libpng16.patch')
-rw-r--r--40-libpng16.patch75
1 files changed, 75 insertions, 0 deletions
diff --git a/40-libpng16.patch b/40-libpng16.patch
new file mode 100644
index 000000000000..c8ad60d3720d
--- /dev/null
+++ b/40-libpng16.patch
@@ -0,0 +1,75 @@
+Description: Patch for libpng1.6's changed API
+Author: Tobias Frost <tobi@debian.org>
+Forwarded: https://github.com/RobertBeckebans/RBDOOM-3-BFG/pull/293
+Last-Update: 2016-02-01
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/neo/renderer/Image_files.cpp
++++ b/neo/renderer/Image_files.cpp
+@@ -621,6 +621,7 @@
+
+ extern "C"
+ {
++#include <string.h>
+ #include <png.h>
+
+
+@@ -636,9 +637,12 @@
+
+ static void png_ReadData( png_structp pngPtr, png_bytep data, png_size_t length )
+ {
+- memcpy( data, ( byte* )pngPtr->io_ptr, length );
+-
+- pngPtr->io_ptr = ( ( byte* ) pngPtr->io_ptr ) + length;
++
++ // There is a get_io_ptr but not a set_io_ptr.. Therefore we need some tmp storage here.
++ byte **ioptr = (byte **)png_get_io_ptr(pngPtr);
++
++ memcpy( data, *ioptr, length );
++ *ioptr += length;
+ }
+
+ }
+@@ -651,6 +655,7 @@
+ static void LoadPNG( const char* filename, unsigned char** pic, int* width, int* height, ID_TIME_T* timestamp )
+ {
+ byte* fbuffer;
++ byte* readptr;
+
+ if( !pic )
+ {
+@@ -683,7 +688,8 @@
+ common->Error( "LoadPNG( %s ): png_create_info_struct failed", filename );
+ }
+
+- png_set_read_fn( pngPtr, fbuffer, png_ReadData );
++ readptr = fbuffer;
++ png_set_read_fn( pngPtr, &readptr, png_ReadData );
+
+ png_set_sig_bytes( pngPtr, 0 );
+
+@@ -770,10 +776,11 @@
+ static int png_compressedSize = 0;
+ static void png_WriteData( png_structp pngPtr, png_bytep data, png_size_t length )
+ {
+- memcpy( ( byte* )pngPtr->io_ptr, data, length );
+-
+- pngPtr->io_ptr = ( ( byte* ) pngPtr->io_ptr ) + length;
++ byte **ioptr = (byte**)png_get_io_ptr(pngPtr);
++
++ memcpy( *ioptr, data, length );
+
++ *ioptr += length;
+ png_compressedSize += length;
+ }
+
+@@ -802,7 +809,8 @@
+
+ png_compressedSize = 0;
+ byte* buffer = ( byte* ) Mem_Alloc( width * height * bytesPerPixel, TAG_TEMP );
+- png_set_write_fn( pngPtr, buffer, png_WriteData, png_FlushData );
++ byte* ioptr = buffer;
++ png_set_write_fn( pngPtr, &ioptr, png_WriteData, png_FlushData );
+
+ if( bytesPerPixel == 4 )
+ {