/* copies chunk <src> into <chk>. Returns 0 in case of failure. */
static inline int chunk_cpy(struct buffer *chk, const struct buffer *src)
{
- if (unlikely(src->data >= chk->size))
+ if (unlikely(src->data > chk->size))
return 0;
chk->data = src->data;
/* appends chunk <src> after <chk>. Returns 0 in case of failure. */
static inline int chunk_cat(struct buffer *chk, const struct buffer *src)
{
- if (unlikely(chk->data + src->data >= chk->size))
+ if (unlikely(chk->data + src->data > chk->size))
return 0;
memcpy(chk->area + chk->data, src->area, src->data);
static inline int chunk_memcpy(struct buffer *chk, const char *src,
size_t len)
{
- if (unlikely(len >= chk->size))
+ if (unlikely(len > chk->size))
return 0;
chk->data = len;
static inline int chunk_memcat(struct buffer *chk, const char *src,
size_t len)
{
- if (unlikely(chk->data + len >= chk->size))
+ if (unlikely(chk->data + len > chk->size))
return 0;
memcpy(chk->area + chk->data, src, len);