[nethack-vultures] Forgot to add the libpng patch
Bruno Wolff III
bruno at fedoraproject.org
Sun Jan 29 06:46:33 UTC 2012
commit 75aeb31bb19203ef0dc43411e8c7f9d203e9ceb0
Author: Bruno Wolff III <bruno at wolff.to>
Date: Sun Jan 29 00:46:28 2012 -0600
Forgot to add the libpng patch
nethack-vultures-libpng.patch | 69 +++++++++++++++++++++++++++++++++++++++++
nethack-vultures.spec | 3 --
2 files changed, 69 insertions(+), 3 deletions(-)
---
diff --git a/nethack-vultures-libpng.patch b/nethack-vultures-libpng.patch
new file mode 100644
index 0000000..a2d387d
--- /dev/null
+++ b/nethack-vultures-libpng.patch
@@ -0,0 +1,69 @@
+--- vultures/vultures_gfl.c.libpng 2008-07-16 08:59:01.000000000 -0500
++++ vultures/vultures_gfl.c 2012-01-29 00:08:20.845880660 -0600
+@@ -22,12 +22,17 @@
+
+ #define PNG_BYTES_TO_CHECK 4
+
++struct readbuff {char *buff; unsigned int len;};
+
+ static void vultures_png_read_callback(png_structp png_ptr, png_bytep area, png_size_t size)
+ {
+- void *mem = png_ptr->io_ptr;
+- memcpy(area, mem, size);
+- png_ptr->io_ptr = (mem + size);
++ unsigned int readlen;
++ struct readbuff *readfrom = (struct readbuff *)png_get_io_ptr(png_ptr);
++ readlen = (readfrom->len > size) ? size : readfrom->len;
++ memcpy(area, readfrom->buff, readlen);
++ size = readlen;
++ readfrom->len -= readlen;
++ readfrom->buff += readlen;
+ }
+
+ /*--------------------------------------------------------------------------
+@@ -45,6 +50,7 @@
+ int bit_depth, color_type, row;
+ png_bytep * row_pointers = NULL;
+ SDL_Surface *img, *convert;
++ struct readbuff readfrom;
+
+ /* vultures_load_surface converts everything to screen format for faster blitting
+ * so we can't continue if we don't have a screen yet */
+@@ -55,6 +61,9 @@
+ if (!srcbuf)
+ return NULL;
+
++ if (buflen < PNG_BYTES_TO_CHECK)
++ return NULL;
++
+ img = NULL;
+
+ /* memory region must contain a png file */
+@@ -72,10 +81,13 @@
+ goto out;
+
+ /* Set up error handling */
+- if (setjmp(png_ptr->jmpbuf))
++ if (setjmp(png_jmpbuf(png_ptr)))
+ goto out;
+
+- png_set_read_fn(png_ptr, (char *)srcbuf, vultures_png_read_callback);
++ readfrom.buff = (char *)srcbuf;
++ readfrom.len = buflen;
++
++ png_set_read_fn(png_ptr, &readfrom, vultures_png_read_callback);
+
+ /* Read PNG header info */
+ png_read_info(png_ptr, info_ptr);
+@@ -93,8 +105,9 @@
+ png_set_gray_to_rgb(png_ptr);
+
+ /* add an opaque alpha channel to anything that doesn't have one yet */
+- png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
+- info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
++ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB ||
++ png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY)
++ png_set_add_alpha(png_ptr, 0xff, PNG_FILLER_AFTER);
+
+ /* get the component mask for the surface */
+ if ( SDL_BYTEORDER == SDL_LIL_ENDIAN )
diff --git a/nethack-vultures.spec b/nethack-vultures.spec
index 70a564a..ebb33b3 100644
--- a/nethack-vultures.spec
+++ b/nethack-vultures.spec
@@ -208,9 +208,6 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
- Update for libpng 1.5
- Abide by font guidelines (bz 477431)
-* Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.1.2-5
-- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
-
* Tue Dec 06 2011 Adam Jackson <ajax at redhat.com> - 2.1.2-4
- Rebuild for new libpng
More information about the scm-commits
mailing list