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

Commit

Permalink
http2: cast numchars to size_t
Browse files Browse the repository at this point in the history
Currently when building the following compiler warning is issued:
../src/node_http2_core.cc:204:16: warning: comparison of integers of
different signs: 'ssize_t'
      (aka 'long') and 'size_t' (aka 'unsigned long') [-Wsign-compare]
  if (numchars < length) {
      ~~~~~~~~ ^ ~~~~~~
1 warning generated.

numchars is checked to make sure it is greater than 0 so it should be
safe to cast it to size_t.

PR-URL: #172
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
danbev authored and jasnell committed Jul 10, 2017
1 parent d4ba711 commit f61cc1c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/node_http2_core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ ssize_t Nghttp2Session::OnStreamReadFD(nghttp2_session* session,
stream->fd_offset_ += numchars;

// if numchars < length, assume that we are done.
if (numchars < length) {
if (static_cast<size_t>(numchars) < length) {
DEBUG_HTTP2("Nghttp2Session %d: no more data for stream %d\n",
handle->session_type_, id);
*flags |= NGHTTP2_DATA_FLAG_EOF;
Expand Down

0 comments on commit f61cc1c

Please sign in to comment.