clang-format

This commit is contained in:
Tatsuhiro Tsujikawa 2016-10-14 22:33:08 +09:00
parent bef3d47c16
commit 5e99531b4d
3 changed files with 68 additions and 63 deletions

View File

@ -967,8 +967,9 @@ static int emit_string(nghttp2_bufs *bufs, const uint8_t *str, size_t len) {
blocklen = count_encoded_length(enclen, 7);
DEBUGF("deflatehd: emit string str=%.*s, length=%zu, huffman=%d, encoded_length=%zu\n",
(int)len, (const char*)str, len, huffman, enclen);
DEBUGF("deflatehd: emit string str=%.*s, length=%zu, huffman=%d, "
"encoded_length=%zu\n",
(int)len, (const char *)str, len, huffman, enclen);
if (sizeof(sb) < blocklen) {
return NGHTTP2_ERR_HEADER_COMP;
@ -1327,8 +1328,8 @@ static int deflate_nv(nghttp2_hd_deflater *deflater, nghttp2_bufs *bufs,
nghttp2_mem *mem;
uint32_t hash = 0;
DEBUGF("deflatehd: deflating %.*s: %.*s\n", (int)nv->namelen,
nv->name, (int)nv->valuelen, nv->value);
DEBUGF("deflatehd: deflating %.*s: %.*s\n", (int)nv->namelen, nv->name,
(int)nv->valuelen, nv->value);
mem = deflater->ctx.mem;
@ -1864,7 +1865,8 @@ ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater,
case NGHTTP2_HD_STATE_EXPECT_TABLE_SIZE:
if ((*in & 0xe0u) != 0x20u) {
DEBUGF("inflatehd: header table size change was "
"expected, but saw 0x%02x as first byte", *in);
"expected, but saw 0x%02x as first byte",
*in);
rv = NGHTTP2_ERR_HEADER_COMP;
goto fail;
}
@ -1977,8 +1979,7 @@ ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater,
inflater->state = NGHTTP2_HD_STATE_NEWNAME_READ_NAMELEN;
inflater->left = 0;
inflater->shift = 0;
DEBUGF("inflatehd: huffman encoded=%d\n",
inflater->huffman_encoded != 0);
DEBUGF("inflatehd: huffman encoded=%d\n", inflater->huffman_encoded != 0);
/* Fall through */
case NGHTTP2_HD_STATE_NEWNAME_READ_NAMELEN:
rfin = 0;
@ -1988,7 +1989,8 @@ ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater,
}
in += rv;
if (!rfin) {
DEBUGF("inflatehd: integer not fully decoded. current=%zu\n", inflater->left);
DEBUGF("inflatehd: integer not fully decoded. current=%zu\n",
inflater->left);
goto almost_ok;
}
@ -2137,7 +2139,8 @@ ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater,
case NGHTTP2_HD_STATE_READ_VALUE:
rv = hd_inflate_read(inflater, &inflater->valuebuf, in, last);
if (rv < 0) {
DEBUGF("inflatehd: value read failure %zd: %s\n", rv, nghttp2_strerror((int)rv));
DEBUGF("inflatehd: value read failure %zd: %s\n", rv,
nghttp2_strerror((int)rv));
goto fail;
}

View File

@ -774,8 +774,7 @@ int nghttp2_session_reprioritize_stream(
} else if (nghttp2_stream_dep_find_ancestor(dep_stream, stream)) {
DEBUGF("stream: cycle detected, dep_stream(%p)=%d "
"stream(%p)=%d\n",
dep_stream, dep_stream->stream_id, stream,
stream->stream_id);
dep_stream, dep_stream->stream_id, stream, stream->stream_id);
nghttp2_stream_dep_remove_subtree(dep_stream);
rv = nghttp2_stream_dep_add_subtree(stream->dep_prev, dep_stream);
@ -1124,8 +1123,7 @@ int nghttp2_session_close_stream(nghttp2_session *session, int32_t stream_id,
return NGHTTP2_ERR_INVALID_ARGUMENT;
}
DEBUGF("stream: stream(%p)=%d close\n", stream,
stream->stream_id);
DEBUGF("stream: stream(%p)=%d close\n", stream, stream->stream_id);
if (stream->item) {
nghttp2_outbound_item *item;
@ -1203,8 +1201,7 @@ int nghttp2_session_destroy_stream(nghttp2_session *session,
nghttp2_mem *mem;
int rv;
DEBUGF("stream: destroy closed stream(%p)=%d\n", stream,
stream->stream_id);
DEBUGF("stream: destroy closed stream(%p)=%d\n", stream, stream->stream_id);
mem = &session->mem;
@ -1224,8 +1221,8 @@ int nghttp2_session_destroy_stream(nghttp2_session *session,
void nghttp2_session_keep_closed_stream(nghttp2_session *session,
nghttp2_stream *stream) {
DEBUGF("stream: keep closed stream(%p)=%d, state=%d\n",
stream, stream->stream_id, stream->state);
DEBUGF("stream: keep closed stream(%p)=%d, state=%d\n", stream,
stream->stream_id, stream->state);
if (session->closed_stream_tail) {
session->closed_stream_tail->closed_next = stream;
@ -1258,8 +1255,8 @@ void nghttp2_session_detach_idle_stream(nghttp2_session *session,
nghttp2_stream *stream) {
nghttp2_stream *prev_stream, *next_stream;
DEBUGF("stream: detach idle stream(%p)=%d, state=%d\n",
stream, stream->stream_id, stream->state);
DEBUGF("stream: detach idle stream(%p)=%d, state=%d\n", stream,
stream->stream_id, stream->state);
prev_stream = stream->closed_prev;
next_stream = stream->closed_next;
@ -1742,9 +1739,8 @@ nghttp2_session_enforce_flow_control_limits(nghttp2_session *session,
ssize_t requested_window_size) {
DEBUGF("send: remote windowsize connection=%d, "
"remote maxframsize=%u, stream(id %d)=%d\n",
session->remote_window_size,
session->remote_settings.max_frame_size, stream->stream_id,
stream->remote_window_size);
session->remote_window_size, session->remote_settings.max_frame_size,
stream->stream_id, stream->remote_window_size);
return nghttp2_min(nghttp2_min(nghttp2_min(requested_window_size,
stream->remote_window_size),
@ -3275,7 +3271,8 @@ static int session_call_on_frame_received(nghttp2_session *session,
static int session_call_on_begin_headers(nghttp2_session *session,
nghttp2_frame *frame) {
int rv;
DEBUGF("recv: call on_begin_headers callback stream_id=%d\n", frame->hd.stream_id);
DEBUGF("recv: call on_begin_headers callback stream_id=%d\n",
frame->hd.stream_id);
if (session->callbacks.on_begin_headers_callback) {
rv = session->callbacks.on_begin_headers_callback(session, frame,
session->user_data);
@ -3573,9 +3570,9 @@ static int inflate_header_block(nghttp2_session *session, nghttp2_frame *frame,
rv = nghttp2_http_on_header(session, subject_stream, frame, &nv,
trailer);
if (rv == NGHTTP2_ERR_HTTP_HEADER) {
DEBUGF("recv: HTTP error: type=%u, id=%d, header %.*s: %.*s\n",
frame->hd.type, frame->hd.stream_id, (int)nv.name->len,
nv.name->base, (int)nv.value->len, nv.value->base);
DEBUGF("recv: HTTP error: type=%u, id=%d, header %.*s: %.*s\n",
frame->hd.type, frame->hd.stream_id, (int)nv.name->len,
nv.name->base, (int)nv.value->len, nv.value->base);
rv = session_call_error_callback(
session, "Invalid HTTP header field was received: frame type: "
@ -5360,8 +5357,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
iframe->frame.hd.flags, iframe->frame.hd.stream_id);
if (iframe->frame.hd.length > session->local_settings.max_frame_size) {
DEBUGF("recv: length is too large %zu > %u\n",
iframe->frame.hd.length,
DEBUGF("recv: length is too large %zu > %u\n", iframe->frame.hd.length,
session->local_settings.max_frame_size);
busy = 1;
@ -5758,9 +5754,8 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
in += readlen;
iframe->payloadleft -= readlen;
DEBUGF("recv: readlen=%zu, payloadleft=%zu, left=%zd\n",
readlen, iframe->payloadleft,
nghttp2_buf_mark_avail(&iframe->sbuf));
DEBUGF("recv: readlen=%zu, payloadleft=%zu, left=%zd\n", readlen,
iframe->payloadleft, nghttp2_buf_mark_avail(&iframe->sbuf));
if (nghttp2_buf_mark_avail(&iframe->sbuf)) {
return in - first;
@ -6137,7 +6132,8 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
iframe->payloadleft -= readlen;
in += readlen;
DEBUGF("recv: readlen=%zu, payloadleft=%zu\n", readlen, iframe->payloadleft);
DEBUGF("recv: readlen=%zu, payloadleft=%zu\n", readlen,
iframe->payloadleft);
if (nghttp2_buf_mark_avail(&iframe->sbuf)) {
break;
@ -6172,7 +6168,8 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
in += readlen;
}
DEBUGF("recv: readlen=%zu, payloadleft=%zu\n", readlen, iframe->payloadleft);
DEBUGF("recv: readlen=%zu, payloadleft=%zu\n", readlen,
iframe->payloadleft);
if (iframe->payloadleft) {
assert(nghttp2_buf_avail(&iframe->lbuf) > 0);
@ -6211,8 +6208,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
DEBUGF("recv: payloadlen=%zu, type=%u, flags=0x%02x, "
"stream_id=%d\n",
cont_hd.length, cont_hd.type, cont_hd.flags,
cont_hd.stream_id);
cont_hd.length, cont_hd.type, cont_hd.flags, cont_hd.stream_id);
if (cont_hd.type != NGHTTP2_CONTINUATION ||
cont_hd.stream_id != iframe->frame.hd.stream_id) {
@ -6262,9 +6258,8 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
in += readlen;
iframe->payloadleft -= readlen;
DEBUGF("recv: readlen=%zu, payloadleft=%zu, left=%zu\n",
readlen, iframe->payloadleft,
nghttp2_buf_mark_avail(&iframe->sbuf));
DEBUGF("recv: readlen=%zu, payloadleft=%zu, left=%zu\n", readlen,
iframe->payloadleft, nghttp2_buf_mark_avail(&iframe->sbuf));
if (nghttp2_buf_mark_avail(&iframe->sbuf)) {
return in - first;
@ -6328,7 +6323,8 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
iframe->payloadleft -= readlen;
in += readlen;
DEBUGF("recv: readlen=%zu, payloadleft=%zu\n", readlen, iframe->payloadleft);
DEBUGF("recv: readlen=%zu, payloadleft=%zu\n", readlen,
iframe->payloadleft);
if (readlen > 0) {
ssize_t data_readlen;
@ -6425,7 +6421,8 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
iframe->payloadleft -= readlen;
in += readlen;
DEBUGF("recv: readlen=%zu, payloadleft=%zu\n", readlen, iframe->payloadleft);
DEBUGF("recv: readlen=%zu, payloadleft=%zu\n", readlen,
iframe->payloadleft);
if (readlen > 0) {
/* Update connection-level flow control window for ignored
@ -6462,7 +6459,8 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
iframe->payloadleft -= readlen;
in += readlen;
DEBUGF("recv: readlen=%zu, payloadleft=%zu\n", readlen, iframe->payloadleft);
DEBUGF("recv: readlen=%zu, payloadleft=%zu\n", readlen,
iframe->payloadleft);
if (readlen > 0) {
rv = session_call_on_extension_chunk_recv_callback(
@ -6504,7 +6502,8 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
in += readlen;
}
DEBUGF("recv: readlen=%zu, payloadleft=%zu\n", readlen, iframe->payloadleft);
DEBUGF("recv: readlen=%zu, payloadleft=%zu\n", readlen,
iframe->payloadleft);
if (iframe->payloadleft) {
assert(nghttp2_buf_avail(&iframe->lbuf) > 0);
@ -6919,7 +6918,8 @@ int nghttp2_session_pack_data(nghttp2_session *session, nghttp2_bufs *bufs,
if (payloadlen == NGHTTP2_ERR_DEFERRED ||
payloadlen == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE ||
payloadlen == NGHTTP2_ERR_PAUSE) {
DEBUGF("send: DATA postponed due to %s\n", nghttp2_strerror((int)payloadlen));
DEBUGF("send: DATA postponed due to %s\n",
nghttp2_strerror((int)payloadlen));
return (int)payloadlen;
}

View File

@ -153,10 +153,11 @@ static int stream_obq_push(nghttp2_stream *dep_stream, nghttp2_stream *stream) {
stream_next_cycle(stream, dep_stream->descendant_last_cycle);
stream->seq = dep_stream->descendant_next_seq++;
DEBUGF("stream: stream=%d obq push cycle=%d\n", stream->stream_id, stream->cycle);
DEBUGF("stream: stream=%d obq push cycle=%d\n", stream->stream_id,
stream->cycle);
DEBUGF("stream: push stream %d to stream %d\n",
stream->stream_id, dep_stream->stream_id);
DEBUGF("stream: push stream %d to stream %d\n", stream->stream_id,
dep_stream->stream_id);
rv = nghttp2_pq_push(&dep_stream->obq, &stream->pq_entry);
if (rv != 0) {
@ -183,8 +184,8 @@ static void stream_obq_remove(nghttp2_stream *stream) {
}
for (; dep_stream; stream = dep_stream, dep_stream = dep_stream->dep_prev) {
DEBUGF("stream: remove stream %d from stream %d\n",
stream->stream_id, dep_stream->stream_id);
DEBUGF("stream: remove stream %d from stream %d\n", stream->stream_id,
dep_stream->stream_id);
nghttp2_pq_remove(&dep_stream->obq, &stream->pq_entry);
@ -214,8 +215,8 @@ static int stream_obq_move(nghttp2_stream *dest, nghttp2_stream *src,
return 0;
}
DEBUGF("stream: remove stream %d from stream %d (move)\n",
stream->stream_id, src->stream_id);
DEBUGF("stream: remove stream %d from stream %d (move)\n", stream->stream_id,
src->stream_id);
nghttp2_pq_remove(&src->obq, &stream->pq_entry);
stream->queued = 0;
@ -238,8 +239,8 @@ void nghttp2_stream_reschedule(nghttp2_stream *stream) {
nghttp2_pq_push(&dep_stream->obq, &stream->pq_entry);
DEBUGF("stream: stream=%d obq resched cycle=%d\n",
stream->stream_id, stream->cycle);
DEBUGF("stream: stream=%d obq resched cycle=%d\n", stream->stream_id,
stream->cycle);
dep_stream->last_writelen = stream->last_writelen;
}
@ -298,8 +299,8 @@ void nghttp2_stream_change_weight(nghttp2_stream *stream, int32_t weight) {
nghttp2_pq_push(&dep_stream->obq, &stream->pq_entry);
DEBUGF("stream: stream=%d obq resched cycle=%d\n",
stream->stream_id, stream->cycle);
DEBUGF("stream: stream=%d obq resched cycle=%d\n", stream->stream_id,
stream->cycle);
}
static nghttp2_stream *stream_last_sib(nghttp2_stream *stream) {
@ -510,8 +511,8 @@ int nghttp2_stream_detach_item(nghttp2_stream *stream) {
int nghttp2_stream_defer_item(nghttp2_stream *stream, uint8_t flags) {
assert(stream->item);
DEBUGF("stream: stream=%d defer item=%p cause=%02x\n",
stream->stream_id, stream->item, flags);
DEBUGF("stream: stream=%d defer item=%p cause=%02x\n", stream->stream_id,
stream->item, flags);
stream->flags |= flags;
@ -521,8 +522,8 @@ int nghttp2_stream_defer_item(nghttp2_stream *stream, uint8_t flags) {
int nghttp2_stream_resume_deferred_item(nghttp2_stream *stream, uint8_t flags) {
assert(stream->item);
DEBUGF("stream: stream=%d resume item=%p flags=%02x\n",
stream->stream_id, stream->item, flags);
DEBUGF("stream: stream=%d resume item=%p flags=%02x\n", stream->stream_id,
stream->item, flags);
stream->flags = (uint8_t)(stream->flags & ~flags);
@ -591,8 +592,8 @@ int nghttp2_stream_dep_insert(nghttp2_stream *dep_stream,
nghttp2_stream *si;
int rv;
DEBUGF("stream: dep_insert dep_stream(%p)=%d, stream(%p)=%d\n",
dep_stream, dep_stream->stream_id, stream, stream->stream_id);
DEBUGF("stream: dep_insert dep_stream(%p)=%d, stream(%p)=%d\n", dep_stream,
dep_stream->stream_id, stream, stream->stream_id);
stream->sum_dep_weight = dep_stream->sum_dep_weight;
dep_stream->sum_dep_weight = stream->weight;
@ -737,8 +738,8 @@ static void unlink_dep(nghttp2_stream *stream) {
void nghttp2_stream_dep_add(nghttp2_stream *dep_stream,
nghttp2_stream *stream) {
DEBUGF("stream: dep_add dep_stream(%p)=%d, stream(%p)=%d\n",
dep_stream, dep_stream->stream_id, stream, stream->stream_id);
DEBUGF("stream: dep_add dep_stream(%p)=%d, stream(%p)=%d\n", dep_stream,
dep_stream->stream_id, stream, stream->stream_id);
dep_stream->sum_dep_weight += stream->weight;
@ -885,7 +886,8 @@ int nghttp2_stream_dep_add_subtree(nghttp2_stream *dep_stream,
void nghttp2_stream_dep_remove_subtree(nghttp2_stream *stream) {
nghttp2_stream *next, *dep_prev;
DEBUGF("stream: dep_remove_subtree stream(%p)=%d\n", stream, stream->stream_id);
DEBUGF("stream: dep_remove_subtree stream(%p)=%d\n", stream,
stream->stream_id);
assert(stream->dep_prev);