From b7da1a5af8f189705ca596bcec6597a59b1aff9b Mon Sep 17 00:00:00 2001 From: Daniel Colascione Date: Mon, 19 Feb 2018 08:55:37 -0800 Subject: [PATCH] Avoid -Wconversion error in dump_read_all under MS-Windows --- src/pdumper.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pdumper.c b/src/pdumper.c index efccafb07b7..f66f3fedb9a 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -4884,8 +4884,12 @@ dump_read_all (int fd, void *buf, size_t bytes_to_read) size_t bytes_read = 0; while (bytes_read < bytes_to_read) { + /* Some platforms accept only int-sized values to read. */ + unsigned chunk_to_read = UINT_MAX; + if (bytes_to_read - bytes_read < chunk_to_read) + chunk_to_read = (unsigned)(bytes_to_read - bytes_read); ssize_t chunk = - read (fd, (char*) buf + bytes_read, bytes_to_read - bytes_read); + read (fd, (char*) buf + bytes_read, chunk_to_read); if (chunk < 0) return chunk; if (chunk == 0) -- 2.39.5