From 9a37f8cc633e9652ee6814d816756529331f5f28 Mon Sep 17 00:00:00 2001 From: Jindrich Novy Date: Jan 21 2009 07:25:24 +0000 Subject: - fix pnmtofiasco to accept image from stdin (#476989, #227283) --- diff --git a/netpbm-10.35-pnmtofiasco-stdin.patch b/netpbm-10.35-pnmtofiasco-stdin.patch new file mode 100644 index 0000000..4fbb32e --- /dev/null +++ b/netpbm-10.35-pnmtofiasco-stdin.patch @@ -0,0 +1,105 @@ +diff -up netpbm-10.35.58/converter/other/fiasco/codec/coder.c.pnmtofiasco-stdin netpbm-10.35.58/converter/other/fiasco/codec/coder.c +--- netpbm-10.35.58/converter/other/fiasco/codec/coder.c.pnmtofiasco-stdin 2009-01-19 09:23:57.000000000 +0100 ++++ netpbm-10.35.58/converter/other/fiasco/codec/coder.c 2009-01-21 08:03:00.000000000 +0100 +@@ -213,15 +213,14 @@ alloc_coder (char const * const *inputna + */ + { + char *filename; +- int width, w = 0, height, h = 0; ++ int width, w = 0, height, h = 0, format; + bool_t color, c = NO; ++ xelval maxval; + unsigned n; + + for (n = 0; (filename = get_input_image_name (inputname, n)); n++) + { + FILE *file; +- xelval maxval; +- int format; + if (filename == NULL) + file = stdin; + else +@@ -251,6 +250,8 @@ alloc_coder (char const * const *inputna + wi->width = w; + wi->height = h; + wi->color = c; ++ wi->format = format; ++ wi->maxval = maxval; + } + + /* +@@ -642,7 +643,18 @@ video_coder (char const * const *image_t + */ + future_frame = frame == future_display; + c->mt->number = frame; +- c->mt->original = read_image (image_name); ++ if (strcmp(image_name, "-")) { ++ c->mt->original = read_image (image_name); ++ } else { /* stdin is not seekable - read image contents without rewind */ ++ int width = wfa->wfainfo->width; ++ int height = wfa->wfainfo->height; ++ int color = wfa->wfainfo->color; ++ int format = wfa->wfainfo->format; ++ xelval maxval = wfa->wfainfo->maxval; ++ ++ c->mt->original = alloc_image(width, height, color, FORMAT_4_4_4); ++ read_image_data(c->mt->original, stdin, color, width, height, maxval, format); ++ } + if (c->tiling->exponent && type == I_FRAME) + perform_tiling (c->mt->original, c->tiling); + +diff -up netpbm-10.35.58/converter/other/fiasco/codec/wfa.h.pnmtofiasco-stdin netpbm-10.35.58/converter/other/fiasco/codec/wfa.h +--- netpbm-10.35.58/converter/other/fiasco/codec/wfa.h.pnmtofiasco-stdin 2009-01-19 09:23:57.000000000 +0100 ++++ netpbm-10.35.58/converter/other/fiasco/codec/wfa.h 2009-01-21 08:03:28.000000000 +0100 +@@ -75,6 +75,7 @@ typedef struct range_info + unsigned level; /* bintree level of range */ + } range_info_t; + ++#include "pnm.h" + #include "image.h" + #include "rpf.h" + #include "bit-io.h" +@@ -93,6 +94,8 @@ typedef struct wfa_info + unsigned width; /* image width */ + unsigned height; /* image height */ + unsigned level; /* image level */ ++ unsigned format; /* image format */ ++ xelval maxval; /* image maximal pixel intensity value */ + rpf_t *rpf; /* Standard reduced precision format */ + rpf_t *dc_rpf; /* DC reduced precision format */ + rpf_t *d_rpf; /* Delta reduced precision format */ +diff -up netpbm-10.35.58/converter/other/fiasco/lib/image.c.pnmtofiasco-stdin netpbm-10.35.58/converter/other/fiasco/lib/image.c +--- netpbm-10.35.58/converter/other/fiasco/lib/image.c.pnmtofiasco-stdin 2009-01-19 09:23:57.000000000 +0100 ++++ netpbm-10.35.58/converter/other/fiasco/lib/image.c 2009-01-21 08:01:53.000000000 +0100 +@@ -273,7 +273,7 @@ free_image (image_t *image) + } + + +-static void ++void + read_image_data(image_t * const image, FILE *input, const bool_t color, + const int width, const int height, const xelval maxval, + const int format) { +diff -up netpbm-10.35.58/converter/other/fiasco/lib/image.h.pnmtofiasco-stdin netpbm-10.35.58/converter/other/fiasco/lib/image.h +--- netpbm-10.35.58/converter/other/fiasco/lib/image.h.pnmtofiasco-stdin 2009-01-19 09:23:57.000000000 +0100 ++++ netpbm-10.35.58/converter/other/fiasco/lib/image.h 2009-01-21 08:02:29.000000000 +0100 +@@ -17,6 +17,8 @@ + #ifndef _IMAGE_H + #define _IMAGE_H + ++#include "pnm.h" ++ + #include + #include "types.h" + #include "fiasco.h" +@@ -51,6 +53,10 @@ read_pnmheader (const char *image_name, + image_t * + read_image (const char *image_name); + void ++read_image_data(image_t * const image, FILE *input, const bool_t color, ++ const int width, const int height, const xelval maxval, ++ const int format); ++void + write_image (const char *image_name, const image_t *image); + bool_t + same_image_type (const image_t *img1, const image_t *img2); diff --git a/netpbm.spec b/netpbm.spec index 2e35fe3..e61d525 100644 --- a/netpbm.spec +++ b/netpbm.spec @@ -1,7 +1,7 @@ Summary: A library for handling different graphics file formats Name: netpbm Version: 10.35.58 -Release: 1%{?dist} +Release: 2%{?dist} # See copyright_summary for details License: BSD and GPLv2 and IJG and MIT and Public Domain Group: System Environment/Libraries @@ -32,6 +32,7 @@ Patch19: netpbm-10.35-gcc43.patch Patch20: netpbm-10.35-rgbtxt.patch Patch21: netpbm-10.35-pamtosvgsegfault.patch Patch22: netpbm-10.35-pnmmontagefix.patch +Patch23: netpbm-10.35-pnmtofiasco-stdin.patch Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: libjpeg-devel, libpng-devel, libtiff-devel, flex BuildRequires: libX11-devel, python, jasper-devel @@ -94,6 +95,7 @@ netpbm-progs. You'll also need to install the netpbm package. %patch20 -p1 -b .rgbtxt %patch21 -p1 -b .pamtosvgsegfault %patch22 -p1 -b .pnmmontagefix +%patch23 -p1 -b .pnmtofiasco-stdin ##mv shhopt/shhopt.h shhopt/pbmshhopt.h ##perl -pi -e 's|shhopt.h|pbmshhopt.h|g' `find -name "*.c" -o -name "*.h"` ./GNUmakefile @@ -221,6 +223,9 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/netpbm/ %changelog +* Wed Jan 21 2009 Jindrich Novy 10.35.58-2 +- fix pnmtofiasco to accept image from stdin (#476989, #227283) + * Mon Jan 19 2009 Jindrich Novy 10.35.58-1 - update to 10.35.38 - fixes crashes in picttoppm, pbmtomrf, mrftopbm