Skip to content
This repository has been archived by the owner on Jul 6, 2018. It is now read-only.

Commit

Permalink
http2: make ncopy signed
Browse files Browse the repository at this point in the history
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: #171
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
danbev authored and jasnell committed Jul 10, 2017
1 parent 8f7d9c7 commit d4ba711
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/node_http2_core-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_)) {
Expand Down

0 comments on commit d4ba711

Please sign in to comment.