diff --git a/include/common/buf.h b/include/common/buf.h index 998e31aa1..4c372debf 100644 --- a/include/common/buf.h +++ b/include/common/buf.h @@ -28,13 +28,15 @@ #ifndef _COMMON_BUF_H #define _COMMON_BUF_H +#include + /* Structure defining a buffer's head */ struct buffer { char *p; /* buffer's start pointer, separates in and out data */ - unsigned int size; /* buffer size in bytes */ - unsigned int i; /* number of input bytes pending for analysis in the buffer */ - unsigned int o; /* number of out bytes the sender can consume from this buffer */ + size_t size; /* buffer size in bytes */ + size_t i; /* number of input bytes pending for analysis in the buffer */ + size_t o; /* number of out bytes the sender can consume from this buffer */ char data[0]; /* bytes of stored data */ }; diff --git a/src/buffer.c b/src/buffer.c index 79cc133cb..b6ece4ba6 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -211,9 +211,9 @@ void buffer_slow_realign(struct buffer *buf) void buffer_dump(FILE *o, struct buffer *b, int from, int to) { fprintf(o, "Dumping buffer %p\n", b); - fprintf(o, " data=%p o=%d i=%d p=%p\n" + fprintf(o, " data=%p o=%u i=%u p=%p\n" " relative: p=0x%04x\n", - b->data, b->o, b->i, b->p, (unsigned int)(b->p - b->data)); + b->data, (unsigned int)b->o, (unsigned int)b->i, b->p, (unsigned int)(b->p - b->data)); fprintf(o, "Dumping contents from byte %d to byte %d\n", from, to); fprintf(o, " 0 1 2 3 4 5 6 7 8 9 a b c d e f\n"); diff --git a/src/checks.c b/src/checks.c index 3cae94d51..0150bbb7e 100644 --- a/src/checks.c +++ b/src/checks.c @@ -2854,8 +2854,8 @@ static int tcpcheck_main(struct check *check) } if (check->current_step->string_len >= check->bo->size) { - chunk_printf(&trash, "tcp-check send : string too large (%d) for buffer size (%d) at step %d", - check->current_step->string_len, check->bo->size, + chunk_printf(&trash, "tcp-check send : string too large (%d) for buffer size (%u) at step %d", + check->current_step->string_len, (unsigned int)check->bo->size, tcpcheck_get_step_id(check)); set_server_check_status(check, HCHK_STATUS_L7RSP, trash.str); goto out_end_tcpcheck; diff --git a/src/flt_http_comp.c b/src/flt_http_comp.c index b93ff69e8..99a767c92 100644 --- a/src/flt_http_comp.c +++ b/src/flt_http_comp.c @@ -298,8 +298,8 @@ comp_http_forward_data(struct stream *s, struct filter *filter, if (msg->flags & HTTP_MSGF_TE_CHNK) { ret = http_compression_buffer_add_data(st, tmpbuf, zbuf, tmpbuf->i); if (ret != tmpbuf->i) { - ha_warning("HTTP compression failed: Must consume %d bytes but only %d bytes consumed\n", - tmpbuf->i, ret); + ha_warning("HTTP compression failed: Must consume %u bytes but only %d bytes consumed\n", + (unsigned int)tmpbuf->i, ret); return -1; } } diff --git a/src/mux_h2.c b/src/mux_h2.c index 5fc754721..1eba104b3 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -3357,7 +3357,7 @@ static int h2s_frt_make_resp_data(struct h2s *h2s, struct buffer *buf) } end: - trace("[%d] sent simple H2 DATA response (sid=%d) = %d bytes out (%d in, st=%s, ep=%u, es=%s, h2cws=%d h2sws=%d) buf->o=%d", h2c->st0, h2s->id, size+9, total, h1_msg_state_str(h1m->state), h1m->err_pos, h1_msg_state_str(h1m->err_state), h2c->mws, h2s->mws, buf->o); + trace("[%d] sent simple H2 DATA response (sid=%d) = %d bytes out (%d in, st=%s, ep=%u, es=%s, h2cws=%d h2sws=%d) buf->o=%u", h2c->st0, h2s->id, size+9, total, h1_msg_state_str(h1m->state), h1m->err_pos, h1_msg_state_str(h1m->err_state), h2c->mws, h2s->mws, (unsigned int)buf->o); return total; } @@ -3472,7 +3472,7 @@ static void h2_show_fd(struct chunk *msg, struct connection *conn) } chunk_appendf(msg, " st0=%d flg=0x%08x nbst=%u nbcs=%u fctl_cnt=%d send_cnt=%d tree_cnt=%d orph_cnt=%d dbuf=%u/%u mbuf=%u/%u", - h2c->st0, h2c->flags, h2c->nb_streams, h2c->nb_cs, fctl_cnt, send_cnt, tree_cnt, orph_cnt, h2c->dbuf->i, h2c->dbuf->size, h2c->mbuf->o, h2c->mbuf->size); + h2c->st0, h2c->flags, h2c->nb_streams, h2c->nb_cs, fctl_cnt, send_cnt, tree_cnt, orph_cnt, (unsigned int)h2c->dbuf->i, (unsigned int)h2c->dbuf->size, (unsigned int)h2c->mbuf->o, (unsigned int)h2c->mbuf->size); } /*******************************************************/ diff --git a/src/stream.c b/src/stream.c index 9fdf6621b..30bfc6721 100644 --- a/src/stream.c +++ b/src/stream.c @@ -2974,15 +2974,15 @@ static int stats_dump_full_strm_to_buffer(struct stream_interface *si, struct st chunk_appendf(&trash, " wex=%s\n" - " buf=%p data=%p o=%d p=%d req.next=%d i=%d size=%d\n", + " buf=%p data=%p o=%u p=%d req.next=%d i=%u size=%u\n", strm->req.wex ? human_time(TICKS_TO_MS(strm->req.wex - now_ms), TICKS_TO_MS(1000)) : "", strm->req.buf, - strm->req.buf->data, strm->req.buf->o, + strm->req.buf->data, (unsigned int)strm->req.buf->o, (int)(strm->req.buf->p - strm->req.buf->data), - strm->txn ? strm->txn->req.next : 0, strm->req.buf->i, - strm->req.buf->size); + strm->txn ? strm->txn->req.next : 0, (unsigned int)strm->req.buf->i, + (unsigned int)strm->req.buf->size); chunk_appendf(&trash, " res=%p (f=0x%06x an=0x%x pipe=%d tofwd=%d total=%lld)\n" @@ -3003,15 +3003,15 @@ static int stats_dump_full_strm_to_buffer(struct stream_interface *si, struct st chunk_appendf(&trash, " wex=%s\n" - " buf=%p data=%p o=%d p=%d rsp.next=%d i=%d size=%d\n", + " buf=%p data=%p o=%u p=%d rsp.next=%d i=%u size=%u\n", strm->res.wex ? human_time(TICKS_TO_MS(strm->res.wex - now_ms), TICKS_TO_MS(1000)) : "", strm->res.buf, - strm->res.buf->data, strm->res.buf->o, + strm->res.buf->data, (unsigned int)strm->res.buf->o, (int)(strm->res.buf->p - strm->res.buf->data), - strm->txn ? strm->txn->rsp.next : 0, strm->res.buf->i, - strm->res.buf->size); + strm->txn ? strm->txn->rsp.next : 0, (unsigned int)strm->res.buf->i, + (unsigned int)strm->res.buf->size); if (ci_putchk(si_ic(si), &trash) == -1) { si_applet_cant_put(si); @@ -3158,9 +3158,9 @@ static int cli_io_handler_dump_sess(struct appctx *appctx) curr_strm->task->calls); chunk_appendf(&trash, - " rq[f=%06xh,i=%d,an=%02xh,rx=%s", + " rq[f=%06xh,i=%u,an=%02xh,rx=%s", curr_strm->req.flags, - curr_strm->req.buf->i, + (unsigned int)curr_strm->req.buf->i, curr_strm->req.analysers, curr_strm->req.rex ? human_time(TICKS_TO_MS(curr_strm->req.rex - now_ms), @@ -3179,9 +3179,9 @@ static int cli_io_handler_dump_sess(struct appctx *appctx) TICKS_TO_MS(1000)) : ""); chunk_appendf(&trash, - " rp[f=%06xh,i=%d,an=%02xh,rx=%s", + " rp[f=%06xh,i=%u,an=%02xh,rx=%s", curr_strm->res.flags, - curr_strm->res.buf->i, + (unsigned int)curr_strm->res.buf->i, curr_strm->res.analysers, curr_strm->res.rex ? human_time(TICKS_TO_MS(curr_strm->res.rex - now_ms),