From d4ba711c13164310b5937fa0b4889850bb1ee5c5 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Fri, 7 Jul 2017 13:31:25 +0200 Subject: [PATCH] http2: make ncopy signed Currently there is the following compiler warning generated upon building: ../src/node_http2_core-inl.h:146:17: warning: comparison of integers of different signs: 'ssize_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Wsign-compare] if (ncopy > buf.len) ~~~~~ ^ ~~~~~~~ ncopy is set to len which is of type ssize_t which is the return type of nghttp2_session_mem_send, and there are checks to verify that len is greater than zero so the converstion to size_t from ssize_t is safe. ncopy can also be assigned to buf.len but uv_buf_t.len is of type size_t. PR-URL: https://github.com/nodejs/http2/pull/171 Reviewed-By: Matteo Collina Reviewed-By: James M Snell --- src/node_http2_core-inl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_http2_core-inl.h b/src/node_http2_core-inl.h index 2bca07b92f..717d075fab 100644 --- a/src/node_http2_core-inl.h +++ b/src/node_http2_core-inl.h @@ -134,7 +134,7 @@ inline void Nghttp2Session::HandleGoawayFrame(const nghttp2_frame* frame) { inline void Nghttp2Session::SendPendingData() { const uint8_t* data; ssize_t len = 0; - ssize_t ncopy = 0; + size_t ncopy = 0; uv_buf_t buf; AllocateSend(SEND_BUFFER_RECOMMENDED_SIZE, &buf); while (nghttp2_session_want_write(session_)) {