Fix errors reported by scan-build

This commit is contained in:
Tatsuhiro Tsujikawa 2015-01-02 14:38:57 +09:00
parent c654549d35
commit db6eec653b
4 changed files with 6 additions and 7 deletions

View File

@ -131,7 +131,8 @@ noinst_LIBRARIES = libnghttpx.a
libnghttpx_a_SOURCES = ${NGHTTPX_SRCS} libnghttpx_a_SOURCES = ${NGHTTPX_SRCS}
nghttpx_SOURCES = shrpx.cc shrpx.h nghttpx_SOURCES = shrpx.cc shrpx.h
nghttpx_LDADD = libnghttpx.a ${LDADD} nghttpx_LDFLAGS =
nghttpx_LDADD = libnghttpx.a ${LDADD} ${AM_LDFLAGS}
if HAVE_CUNIT if HAVE_CUNIT
check_PROGRAMS += nghttpx-unittest check_PROGRAMS += nghttpx-unittest

View File

@ -660,7 +660,7 @@ int HttpDownstreamConnection::on_read() {
auto nproc = http_parser_execute(&response_htp_, &htp_hooks, auto nproc = http_parser_execute(&response_htp_, &htp_hooks,
reinterpret_cast<char *>(buf), nread); reinterpret_cast<char *>(buf), nread);
if (nproc != nread) { if (nproc != static_cast<size_t>(nread)) {
if (LOG_ENABLED(INFO)) { if (LOG_ENABLED(INFO)) {
DCLOG(INFO, this) << "nproc != nread"; DCLOG(INFO, this) << "nproc != nread";
} }

View File

@ -24,6 +24,8 @@
*/ */
#include "shrpx_rate_limit.h" #include "shrpx_rate_limit.h"
#include <limits>
namespace shrpx { namespace shrpx {
namespace { namespace {
@ -49,7 +51,7 @@ RateLimit::~RateLimit() {
size_t RateLimit::avail() const { size_t RateLimit::avail() const {
if (rate_ == 0) { if (rate_ == 0) {
return SSIZE_MAX; return std::numeric_limits<ssize_t>::max();
} }
return avail_; return avail_;
} }

View File

@ -706,10 +706,6 @@ ssize_t spdy_data_read_callback(spdylay_session *session, int32_t stream_id,
auto nread = body->remove(buf, length); auto nread = body->remove(buf, length);
auto body_empty = body->rleft() == 0; auto body_empty = body->rleft() == 0;
if (nread == -1) {
ULOG(FATAL, upstream) << "evbuffer_remove() failed";
return SPDYLAY_ERR_CALLBACK_FAILURE;
}
if (nread == 0 && if (nread == 0 &&
downstream->get_response_state() == Downstream::MSG_COMPLETE) { downstream->get_response_state() == Downstream::MSG_COMPLETE) {
if (!downstream->get_upgraded()) { if (!downstream->get_upgraded()) {