From db6eec653b8a052fe18a28478ab17205cdb27bec Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 2 Jan 2015 14:38:57 +0900 Subject: [PATCH] Fix errors reported by scan-build --- src/Makefile.am | 3 ++- src/shrpx_http_downstream_connection.cc | 2 +- src/shrpx_rate_limit.cc | 4 +++- src/shrpx_spdy_upstream.cc | 4 ---- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 82a17219..d8885216 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -131,7 +131,8 @@ noinst_LIBRARIES = libnghttpx.a libnghttpx_a_SOURCES = ${NGHTTPX_SRCS} nghttpx_SOURCES = shrpx.cc shrpx.h -nghttpx_LDADD = libnghttpx.a ${LDADD} +nghttpx_LDFLAGS = +nghttpx_LDADD = libnghttpx.a ${LDADD} ${AM_LDFLAGS} if HAVE_CUNIT check_PROGRAMS += nghttpx-unittest diff --git a/src/shrpx_http_downstream_connection.cc b/src/shrpx_http_downstream_connection.cc index 6903dff7..0b18b3eb 100644 --- a/src/shrpx_http_downstream_connection.cc +++ b/src/shrpx_http_downstream_connection.cc @@ -660,7 +660,7 @@ int HttpDownstreamConnection::on_read() { auto nproc = http_parser_execute(&response_htp_, &htp_hooks, reinterpret_cast(buf), nread); - if (nproc != nread) { + if (nproc != static_cast(nread)) { if (LOG_ENABLED(INFO)) { DCLOG(INFO, this) << "nproc != nread"; } diff --git a/src/shrpx_rate_limit.cc b/src/shrpx_rate_limit.cc index 259140b6..44867018 100644 --- a/src/shrpx_rate_limit.cc +++ b/src/shrpx_rate_limit.cc @@ -24,6 +24,8 @@ */ #include "shrpx_rate_limit.h" +#include + namespace shrpx { namespace { @@ -49,7 +51,7 @@ RateLimit::~RateLimit() { size_t RateLimit::avail() const { if (rate_ == 0) { - return SSIZE_MAX; + return std::numeric_limits::max(); } return avail_; } diff --git a/src/shrpx_spdy_upstream.cc b/src/shrpx_spdy_upstream.cc index c7ab5db7..14d971ff 100644 --- a/src/shrpx_spdy_upstream.cc +++ b/src/shrpx_spdy_upstream.cc @@ -706,10 +706,6 @@ ssize_t spdy_data_read_callback(spdylay_session *session, int32_t stream_id, auto nread = body->remove(buf, length); auto body_empty = body->rleft() == 0; - if (nread == -1) { - ULOG(FATAL, upstream) << "evbuffer_remove() failed"; - return SPDYLAY_ERR_CALLBACK_FAILURE; - } if (nread == 0 && downstream->get_response_state() == Downstream::MSG_COMPLETE) { if (!downstream->get_upgraded()) {