mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 05:41:26 +02:00
MINOR: buffer: make b_getblk_nc() take size_t for the block sizes
Till now we used to reimplement it using ints to limit external changes but we must adjust it and the various users to switch to size_t.
This commit is contained in:
parent
206ba834ef
commit
55f3ce1c91
@ -352,7 +352,7 @@ static inline size_t b_getblk(const struct buffer *buf, char *blk, size_t len, s
|
||||
* =0 : not enough data available. <blk*> are left undefined.
|
||||
* The buffer is left unaffected. Unused buffers are left in an undefined state.
|
||||
*/
|
||||
static inline size_t b_getblk_nc(const struct buffer *buf, const char **blk1, int *len1, const char **blk2, int *len2, size_t ofs, size_t max)
|
||||
static inline size_t b_getblk_nc(const struct buffer *buf, const char **blk1, size_t *len1, const char **blk2, size_t *len2, size_t ofs, size_t max)
|
||||
{
|
||||
size_t l1;
|
||||
|
||||
|
@ -48,13 +48,13 @@ unsigned long long __channel_forward(struct channel *chn, unsigned long long byt
|
||||
int ci_putblk(struct channel *chn, const char *str, int len);
|
||||
struct buffer *ci_swpbuf(struct channel *chn, struct buffer *buf);
|
||||
int ci_putchr(struct channel *chn, char c);
|
||||
int ci_getline_nc(const struct channel *chn, char **blk1, int *len1, char **blk2, int *len2);
|
||||
int ci_getblk_nc(const struct channel *chn, char **blk1, int *len1, char **blk2, int *len2);
|
||||
int ci_getline_nc(const struct channel *chn, char **blk1, size_t *len1, char **blk2, size_t *len2);
|
||||
int ci_getblk_nc(const struct channel *chn, char **blk1, size_t *len1, char **blk2, size_t *len2);
|
||||
int co_inject(struct channel *chn, const char *msg, int len);
|
||||
int co_getline(const struct channel *chn, char *str, int len);
|
||||
int co_getblk(const struct channel *chn, char *blk, int len, int offset);
|
||||
int co_getline_nc(const struct channel *chn, const char **blk1, int *len1, const char **blk2, int *len2);
|
||||
int co_getblk_nc(const struct channel *chn, const char **blk1, int *len1, const char **blk2, int *len2);
|
||||
int co_getline_nc(const struct channel *chn, const char **blk1, size_t *len1, const char **blk2, size_t *len2);
|
||||
int co_getblk_nc(const struct channel *chn, const char **blk1, size_t *len1, const char **blk2, size_t *len2);
|
||||
|
||||
|
||||
/* returns a pointer to the stream the channel belongs to */
|
||||
|
@ -312,7 +312,7 @@ int co_getblk(const struct channel *chn, char *blk, int len, int offset)
|
||||
* The channel status is not changed. The caller must call co_skip() to
|
||||
* update it. Unused buffers are left in an undefined state.
|
||||
*/
|
||||
int co_getblk_nc(const struct channel *chn, const char **blk1, int *len1, const char **blk2, int *len2)
|
||||
int co_getblk_nc(const struct channel *chn, const char **blk1, size_t *len1, const char **blk2, size_t *len2)
|
||||
{
|
||||
if (unlikely(chn->buf->o == 0)) {
|
||||
if (chn->flags & CF_SHUTW)
|
||||
@ -333,8 +333,8 @@ int co_getblk_nc(const struct channel *chn, const char **blk1, int *len1, const
|
||||
* the '\n'. Unused buffers are left in an undefined state.
|
||||
*/
|
||||
int co_getline_nc(const struct channel *chn,
|
||||
const char **blk1, int *len1,
|
||||
const char **blk2, int *len2)
|
||||
const char **blk1, size_t *len1,
|
||||
const char **blk2, size_t *len2)
|
||||
{
|
||||
int retcode;
|
||||
int l;
|
||||
@ -377,8 +377,8 @@ int co_getline_nc(const struct channel *chn,
|
||||
* <0 : no more bytes readable because input is shut.
|
||||
*/
|
||||
int ci_getblk_nc(const struct channel *chn,
|
||||
char **blk1, int *len1,
|
||||
char **blk2, int *len2)
|
||||
char **blk1, size_t *len1,
|
||||
char **blk2, size_t *len2)
|
||||
{
|
||||
if (unlikely(chn->buf->i == 0)) {
|
||||
if (chn->flags & CF_SHUTR)
|
||||
@ -409,8 +409,8 @@ int ci_getblk_nc(const struct channel *chn,
|
||||
* the '\n'. Unused buffers are left in an undefined state.
|
||||
*/
|
||||
int ci_getline_nc(const struct channel *chn,
|
||||
char **blk1, int *len1,
|
||||
char **blk2, int *len2)
|
||||
char **blk1, size_t *len1,
|
||||
char **blk2, size_t *len2)
|
||||
{
|
||||
int retcode;
|
||||
int l;
|
||||
|
38
src/hlua.c
38
src/hlua.c
@ -1736,12 +1736,12 @@ __LJMP static int hlua_socket_receive_yield(struct lua_State *L, int status, lua
|
||||
int wanted = lua_tointeger(L, 2);
|
||||
struct hlua *hlua = hlua_gethlua(L);
|
||||
struct appctx *appctx;
|
||||
int len;
|
||||
size_t len;
|
||||
int nblk;
|
||||
const char *blk1;
|
||||
int len1;
|
||||
size_t len1;
|
||||
const char *blk2;
|
||||
int len2;
|
||||
size_t len2;
|
||||
int skip_at_end = 0;
|
||||
struct channel *oc;
|
||||
struct stream_interface *si;
|
||||
@ -2774,8 +2774,8 @@ static inline int _hlua_channel_dup(struct channel *chn, lua_State *L)
|
||||
{
|
||||
char *blk1;
|
||||
char *blk2;
|
||||
int len1;
|
||||
int len2;
|
||||
size_t len1;
|
||||
size_t len2;
|
||||
int ret;
|
||||
luaL_Buffer b;
|
||||
|
||||
@ -2862,9 +2862,9 @@ __LJMP static int hlua_channel_getline_yield(lua_State *L, int status, lua_KCont
|
||||
{
|
||||
char *blk1;
|
||||
char *blk2;
|
||||
int len1;
|
||||
int len2;
|
||||
int len;
|
||||
size_t len1;
|
||||
size_t len2;
|
||||
size_t len;
|
||||
struct channel *chn;
|
||||
int ret;
|
||||
luaL_Buffer b;
|
||||
@ -3634,9 +3634,9 @@ __LJMP static int hlua_applet_tcp_getline_yield(lua_State *L, int status, lua_KC
|
||||
struct stream_interface *si = appctx->appctx->owner;
|
||||
int ret;
|
||||
const char *blk1;
|
||||
int len1;
|
||||
size_t len1;
|
||||
const char *blk2;
|
||||
int len2;
|
||||
size_t len2;
|
||||
|
||||
/* Read the maximum amount of data avalaible. */
|
||||
ret = co_getline_nc(si_oc(si), &blk1, &len1, &blk2, &len2);
|
||||
@ -3686,12 +3686,12 @@ __LJMP static int hlua_applet_tcp_recv_yield(lua_State *L, int status, lua_KCont
|
||||
{
|
||||
struct hlua_appctx *appctx = MAY_LJMP(hlua_checkapplet_tcp(L, 1));
|
||||
struct stream_interface *si = appctx->appctx->owner;
|
||||
int len = MAY_LJMP(luaL_checkinteger(L, 2));
|
||||
size_t len = MAY_LJMP(luaL_checkinteger(L, 2));
|
||||
int ret;
|
||||
const char *blk1;
|
||||
int len1;
|
||||
size_t len1;
|
||||
const char *blk2;
|
||||
int len2;
|
||||
size_t len2;
|
||||
|
||||
/* Read the maximum amount of data avalaible. */
|
||||
ret = co_getblk_nc(si_oc(si), &blk1, &len1, &blk2, &len2);
|
||||
@ -4097,9 +4097,9 @@ __LJMP static int hlua_applet_http_getline_yield(lua_State *L, int status, lua_K
|
||||
struct channel *chn = si_ic(si);
|
||||
int ret;
|
||||
const char *blk1;
|
||||
int len1;
|
||||
size_t len1;
|
||||
const char *blk2;
|
||||
int len2;
|
||||
size_t len2;
|
||||
|
||||
/* Maybe we cant send a 100-continue ? */
|
||||
if (appctx->appctx->ctx.hlua_apphttp.flags & APPLET_100C) {
|
||||
@ -4183,9 +4183,9 @@ __LJMP static int hlua_applet_http_recv_yield(lua_State *L, int status, lua_KCon
|
||||
struct channel *chn = si_ic(si);
|
||||
int ret;
|
||||
const char *blk1;
|
||||
int len1;
|
||||
size_t len1;
|
||||
const char *blk2;
|
||||
int len2;
|
||||
size_t len2;
|
||||
|
||||
/* Maybe we cant send a 100-continue ? */
|
||||
if (appctx->appctx->ctx.hlua_apphttp.flags & APPLET_100C) {
|
||||
@ -6627,9 +6627,9 @@ static void hlua_applet_http_fct(struct appctx *ctx)
|
||||
struct proxy *px = strm->be;
|
||||
struct hlua *hlua = ctx->ctx.hlua_apphttp.hlua;
|
||||
const char *blk1;
|
||||
int len1;
|
||||
size_t len1;
|
||||
const char *blk2;
|
||||
int len2;
|
||||
size_t len2;
|
||||
int ret;
|
||||
|
||||
/* If the stream is disconnect or closed, ldo nothing. */
|
||||
|
@ -3128,7 +3128,7 @@ static size_t h2s_frt_make_resp_data(struct h2s *h2s, const struct buffer *buf,
|
||||
int es_now = 0;
|
||||
int size = 0;
|
||||
const char *blk1, *blk2;
|
||||
int len1, len2;
|
||||
size_t len1, len2;
|
||||
|
||||
if (h2c_mux_busy(h2c, h2s)) {
|
||||
h2s->flags |= H2_SF_BLK_MBUSY;
|
||||
|
Loading…
x
Reference in New Issue
Block a user