diff options
Diffstat (limited to 'news/knews')
-rw-r--r-- | news/knews/files/patch-sum | 3 | ||||
-rw-r--r-- | news/knews/patches/patch-bd | 139 |
2 files changed, 141 insertions, 1 deletions
diff --git a/news/knews/files/patch-sum b/news/knews/files/patch-sum index 1ac6e0be7f5..8fbf7061dd1 100644 --- a/news/knews/files/patch-sum +++ b/news/knews/files/patch-sum @@ -1,4 +1,4 @@ -$NetBSD: patch-sum,v 1.9 2001/03/12 13:23:00 tron Exp $ +$NetBSD: patch-sum,v 1.10 2001/03/26 21:48:59 fredb Exp $ SHA1 (patch-aa) = b125c5b5078e809dd0483a17d83fd0f055604639 SHA1 (patch-ab) = c91ef1a71a9bd63a64d87e59a0a441386dc3d3c0 @@ -29,3 +29,4 @@ SHA1 (patch-az) = 1d91236b5f1dd59e54e9d8b02f31090abe70b67b SHA1 (patch-ba) = a46041cc02ec99379d1c7a69534ca4574a1d8b77 SHA1 (patch-bb) = 05963335420741b8ce5658ad43cbfa83379fe289 SHA1 (patch-bc) = 74b0c0ee543f3753886dc75ea7d32a61256eb5b5 +SHA1 (patch-bd) = 6ed34d15ce86336e280f39fc0903d0bd84e93e4c diff --git a/news/knews/patches/patch-bd b/news/knews/patches/patch-bd new file mode 100644 index 00000000000..90661dc04d6 --- /dev/null +++ b/news/knews/patches/patch-bd @@ -0,0 +1,139 @@ +$NetBSD: patch-bd,v 1.1 2001/03/26 21:49:00 fredb Exp $ + +--- src/png.c.orig Sat Nov 21 08:55:13 1998 ++++ src/png.c +@@ -78,8 +78,8 @@ + + Pixmap do_png(char *data, long len, long *wp, long *hp) + { +- png_struct p_str; +- png_info p_info; ++ png_struct *p_str = NULL; ++ png_info *p_info = NULL; + Pixmap pixmap; + FILE *volatile vol_fp = NULL; + void *volatile vol_pic = NULL; +@@ -98,7 +98,11 @@ + return None; + } + +- if (setjmp(p_str.jmpbuf)) ++ if ((p_str = (png_struct *) png_create_read_struct(PNG_LIBPNG_VER_STRING, ++ NULL, NULL, NULL))); ++ p_info = (png_info *) png_create_info_struct(p_str); ++ ++ if (p_str && p_info && setjmp(png_jmpbuf(p_str))) + ArtTextAddLine(main_widgets.text, "[knews: png error.]", + ascii_font->body_font, global.alert_pixel); + else { +@@ -108,58 +112,55 @@ + unsigned int per_line = 0; + unsigned int i, j, pass; + +- png_read_init(&p_str); +- png_info_init(&p_info); +- +- png_init_io(&p_str, vol_fp); +- png_read_info(&p_str, &p_info); ++ png_init_io(p_str, vol_fp); ++ png_read_info(p_str, p_info); + +- vol_w = w = p_info.width; +- vol_h = h = p_info.height; ++ vol_w = w = p_info->width; ++ vol_h = h = p_info->height; + +- if (p_info.bit_depth == 16) +- png_set_strip_16(&p_str); +- else if (p_info.bit_depth < 8) +- png_set_packing(&p_str); ++ if (p_info->bit_depth == 16) ++ png_set_strip_16(p_str); ++ else if (p_info->bit_depth < 8) ++ png_set_packing(p_str); + +- if (p_info.valid & PNG_INFO_bKGD) +- png_set_background(&p_str, &p_info.background, ++ if (p_info->valid & PNG_INFO_bKGD) ++ png_set_background(p_str, &p_info->background, + PNG_BACKGROUND_GAMMA_FILE, True, 1.0); + else { + static png_color_16 bg = {0, }; +- png_set_background(&p_str, &bg, ++ png_set_background(p_str, &bg, + PNG_BACKGROUND_GAMMA_SCREEN, False, 1.0); + } + + per_line = w; + +- if (!(p_info.color_type & PNG_COLOR_MASK_COLOR)) { /* grey image */ ++ if (!(p_info->color_type & PNG_COLOR_MASK_COLOR)) { /* grey image */ + grey = True; +- png_set_expand(&p_str); ++ png_set_expand(p_str); + } else if (!p_cmap) { /* true color visual */ +- if (p_info.color_type == PNG_COLOR_TYPE_PALETTE) +- png_set_expand(&p_str); ++ if (p_info->color_type == PNG_COLOR_TYPE_PALETTE) ++ png_set_expand(p_str); + per_line *= 3; +- } else if (p_info.color_type & PNG_COLOR_MASK_PALETTE) { ++ } else if (p_info->color_type & PNG_COLOR_MASK_PALETTE) { + CMAP_ENTRY *pal; + int i, pn; + +- pn = p_info.num_palette; ++ pn = p_info->num_palette; + pal = (CMAP_ENTRY *)XtMalloc(pn * sizeof *pal); + for (i = 0 ; i < pn ; i++) { +- pal[i].r = p_info.palette[i].red; +- pal[i].g = p_info.palette[i].green; +- pal[i].b = p_info.palette[i].blue; ++ pal[i].r = p_info->palette[i].red; ++ pal[i].g = p_info->palette[i].green; ++ pal[i].b = p_info->palette[i].blue; + } + vol_pal = pal; + vol_pn = pn; + } else { +- png_set_dither(&p_str, p_cmap, cmap_size, ++ png_set_dither(p_str, p_cmap, cmap_size, + cmap_size, NULL, True); + } + +- pass = png_set_interlace_handling(&p_str); +- png_start_read_image(&p_str); ++ pass = png_set_interlace_handling(p_str); ++ png_start_read_image(p_str); + + vol_pic = pic = (unsigned char *)XtMalloc(h * per_line); + +@@ -167,14 +168,14 @@ + for (i = 0 ; i < pass ; i++) { + row = pic; + for (j = 0 ; j < h ; j++) { +- png_read_row(&p_str, NULL, row); ++ png_read_row(p_str, NULL, row); + if (!did) + vol_did = did = True; + row += per_line; + } + } + +- png_read_end(&p_str, NULL); ++ png_read_end(p_str, NULL); + } + + if (!vol_did) +@@ -204,7 +205,10 @@ + } + } + +- png_read_destroy(&p_str, &p_info, NULL); ++ if (p_info) ++ png_destroy_read_struct(&p_str, &p_info, NULL); ++ else ++ png_destroy_read_struct(&p_str, NULL, NULL); + fclose((FILE *)vol_fp); + XtFree((char *)vol_pic); + XtFree((char *)vol_pal); |