Commit 8511c372 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp Committed by Dridi Boukelmoune

Fix trouble with 2GB+ VSB's on systems where int is 32 bit but

size_t is 64 bit.
parent b894a8d8
......@@ -51,8 +51,8 @@ __FBSDID("$FreeBSD: head/sys/kern/subr_vsb.c 222004 2011-05-17 06:36:32Z phk $")
*/
#define VSB_ISDYNAMIC(s) ((s)->s_flags & VSB_DYNAMIC)
#define VSB_ISDYNSTRUCT(s) ((s)->s_flags & VSB_DYNSTRUCT)
#define VSB_HASROOM(s) ((s)->s_len < (s)->s_size - 1)
#define VSB_FREESPACE(s) ((s)->s_size - ((s)->s_len + 1))
#define VSB_HASROOM(s) ((s)->s_len < (s)->s_size - 1L)
#define VSB_FREESPACE(s) ((s)->s_size - ((s)->s_len + 1L))
#define VSB_CANEXTEND(s) ((s)->s_flags & VSB_AUTOEXTEND)
/*
......@@ -114,10 +114,10 @@ CTASSERT(powerof2(VSB_MAXEXTENDSIZE));
CTASSERT(powerof2(VSB_MAXEXTENDINCR));
#endif
static int
VSB_extendsize(int size)
static ssize_t
VSB_extendsize(ssize_t size)
{
int newsize;
ssize_t newsize;
if (size < (int)VSB_MAXEXTENDSIZE) {
newsize = VSB_MINEXTENDSIZE;
......@@ -133,11 +133,11 @@ VSB_extendsize(int size)
/*
* Extend an vsb.
*/
static int
VSB_extend(struct vsb *s, int addlen)
static ssize_t
VSB_extend(struct vsb *s, ssize_t addlen)
{
char *newbuf;
int newsize;
ssize_t newsize;
if (!VSB_CANEXTEND(s))
return (-1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment