From 4e2fec16b797cbbd2882663c3092f23f6b464979 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sun, 17 Jun 2018 19:05:25 -0700 Subject: [PATCH] win: remove use of min() macro in pipe.c This macro is not guaranteed to be present in stdlib.h and the macro may be disabled on Windows in some situations (e.g. when NOMINMAX is defined). PR-URL: https://github.com/libuv/libuv/pull/1891 Reviewed-By: Colin Ihrig Reviewed-By: Bartosz Sosnowski Reviewed-By: Ben Noordhuis --- src/win/pipe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/win/pipe.c b/src/win/pipe.c index 3d54c628..ae569326 100644 --- a/src/win/pipe.c +++ b/src/win/pipe.c @@ -1658,7 +1658,8 @@ static DWORD uv__pipe_read_data(uv_loop_t* loop, * (a) the length of the user-allocated buffer. * (b) the maximum data length as specified by the `max_bytes` argument. */ - max_bytes = min(buf.len, max_bytes); + if (max_bytes > buf.len) + max_bytes = buf.len; /* Read into the user buffer. */ if (!ReadFile(handle->handle, buf.base, max_bytes, &bytes_read, NULL)) {