mirror of https://github.com/moparisthebest/curl
use size_t for string lengths
This commit is contained in:
parent
22f4d81f3e
commit
93f96835f8
|
@ -39,14 +39,15 @@
|
||||||
static
|
static
|
||||||
char *appendstring(char *string, /* original string */
|
char *appendstring(char *string, /* original string */
|
||||||
char *buffer, /* to append */
|
char *buffer, /* to append */
|
||||||
int *stringlen, int *stralloc)
|
size_t *stringlen, /* length of string */
|
||||||
|
size_t *stralloc) /* allocated size */
|
||||||
{
|
{
|
||||||
int len = strlen(buffer);
|
size_t len = strlen(buffer);
|
||||||
int needed_len = len + *stringlen;
|
size_t needed_len = len + *stringlen;
|
||||||
|
|
||||||
if(needed_len >= *stralloc) {
|
if(needed_len >= *stralloc) {
|
||||||
char *newptr;
|
char *newptr;
|
||||||
long newsize = needed_len*2; /* get twice the needed size */
|
size_t newsize = needed_len*2; /* get twice the needed size */
|
||||||
|
|
||||||
newptr = realloc(string, newsize);
|
newptr = realloc(string, newsize);
|
||||||
if(newptr) {
|
if(newptr) {
|
||||||
|
@ -74,8 +75,8 @@ const char *spitout(FILE *stream,
|
||||||
char display = 0;
|
char display = 0;
|
||||||
|
|
||||||
char *string;
|
char *string;
|
||||||
int stringlen=0;
|
size_t stringlen=0;
|
||||||
int stralloc=256;
|
size_t stralloc=256;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
STATE_OUTSIDE,
|
STATE_OUTSIDE,
|
||||||
|
|
Loading…
Reference in New Issue