From f7c133da0014d2ac8786e7cca4b3be9f54605880 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 21 Jan 2017 11:53:49 -0800 Subject: [PATCH] Use long instead of int in read_in_chunks() Fixes warnings about narrowing conversions --- src/builtin.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/builtin.cpp b/src/builtin.cpp index fe04becf8..70eef46c3 100644 --- a/src/builtin.cpp +++ b/src/builtin.cpp @@ -2008,6 +2008,7 @@ static int read_interactive(wcstring &buff, int nchars, bool shell, const wchar_ /// Read from the fd in chunks until we see newline or null, as appropriate, is seen. This is only /// used when the fd is seekable (so not from a tty or pipe) and we're not reading a specific number /// of chars. +/// Returns an exit status static int read_in_chunks(int fd, wcstring &buff, bool split_null) { int exit_res = STATUS_BUILTIN_OK; std::string str; @@ -2016,14 +2017,14 @@ static int read_in_chunks(int fd, wcstring &buff, bool split_null) { while (!finished) { char inbuf[READ_CHUNK_SIZE]; - int bytes_read = read_blocked(fd, inbuf, READ_CHUNK_SIZE); + long bytes_read = read_blocked(fd, inbuf, READ_CHUNK_SIZE); if (bytes_read <= 0) { eof = true; break; } - int i; + long i; for (i = 0; i < bytes_read && !finished; i++) { if ((!split_null && inbuf[i] == L'\n') || (split_null && inbuf[i] == L'\0')) { finished = true;