From a014dedf92b59efd9e25e844cb08f055287c4745 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 24 Feb 2016 20:48:54 +0100 Subject: Make fz_read_line behave like gets and return NULL at EOF. --- source/fitz/stream-read.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source/fitz/stream-read.c') diff --git a/source/fitz/stream-read.c b/source/fitz/stream-read.c index 80091046..2ebd5ad6 100644 --- a/source/fitz/stream-read.c +++ b/source/fitz/stream-read.c @@ -89,7 +89,7 @@ fz_read_best(fz_context *ctx, fz_stream *stm, int initial, int *truncated) return buf; } -void +char * fz_read_line(fz_context *ctx, fz_stream *stm, char *mem, int n) { char *s = mem; @@ -112,6 +112,7 @@ fz_read_line(fz_context *ctx, fz_stream *stm, char *mem, int n) } if (n) *s = '\0'; + return (s == mem && c == EOF) ? NULL : mem; } fz_off_t -- cgit v1.2.3