diff options
| author | James Raynard <jraynard@FreeBSD.org> | 1996-06-22 10:34:15 +0000 | 
|---|---|---|
| committer | James Raynard <jraynard@FreeBSD.org> | 1996-06-22 10:34:15 +0000 | 
| commit | ce51cf0392a0b2cc80e5ddcdb01394a303093443 (patch) | |
| tree | dabe76e239303cbaa8026d6b9fa85fe1b5845601 /lib/libc/stdio/vasprintf.c | |
| parent | 55c148f316e1e2bbc7ac656d7f89144dd9dc34c0 (diff) | |
Notes
Diffstat (limited to 'lib/libc/stdio/vasprintf.c')
| -rw-r--r-- | lib/libc/stdio/vasprintf.c | 12 | 
1 files changed, 7 insertions, 5 deletions
| diff --git a/lib/libc/stdio/vasprintf.c b/lib/libc/stdio/vasprintf.c index bec579a7a9de..09c89c29514f 100644 --- a/lib/libc/stdio/vasprintf.c +++ b/lib/libc/stdio/vasprintf.c @@ -24,7 +24,7 @@   */  #if defined(LIBC_RCS) && !defined(lint) -static char rcsid[] = "$Id$"; +static char rcsid[] = "$Id: vasprintf.c,v 1.1 1996/05/27 10:49:43 peter Exp $";  #endif /* LIBC_RCS and not lint */  #include <stdio.h> @@ -44,10 +44,12 @@ struct bufcookie {  	int	left;  }; +static int 	writehook __P((void *cookie, const char *, int)); +  static int  writehook(cookie, buf, len)  	void *cookie; -	char *buf; +	const char *buf;  	int   len;  {  	struct bufcookie *h = (struct bufcookie *)cookie; @@ -59,12 +61,12 @@ writehook(cookie, buf, len)  		/* grow malloc region */  		h->left = h->left + len + CHUNK_SPARE;  		h->size = h->size + len + CHUNK_SPARE; -		h->base = realloc(h->base, h->size); +		h->base = realloc(h->base, (size_t)h->size);  		if (h->base == NULL)  			return (-1);  	}  	/* "write" it */ -	(void)memcpy(h->base + h->size - h->left, buf, len); +	(void)memcpy(h->base + h->size - h->left, buf, (size_t)len);  	h->left -= len;  	return (0);  } @@ -101,7 +103,7 @@ vasprintf(str, fmt, ap)  		return (-1);  	h.base[h.size - h.left] = '\0'; -	*str = realloc(h.base, h.size - h.left + 1); +	*str = realloc(h.base, (size_t)(h.size - h.left + 1));  	if (*str == NULL)	/* failed to realloc it to actual size */  		return -1;  	return (ret); | 
