commit b77cf11db90620e5359dae600a90faf0f7beba60
Author: leigh123linux <leigh123linux(a)googlemail.com>
Date: Mon Aug 15 16:37:11 2016 +0100
Patch for libpng changes
Mosaic-2.7b5-compile.patch | 256 ++++++++++++++++++++++++++++++++++++++++++---
Mosaic.spec | 24 ++---
2 files changed, 254 insertions(+), 26 deletions(-)
---
diff --git a/Mosaic-2.7b5-compile.patch b/Mosaic-2.7b5-compile.patch
index 01ae3c1..5cd14ea 100644
--- a/Mosaic-2.7b5-compile.patch
+++ b/Mosaic-2.7b5-compile.patch
@@ -479,7 +479,9 @@ diff -up Mosaic-src/src/Makefile.in.compile
Mosaic-src/src/Makefile.in
diff -up Mosaic-src/src/readPNG.c.compile Mosaic-src/src/readPNG.c
--- Mosaic-src/src/readPNG.c.compile 1996-06-30 14:30:00.000000000 +0200
+++ Mosaic-src/src/readPNG.c 2009-03-29 16:31:24.055883413 +0200
-@@ -126,13 +126,13 @@ ReadPNG(FILE *infile,int *width, int *he
+--- a/src/readPNG.c
++++ b/src/readPNG.c
+@@ -126,18 +128,18 @@
rewind(infile);
/* allocate the structures */
@@ -488,19 +490,26 @@ diff -up Mosaic-src/src/readPNG.c.compile Mosaic-src/src/readPNG.c
if(!png_ptr)
return 0;
- info_ptr = (png_info *)malloc(sizeof(png_info));
+- info_ptr = (png_info *)malloc(sizeof(png_info));
++ info_ptr = png_create_info_struct(png_ptr);
if(!info_ptr) {
- free(png_ptr);
+ png_destroy_read_struct(&png_ptr, NULL, NULL);
return 0;
}
-@@ -145,25 +145,20 @@ ReadPNG(FILE *infile,int *width, int *he
+ /* Establish the setjmp return context for png_error to use. */
+- if (setjmp(png_ptr->jmpbuf)) {
++ if (setjmp(png_jmpbuf(png_ptr))) {
+
+ #ifndef DISABLE_TRACE
+ if (srcTrace) {
+@@ -145,25 +147,16 @@
}
#endif
- png_read_destroy(png_ptr, info_ptr, (png_info *)0);
-+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
++ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
if(png_pixels != NULL)
free((char *)png_pixels);
@@ -509,23 +518,241 @@ diff -up Mosaic-src/src/readPNG.c.compile Mosaic-src/src/readPNG.c
-
- free((char *)png_ptr);
- free((char *)info_ptr);
-+
-+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
++ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return 0;
}
-
+-
- /* SWP -- Hopefully to fix cores on bad PNG files */
- png_set_message_fn(png_ptr,png_get_msg_ptr(png_ptr),NULL,NULL);
-
- /* initialize the structures */
-+ /* initialize the structure */
- png_info_init(info_ptr);
+- png_info_init(info_ptr);
- png_read_init(png_ptr);
/* set up the input control */
png_init_io(png_ptr, infile);
-@@ -409,12 +404,7 @@ ReadPNG(FILE *infile,int *width, int *he
+@@ -173,20 +166,21 @@
+
+ /* setup other stuff using the fields of png_info. */
+
+- *width = (int)png_ptr->width;
+- *height = (int)png_ptr->height;
++ *width = (int)png_get_image_width(png_ptr, info_ptr);
++ *height = (int)png_get_image_height(png_ptr, info_ptr);
+
+ #ifndef DISABLE_TRACE
+ if (srcTrace) {
+- fprintf(stderr,"\n\nBEFORE\nheight = %d\n", (int)png_ptr->width);
+- fprintf(stderr,"width = %d\n", (int)png_ptr->height);
+- fprintf(stderr,"bit depth = %d\n", info_ptr->bit_depth);
+- fprintf(stderr,"color type = %d\n", info_ptr->color_type);
+- fprintf(stderr,"compression type = %d\n",
info_ptr->compression_type);
+- fprintf(stderr,"filter type = %d\n", info_ptr->filter_type);
+- fprintf(stderr,"interlace type = %d\n", info_ptr->interlace_type);
+- fprintf(stderr,"num colors = %d\n",info_ptr->num_palette);
+- fprintf(stderr,"rowbytes = %d\n", info_ptr->rowbytes);
++
++ fprintf(stderr,"\n\nBEFORE\nheight = %d\n",
(int)png_get_image_width(png_ptr, info_ptr));
++ fprintf(stderr,"width = %d\n", (int)png_get_image_height(png_ptr,
info_ptr));
++ fprintf(stderr,"bit depth = %d\n", png_get_bit_depth(png_ptr,
info_ptr));
++ fprintf(stderr,"color type = %d\n", png_get_color_type(png_ptr,
info_ptr));
++ fprintf(stderr,"compression type = %d\n",
png_get_compression_type(png_ptr, info_ptr));
++ fprintf(stderr,"filter type = %d\n", png_get_filter_type(png_ptr,
info_ptr));
++ fprintf(stderr,"interlace type = %d\n",
png_get_interlace_type(png_ptr, info_ptr));
++ fprintf(stderr,"num colors = %d\n", png_get_palette_max(png_ptr,
info_ptr));
++ fprintf(stderr,"rowbytes = %d\n", png_get_rowbytes(png_ptr,
info_ptr));
+ }
+ #endif
+
+@@ -199,7 +193,7 @@
+ {
+ png_color_16 my_background;
+
+- if (info_ptr->valid & PNG_INFO_bKGD)
++ if (png_get_valid(png_ptr, info_ptr) & PNG_INFO_bKGD)
+ png_set_background(png_ptr, &(info_ptr->background),
+ PNG_GAMMA_FILE, 1, 1.0);
+ else
+@@ -209,16 +203,16 @@
+ #endif
+
+ /* strip pixels in 16-bit images 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 it is a color image then check if it has a palette. If not
+ then dither the image to 256 colors, and make up a palette */
+- if (info_ptr->color_type==PNG_COLOR_TYPE_RGB ||
+- info_ptr->color_type==PNG_COLOR_TYPE_RGB_ALPHA) {
+-
+- if(! (info_ptr->valid & PNG_INFO_PLTE)) {
++ if (png_get_color_type(png_ptr, info_ptr)==PNG_COLOR_TYPE_RGB ||
++ png_get_color_type(png_ptr, info_ptr)==PNG_COLOR_TYPE_RGB_ALPHA) {
++
++ if(! (png_get_valid(png_ptr, info_ptr, PNG_INFO_PLTE)) ) {
+
+ #ifndef DISABLE_TRACE
+ if (srcTrace) {
+@@ -236,9 +230,9 @@
+
+ /* this should probably be dithering to
+ Rdata.colors_per_inlined_image colors */
+- png_set_dither(png_ptr, std_color_cube,
+- 216,
+- 216, NULL, 1);
++ png_set_quantize(png_ptr, std_color_cube,
++ 216,
++ 216, NULL, 1);
+
+ } else {
+ #ifndef DISABLE_TRACE
+@@ -247,10 +241,17 @@
+ }
+ #endif
+
+- png_set_dither(png_ptr, info_ptr->palette,
+- info_ptr->num_palette,
+- get_pref_int(eCOLORS_PER_INLINED_IMAGE),
+- info_ptr->hist, 1);
++ png_colorp palette;
++ int num_palette;
++ png_get_PLTE(png_ptr, info_ptr, palette, &num_palette);
++
++ png_uint_16p hist;
++ png_get_hIST(png_ptr, info_ptr, &hist);
++
++ png_set_quantize(png_ptr, palette,
++ num_palette,
++ get_pref_int(eCOLORS_PER_INLINED_IMAGE),
++ hist, 1);
+
+ }
+ }
+@@ -259,14 +260,14 @@
+ small as they can. This expands pixels to 1 pixel per byte, and
+ if a transparency value is supplied, an alpha channel is
+ built.*/
+- if (info_ptr->bit_depth < 8)
++ if (png_get_bit_depth(png_ptr, info_ptr) < 8)
+ png_set_packing(png_ptr);
+
+
+ /* have libpng handle the gamma conversion */
+
+ if (get_pref_boolean(eUSE_SCREEN_GAMMA)) { /*SWP*/
+- if (info_ptr->bit_depth != 16) { /* temporary .. glennrp */
++ if (png_get_bit_depth(png_ptr, info_ptr) != 16) { /* temporary .. glennrp */
+ screen_gamma=(double)(get_pref_float(eSCREEN_GAMMA));
+
+ #ifndef DISABLE_TRACE
+@@ -274,13 +275,15 @@
+ fprintf(stderr,"screen gamma=%f\n",screen_gamma);
+ }
+ #endif
+- if (info_ptr->valid & PNG_INFO_gAMA) {
++ if (png_get_valid(png_ptr, info_ptr, PNG_INFO_gAMA)) {
++ double gamma;
++ png_get_gAMA(png_ptr, info_ptr, &gamma);
+ #ifndef DISABLE_TRACE
+ if (srcTrace) {
+- printf("setting gamma=%f\n",info_ptr->gamma);
++ printf("setting gamma=%f\n",gamma);
+ }
+ #endif
+- png_set_gamma(png_ptr, screen_gamma, (double)info_ptr->gamma);
++ png_set_gamma(png_ptr, screen_gamma, gamma);
+ }
+ else {
+ #ifndef DISABLE_TRACE
+@@ -293,34 +296,34 @@
+ }
+ }
+
+- if (info_ptr->interlace_type)
++ if (png_get_interlace_type(png_ptr, info_ptr))
+ png_set_interlace_handling(png_ptr);
+
+ png_read_update_info(png_ptr, info_ptr);
+
+ #ifndef DISABLE_TRACE
+ if (srcTrace) {
+- fprintf(stderr,"\n\nAFTER\nheight = %d\n", (int)png_ptr->width);
+- fprintf(stderr,"width = %d\n", (int)png_ptr->height);
+- fprintf(stderr,"bit depth = %d\n", info_ptr->bit_depth);
+- fprintf(stderr,"color type = %d\n", info_ptr->color_type);
+- fprintf(stderr,"compression type = %d\n",
info_ptr->compression_type);
+- fprintf(stderr,"filter type = %d\n", info_ptr->filter_type);
+- fprintf(stderr,"interlace type = %d\n", info_ptr->interlace_type);
+- fprintf(stderr,"num colors = %d\n",info_ptr->num_palette);
+- fprintf(stderr,"rowbytes = %d\n", info_ptr->rowbytes);
++ fprintf(stderr,"\n\nAFTER\nheight = %d\n",
(int)png_get_image_width(png_ptr, info_ptr));
++ fprintf(stderr,"width = %d\n", (int)png_get_image_height(png_ptr,
info_ptr));
++ fprintf(stderr,"bit depth = %d\n", png_get_bit_depth(png_ptr,
info_ptr));
++ fprintf(stderr,"color type = %d\n", png_get_color_type(png_ptr,
info_ptr));
++ fprintf(stderr,"compression type = %d\n",
png_get_compression_type(png_ptr, info_ptr));
++ fprintf(stderr,"filter type = %d\n", png_get_filter_type(png_ptr,
info_ptr));
++ fprintf(stderr,"interlace type = %d\n",
png_get_interlace_type(png_ptr, info_ptr));
++ fprintf(stderr,"num colors = %d\n", png_get_palette_max(png_ptr,
info_ptr));
++ fprintf(stderr,"rowbytes = %d\n", png_get_rowbytes(png_ptr,
info_ptr));
+ }
+ #endif
+
+ /* allocate the pixel grid which we will need to send to
+ png_read_image(). */
+- png_pixels = (png_byte *)malloc(info_ptr->rowbytes *
++ png_pixels = (png_byte *)malloc(png_get_rowbytes(png_ptr, info_ptr) *
+ (*height) * sizeof(png_byte));
+
+
+ row_pointers = (png_byte **) malloc((*height) * sizeof(png_byte *));
+ for (i=0; i < *height; i++)
+- row_pointers[i]=png_pixels+(info_ptr->rowbytes*i);
++ row_pointers[i]=png_pixels+(png_get_rowbytes(png_ptr, info_ptr)*i);
+
+
+ /* FINALLY - read the darn thing. */
+@@ -329,17 +332,20 @@
+
+ /* now that we have the (transformed to 8-bit RGB) image, we have
+ to copy the resulting palette to our colormap. */
+- if (info_ptr->color_type & PNG_COLOR_MASK_COLOR) {
+- if (info_ptr->valid & PNG_INFO_PLTE) {
+-
+- for (i=0; i < info_ptr->num_palette; i++) {
+- colrs[i].red = info_ptr->palette[i].red << 8;
+- colrs[i].green = info_ptr->palette[i].green << 8;
+- colrs[i].blue = info_ptr->palette[i].blue << 8;
++ if (png_get_color_type(png_ptr, info_ptr) & PNG_COLOR_MASK_COLOR) {
++ if (png_get_valid(png_ptr, info_ptr, PNG_INFO_PLTE)) {
++ png_colorp palette;
++ int num_palette = png_get_palette_max(png_ptr, info_ptr);
++
++ for (i=0; i < num_palette; i++) {
++ png_get_PLTE(png_ptr, info_ptr, &palette, i);
++
++ colrs[i].red = palette->red << 8;
++ colrs[i].green = palette->green << 8;
++ colrs[i].blue = palette->blue << 8;
+ colrs[i].pixel = i;
+ colrs[i].flags = DoRed|DoGreen|DoBlue;
+ }
+-
+ }
+ else {
+ for (i=0; i < 216; i++) {
+@@ -370,7 +376,7 @@
+
+ /* if there is an alpha channel, we have to get rid of it in the
+ pixmap, since I don't do anything with it yet */
+- if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA) {
++ if (png_get_color_type(png_ptr, info_ptr) & PNG_COLOR_MASK_ALPHA) {
+
+ #ifndef DISABLE_TRACE
+ if (srcTrace) {
+@@ -409,13 +415,10 @@
free((png_byte **)row_pointers);
/* clean up after the read, and free any memory allocated */
@@ -535,7 +762,12 @@ diff -up Mosaic-src/src/readPNG.c.compile Mosaic-src/src/readPNG.c
- /* free the structures */
- free((char *)png_ptr);
- free((char *)info_ptr);
-+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-
+-
++
++ /* free the structure */
++ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
++
return pixmap;
}
+
+
diff --git a/Mosaic.spec b/Mosaic.spec
index 5e89bb1..fe4b48f 100644
--- a/Mosaic.spec
+++ b/Mosaic.spec
@@ -1,6 +1,6 @@
Name: Mosaic
Version: 2.7
-Release: 0.4.b5%{?dist}
+Release: 0.5.b5%{?dist}
Summary: Web Browser
Group: Applications/Internet
@@ -15,13 +15,9 @@ Patch2: Mosaic-2.7b5-crash.patch
Patch3: Mosaic-2.7b5-script.patch
Patch4: Mosaic-2.7b5-hash_url.patch
Patch5: Mosaic-2.7b5-redirect.patch
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Patch6: Mosaic-2.7b5-gcc-compile.patch
-%if 0%{?rhel}
BuildRequires: openmotif-devel
-%else
-BuildRequires: lesstif-devel
-%endif
BuildRequires: libjpeg-devel libpng-devel
BuildRequires: autoconf ImageMagick desktop-file-utils
BuildRequires: libXmu-devel
@@ -40,7 +36,7 @@ displaying images inline with text.
%patch3 -p1 -b .script
%patch4 -p1 -b .hash_url
%patch5 -p1 -b .redirect
-
+%patch6 -p1 -b .gcc
%build
autoconf
@@ -73,20 +69,20 @@ desktop-file-install %{SOURCE1} \
--dir=$RPM_BUILD_ROOT%{_datadir}/applications
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-
%files
-%defattr(-,root,root,-)
+%doc README.resources.html
+%doc CHANGES FEATURES INSTALL README
+%license COPYRIGHT
%{_bindir}/Mosaic
%{_datadir}/pixmaps/Mosaic.png
%{_datadir}/applications/Mosaic.desktop
-%doc CHANGES COPYRIGHT FEATURES INSTALL README
-%doc README.resources.html
%changelog
+* Mon Aug 15 2016 Leigh Scott <leigh123linux(a)googlemail.com> - 2.7-0.5.b5
+- Patch for libpng changes
+- Patch for gcc changes
+
* Thu Feb 09 2012 Nicolas Chauvet <kwizart(a)gmail.com> - 2.7-0.4.b5
- Rebuilt for
https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild