Bug 690152, Regression: Input from stdin on OS X

Alex Cherepanov <[email protected]> Wed, 31 Dec 2008 16:59:27 -0500
Newsgroups gmane.comp.printing.ghostscript.patches
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------010307020601000900070907
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Continue to access the stream while reading a string (sgets()) until the 
string is filled, EOF is reached, or an error occurs. Don't return after 
first partial read.

Old code did the same thing for 1-byte reads. This handling is now
extended to the reads of any size.

No differences was found in the testing against 'comparefiles' and CET 
suite.

--------------010307020601000900070907
Content-Type: text/plain;
 name="690152.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="690152.diff"

Index: gs/base/stream.c
===================================================================
--- gs/base/stream.c	(revision 9301)
+++ gs/base/stream.c	(working copy)
@@ -535,7 +535,7 @@
 		 */
 		s->srptr = s->srlimit = s->cbuf - 1;
 		s->position += cw.ptr - wptr;
-		if (status != 1 || cw.ptr == cw.limit)
+		if (status <= 0 || cw.ptr == cw.limit)
 		    break;
 	    }
 	    c = spgetc(s);

--------------010307020601000900070907
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
gs-code-review mailing list
[email protected]
http://www.ghostscript.com/mailman/listinfo/gs-code-review

--------------010307020601000900070907--