[97398] trunk/dports/editors/xemacs

dports at macports.org dports at macports.org
Tue Sep 4 15:22:19 PDT 2012


Revision: 97398
          https://trac.macports.org/changeset/97398
Author:   dports at macports.org
Date:     2012-09-04 15:22:19 -0700 (Tue, 04 Sep 2012)
Log Message:
-----------
xemacs: add upstream patches to support libpng 1.5

Modified Paths:
--------------
    trunk/dports/editors/xemacs/Portfile

Added Paths:
-----------
    trunk/dports/editors/xemacs/files/
    trunk/dports/editors/xemacs/files/51ced9b8fb63e4be59ea611b58128c400e3df987.diff
    trunk/dports/editors/xemacs/files/bcefd94fa6513d48f4dc8519f633b2df66b553bc.diff

Modified: trunk/dports/editors/xemacs/Portfile
===================================================================
--- trunk/dports/editors/xemacs/Portfile	2012-09-04 22:20:33 UTC (rev 97397)
+++ trunk/dports/editors/xemacs/Portfile	2012-09-04 22:22:19 UTC (rev 97398)
@@ -46,6 +46,10 @@
                     sha1    dc50bc3b62e5ff1cd766c7e4f31880bd200caad5 \
                     rmd160  506b7465687ff9dafe26f46e049b6aad8915eb49
 
+patchfiles      51ced9b8fb63e4be59ea611b58128c400e3df987.diff \
+                bcefd94fa6513d48f4dc8519f633b2df66b553bc.diff
+patch.pre_args  -p1
+
 configure.args  --mandir=${prefix}/share/man \
                 --without-postgresql \
                 --without-ldap \

Added: trunk/dports/editors/xemacs/files/51ced9b8fb63e4be59ea611b58128c400e3df987.diff
===================================================================
--- trunk/dports/editors/xemacs/files/51ced9b8fb63e4be59ea611b58128c400e3df987.diff	                        (rev 0)
+++ trunk/dports/editors/xemacs/files/51ced9b8fb63e4be59ea611b58128c400e3df987.diff	2012-09-04 22:22:19 UTC (rev 97398)
@@ -0,0 +1,60 @@
+# HG changeset patch
+# User Vin Shelton <acs at xemacs.org>
+# Date 1323317837 18000
+# Node ID 51ced9b8fb63e4be59ea611b58128c400e3df987
+# Parent  032a91928d47b36ae3dd98885767d9e0202892f7
+Clean up PNG handling.  Fix crash in issue570.
+
+diff -r 032a91928d47b36ae3dd98885767d9e0202892f7 -r 51ced9b8fb63e4be59ea611b58128c400e3df987 src/glyphs-eimage.c
+--- a/src/glyphs-eimage.c	Sat Dec 03 20:04:12 2011 -0500
++++ b/src/glyphs-eimage.c	Wed Dec 07 23:17:17 2011 -0500
+@@ -935,13 +935,22 @@
+   png_read_info (png_ptr, info_ptr);
+ 
+   {
+-    int y;
++    int y, padding;
+     unsigned char **row_pointers;
+     height = info_ptr->height;
+     width = info_ptr->width;
+ 
+-    /* Wow, allocate all the memory.  Truly, exciting. */
+-    unwind.eimage = xnew_array_and_zero (unsigned char, width * height * 3);
++    /* Wow, allocate all the memory.  Truly, exciting.
++       Well, yes, there's excitement to be had.  It turns out that libpng
++       strips in place, so the last row overruns the buffer if depth is 16
++       or there's an alpha channel.  This is a crash on Linux.  So we need
++       to add padding.
++       The worst case is reducing 8 bytes (16-bit RGBA) to 3 (8-bit RGB). */
++
++    padding = 5 * width;
++    unwind.eimage = xnew_array_and_zero (unsigned char,
++					 width * height * 3 + padding);
++
+     /* libpng expects that the image buffer passed in contains a
+        picture to draw on top of if the png has any transparencies.
+        This could be a good place to pass that in... */
+@@ -996,9 +1005,6 @@
+     if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY ||
+         info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+       png_set_gray_to_rgb (png_ptr);
+-    /* we can't handle alpha values */
+-    if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
+-      png_set_strip_alpha (png_ptr);
+     /* tell libpng to strip 16 bit depth files down to 8 bits */
+     if (info_ptr->bit_depth == 16)
+       png_set_strip_16 (png_ptr);
+@@ -1011,6 +1017,13 @@
+ 	  png_set_packing (png_ptr);
+       }
+ 
++    /* we can't handle alpha values
++       png_read_update_info ensures the alpha flag is set when one of
++       the transforms above causes an alpha channel to be generated */
++    png_read_update_info (png_ptr, info_ptr);
++    if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
++      png_set_strip_alpha (png_ptr);
++
+     png_read_image (png_ptr, row_pointers);
+     png_read_end (png_ptr, info_ptr);
+ 

Added: trunk/dports/editors/xemacs/files/bcefd94fa6513d48f4dc8519f633b2df66b553bc.diff
===================================================================
--- trunk/dports/editors/xemacs/files/bcefd94fa6513d48f4dc8519f633b2df66b553bc.diff	                        (rev 0)
+++ trunk/dports/editors/xemacs/files/bcefd94fa6513d48f4dc8519f633b2df66b553bc.diff	2012-09-04 22:22:19 UTC (rev 97398)
@@ -0,0 +1,87 @@
+# HG changeset patch
+# User Vin Shelton <acs at xemacs.org>
+# Date 1342078132 14400
+# Node ID bcefd94fa6513d48f4dc8519f633b2df66b553bc
+# Parent  2cf343fcb482fa6644675f3174c3c0712c53c074
+Support libpng-1.5.10
+
+diff -r 2cf343fcb482fa6644675f3174c3c0712c53c074 -r bcefd94fa6513d48f4dc8519f633b2df66b553bc src/glyphs-eimage.c
+--- a/src/glyphs-eimage.c	Sun Jan 08 17:05:56 2012 -0500
++++ b/src/glyphs-eimage.c	Thu Jul 12 03:28:52 2012 -0400
+@@ -937,8 +937,8 @@
+   {
+     int y, padding;
+     unsigned char **row_pointers;
+-    height = info_ptr->height;
+-    width = info_ptr->width;
++    height = png_get_image_height(png_ptr, info_ptr);
++    width = png_get_image_width(png_ptr, info_ptr);
+ 
+     /* Wow, allocate all the memory.  Truly, exciting.
+        Well, yes, there's excitement to be had.  It turns out that libpng
+@@ -999,19 +999,19 @@
+     /* Now that we're using EImage, ask for 8bit RGB triples for any type
+        of image*/
+     /* convert palette images to full RGB */
+-    if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
++    if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE)
+       png_set_expand (png_ptr);
+     /* send grayscale images to RGB too */
+-    if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY ||
+-        info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
++    if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY ||
++       png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY_ALPHA)
+       png_set_gray_to_rgb (png_ptr);
+     /* tell libpng to strip 16 bit depth files down to 8 bits */
+-    if (info_ptr->bit_depth == 16)
++    if (png_get_bit_depth(png_ptr, info_ptr) == 16)
+       png_set_strip_16 (png_ptr);
+     /* if the image is < 8 bits, pad it out */
+-    if (info_ptr->bit_depth < 8)
++    if (png_get_bit_depth(png_ptr, info_ptr) < 8)
+       {
+-	if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY)
++       if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY)
+ 	  png_set_expand (png_ptr);
+ 	else
+ 	  png_set_packing (png_ptr);
+@@ -1021,7 +1021,7 @@
+        png_read_update_info ensures the alpha flag is set when one of
+        the transforms above causes an alpha channel to be generated */
+     png_read_update_info (png_ptr, info_ptr);
+-    if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
++    if (png_get_color_type(png_ptr, info_ptr) & PNG_COLOR_MASK_ALPHA)
+       png_set_strip_alpha (png_ptr);
+ 
+     png_read_image (png_ptr, row_pointers);
+@@ -1036,17 +1036,22 @@
+      * from lisp anyway. - WMP
+      */
+     {
+-      int i;
++      int i, num_text = 0;
++      png_textp text_ptr = NULL;
+ 
+-      for (i = 0 ; i < info_ptr->num_text ; i++)
++      if (png_get_text (png_ptr, info_ptr, &text_ptr, &num_text) > 0)
+ 	{
+-	  /* How paranoid do I have to be about no trailing NULLs, and
+-	     using (int)info_ptr->text[i].text_length, and strncpy and a temp
+-	     string somewhere? */
++	  for (i = 0 ; i < num_text ; i++)
++	    {
+ 
+-	  warn_when_safe (Qpng, Qinfo, "%s - %s",
+-			  info_ptr->text[i].key,
+-			  info_ptr->text[i].text);
++	      /* How paranoid do I have to be about no trailing NULLs, and
++		 using (int)info_ptr->text[i].text_length, and strncpy and a temp
++		 string somewhere? */
++
++	      warn_when_safe (Qpng, Qinfo, "%s - %s",
++			      text_ptr[i].key, text_ptr[i].text);
++	    }
++
+ 	}
+     }
+ #endif
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120904/26f5eeac/attachment.html>


More information about the macports-changes mailing list