Use the newly available functions instead of using the buffer fields directly.
if (len)
memcpy(pos, str, len);
- b->i += delta;
+ b_add(b, delta);
b_realign_if_empty(b);
return delta;
pos[len + 1] = '\n';
}
- b->i += delta;
+ b_add(b, delta);
return delta;
}
si_applet_cant_put(si);
goto out;
}
- res->buf->i += len;
+ b_add(res->buf, len);
res->total += len;
appctx->st0 = HTTP_CACHE_FWD;
}
if (len > max)
return max;
- memcpy(chn->buf->p, msg, len);
- chn->buf->o += len;
- chn->buf->p = c_ptr(chn, len);
+ memcpy(b_tail(chn->buf), msg, len);
+ b_add(chn->buf, len);
+ c_adv(chn, len);
chn->total += len;
return -1;
}
if (len > max)
memcpy(b_orig(chn->buf), blk + max, len - max);
- chn->buf->i += len;
+ b_add(chn->buf, len);
chn->total += len;
if (chn->to_forward) {
unsigned long fwd = len;
memcpy(out_data, in_data, in_len);
- out->i += in_len;
+ b_add(out, in_len);
return in_len;
}
}
b_reset(tmpbuf);
memcpy(b_tail(tmpbuf), comp_ctx->direct_ptr, comp_ctx->direct_len);
- tmpbuf->i += comp_ctx->direct_len;
+ b_add(tmpbuf, comp_ctx->direct_len);
comp_ctx->direct_ptr = NULL;
comp_ctx->direct_len = 0;
comp_ctx->queued = tmpbuf;
if (comp_ctx->queued) {
/* data already pending */
memcpy(b_tail(comp_ctx->queued), in_data, in_len);
- comp_ctx->queued->i += in_len;
+ b_add(comp_ctx->queued, in_len);
return in_len;
}
out_len = out->i;
if (in_ptr)
- out->i += slz_encode(strm, b_tail(out), in_ptr, in_len, !finish);
+ b_add(out, slz_encode(strm, b_tail(out), in_ptr, in_len, !finish));
if (finish)
- out->i += slz_finish(strm, b_tail(out));
+ b_add(out, slz_finish(strm, b_tail(out)));
out_len = out->i - out_len;
return -1;
/* deflate update the available data out */
- out->i += out_len - strm->avail_out;
+ b_add(out, out_len - strm->avail_out);
return in_len - strm->avail_in;
}
return -1;
out_len = b_room(out) - strm->avail_out;
- out->i += out_len;
+ b_add(out, out_len);
/* compression limit */
if ((global.comp_rate_lim > 0 && (read_freq_ctr(&global.comp_bps_out) > global.comp_rate_lim)) || /* rate */
memcpy(b_tail(tmpbuf)+block, buf->data, len-block);
c_rew(chn, *nxt);
- tmpbuf->i += len;
+ b_add(tmpbuf, len);
ret = len;
}
else {
if (ib->i > 0) {
left = ci_contig_data(chn);
memcpy(ob->p + ob->i, ci_head(chn), left);
- ob->i += left;
+ b_add(ob, left);
if (ib->i - left) {
memcpy(ob->p + ob->i, ib->data, ib->i - left);
- ob->i += ib->i - left;
+ b_add(ob, ib->i - left);
}
}
/* now consume the input data */
b_del(h2c->dbuf, h2c->dfl);
h2c->st0 = H2_CS_FRAME_H;
- buf->i += outlen;
+ b_add(buf, outlen);
/* don't send it before returning data!
* FIXME: should we instead try to send it much later, after the
/* commit the H2 response */
h2c->mbuf->p = b_peek(h2c->mbuf, h2c->mbuf->o + outbuf.len);
- h2c->mbuf->o += outbuf.len;
+ bo_add(h2c->mbuf, outbuf.len);
h2s->flags |= H2_SF_HEADERS_SENT;
/* for now we don't implemented CONTINUATION, so we wait for a
/* commit the H2 response */
h2c->mbuf->p = b_peek(h2c->mbuf, h2c->mbuf->o + size + 9);
- h2c->mbuf->o += size + 9;
+ bo_add(h2c->mbuf, size + 9);
/* consume incoming H1 response */
if (size > 0) {
ret = recv(conn->handle.fd, b_tail(buf), try, 0);
if (ret > 0) {
- buf->i += ret;
+ b_add(buf, ret);
done += ret;
if (ret < try) {
/* unfortunately, on level-triggered events, POLL_HUP
done++;
try--;
count--;
- buf->i++;
+ b_add(buf, 1);
conn->tmp_early_data = -1;
continue;
}
goto out_error;
}
if (ret > 0) {
- buf->i += ret;
+ b_add(buf, ret);
done += ret;
count -= ret;
}