From 46606276c3fe20fa81597cf87378e18f7baf88a7 Mon Sep 17 00:00:00 2001 From: Fazlul Shahriar Date: Thu, 14 Nov 2019 00:47:58 -0500 Subject: page: fix hang for forward-only postscript files Page was hanging because ghostscript never closes the fd from which we're reading BMP data. We close our end of the pipe so that ghostscript will close its end. Tested with ghostscript version 9.50. Fixes #124 --- src/cmd/page/cache.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/cmd/page/cache.c') diff --git a/src/cmd/page/cache.c b/src/cmd/page/cache.c index 0063a339..5110840f 100644 --- a/src/cmd/page/cache.c +++ b/src/cmd/page/cache.c @@ -168,7 +168,12 @@ raproc(void *a) c = a; lockdisplay(display); - _cachedpage(c->doc, c->angle, c->page, "-ra"); + /* + * If there is only one page in a fwdonly file, we may reach EOF + * while doing readahead and page will exit without showing anything. + */ + if(!c->doc->fwdonly) + _cachedpage(c->doc, c->angle, c->page, "-ra"); rabusy = 0; unlockdisplay(display); free(c); -- cgit v1.2.3 From fa325e9b42b0bdfb48857d1958d9fb7ceac55151 Mon Sep 17 00:00:00 2001 From: Dan Cross Date: Fri, 10 Jan 2020 14:44:21 +0000 Subject: Trivial changes: whitespace and modes. Remote whitespace at the ends of lines. Remove blank lines from the ends of files. Change modes on source files so that they are not executable. Signed-off-by: Dan Cross --- src/cmd/page/cache.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/cmd/page/cache.c') diff --git a/src/cmd/page/cache.c b/src/cmd/page/cache.c index 5110840f..a1083fc7 100644 --- a/src/cmd/page/cache.c +++ b/src/cmd/page/cache.c @@ -29,7 +29,7 @@ questionmark(void) static Image *im; if(im) - return im; + return im; im = xallocimage(display, Rect(0,0,50,50), GREY1, 1, DBlack); if(im == nil) return nil; @@ -165,7 +165,7 @@ static void raproc(void *a) { Cached *c; - + c = a; lockdisplay(display); /* @@ -187,7 +187,7 @@ cachedpage(Document *doc, int angle, int page) Cached *c; Image *im; int ra; - + if(doc->npage < 1) return display->white; -- cgit v1.2.3