Merge pull request #769 from alagoutte/pvs
Fix issue reporting by PVS Studio
This commit is contained in:
commit
4aab15999d
|
@ -287,7 +287,7 @@ static int on_stream_close_callback(nghttp2_session *session, int32_t stream_id,
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
if (session_data->stream_data->stream_id == stream_id) {
|
if (session_data->stream_data->stream_id == stream_id) {
|
||||||
fprintf(stderr, "Stream %d closed with error_code=%d\n", stream_id,
|
fprintf(stderr, "Stream %d closed with error_code=%u\n", stream_id,
|
||||||
error_code);
|
error_code);
|
||||||
rv = nghttp2_session_terminate_session(session, NGHTTP2_NO_ERROR);
|
rv = nghttp2_session_terminate_session(session, NGHTTP2_NO_ERROR);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
|
|
|
@ -2281,10 +2281,6 @@ ssize_t nghttp2_hd_decode_length(uint32_t *res, size_t *shift_ptr, int *fin,
|
||||||
return decode_length(res, shift_ptr, fin, initial, shift, in, last, prefix);
|
return decode_length(res, shift_ptr, fin, initial, shift, in, last, prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t hd_get_num_table_entries(nghttp2_hd_context *context) {
|
|
||||||
return context->hd_table.len + NGHTTP2_STATIC_TABLE_LENGTH;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const nghttp2_nv *hd_get_table_entry(nghttp2_hd_context *context,
|
static const nghttp2_nv *hd_get_table_entry(nghttp2_hd_context *context,
|
||||||
size_t idx) {
|
size_t idx) {
|
||||||
if (idx == 0) {
|
if (idx == 0) {
|
||||||
|
@ -2301,7 +2297,7 @@ static const nghttp2_nv *hd_get_table_entry(nghttp2_hd_context *context,
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t nghttp2_hd_deflate_get_num_table_entries(nghttp2_hd_deflater *deflater) {
|
size_t nghttp2_hd_deflate_get_num_table_entries(nghttp2_hd_deflater *deflater) {
|
||||||
return hd_get_num_table_entries(&deflater->ctx);
|
return get_max_index(&deflater->ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
const nghttp2_nv *
|
const nghttp2_nv *
|
||||||
|
@ -2320,7 +2316,7 @@ nghttp2_hd_deflate_get_max_dynamic_table_size(nghttp2_hd_deflater *deflater) {
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t nghttp2_hd_inflate_get_num_table_entries(nghttp2_hd_inflater *inflater) {
|
size_t nghttp2_hd_inflate_get_num_table_entries(nghttp2_hd_inflater *inflater) {
|
||||||
return hd_get_num_table_entries(&inflater->ctx);
|
return get_max_index(&inflater->ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
const nghttp2_nv *
|
const nghttp2_nv *
|
||||||
|
|
|
@ -365,7 +365,7 @@ int32_t nghttp2_submit_push_promise(nghttp2_session *session, uint8_t flags _U_,
|
||||||
return promised_stream_id;
|
return promised_stream_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nghttp2_submit_window_update(nghttp2_session *session, uint8_t flags,
|
int nghttp2_submit_window_update(nghttp2_session *session, uint8_t flags _U_,
|
||||||
int32_t stream_id,
|
int32_t stream_id,
|
||||||
int32_t window_size_increment) {
|
int32_t window_size_increment) {
|
||||||
int rv;
|
int rv;
|
||||||
|
@ -373,7 +373,6 @@ int nghttp2_submit_window_update(nghttp2_session *session, uint8_t flags,
|
||||||
if (window_size_increment == 0) {
|
if (window_size_increment == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
flags = 0;
|
|
||||||
if (stream_id == 0) {
|
if (stream_id == 0) {
|
||||||
rv = nghttp2_adjust_local_window_size(
|
rv = nghttp2_adjust_local_window_size(
|
||||||
&session->local_window_size, &session->recv_window_size,
|
&session->local_window_size, &session->recv_window_size,
|
||||||
|
@ -404,14 +403,14 @@ int nghttp2_submit_window_update(nghttp2_session *session, uint8_t flags,
|
||||||
nghttp2_max(0, stream->consumed_size - window_size_increment);
|
nghttp2_max(0, stream->consumed_size - window_size_increment);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nghttp2_session_add_window_update(session, flags, stream_id,
|
return nghttp2_session_add_window_update(session, 0, stream_id,
|
||||||
window_size_increment);
|
window_size_increment);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nghttp2_session_set_local_window_size(nghttp2_session *session,
|
int nghttp2_session_set_local_window_size(nghttp2_session *session,
|
||||||
uint8_t flags, int32_t stream_id,
|
uint8_t flags _U_, int32_t stream_id,
|
||||||
int32_t window_size) {
|
int32_t window_size) {
|
||||||
int32_t window_size_increment;
|
int32_t window_size_increment;
|
||||||
nghttp2_stream *stream;
|
nghttp2_stream *stream;
|
||||||
|
@ -421,8 +420,6 @@ int nghttp2_session_set_local_window_size(nghttp2_session *session,
|
||||||
return NGHTTP2_ERR_INVALID_ARGUMENT;
|
return NGHTTP2_ERR_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
flags = 0;
|
|
||||||
|
|
||||||
if (stream_id == 0) {
|
if (stream_id == 0) {
|
||||||
window_size_increment = window_size - session->local_window_size;
|
window_size_increment = window_size - session->local_window_size;
|
||||||
|
|
||||||
|
@ -472,7 +469,7 @@ int nghttp2_session_set_local_window_size(nghttp2_session *session,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window_size_increment > 0) {
|
if (window_size_increment > 0) {
|
||||||
return nghttp2_session_add_window_update(session, flags, stream_id,
|
return nghttp2_session_add_window_update(session, 0, stream_id,
|
||||||
window_size_increment);
|
window_size_increment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue