Loading lib/cookie.c +4 −4 Original line number Diff line number Diff line Loading @@ -115,8 +115,8 @@ free_cookiemess(struct Cookie *co) static bool tailmatch(const char *little, const char *bigone) { unsigned int littlelen = strlen(little); unsigned int biglen = strlen(bigone); size_t littlelen = strlen(little); size_t biglen = strlen(bigone); if(littlelen > biglen) return FALSE; Loading Loading @@ -192,7 +192,7 @@ Curl_cookie_add(struct SessionHandle *data, char *whatptr; /* Strip off trailing whitespace from the 'what' */ int len=strlen(what); size_t len=strlen(what); while(len && isspace((int)what[len-1])) { what[len-1]=0; len--; Loading Loading @@ -360,7 +360,7 @@ Curl_cookie_add(struct SessionHandle *data, /* no path was given in the header line, set the default now */ char *endslash = strrchr(path, '/'); if(endslash) { int pathlen = endslash-path+1; /* include the ending slash */ size_t pathlen = endslash-path+1; /* include the ending slash */ co->path=malloc(pathlen+1); /* one extra for the zero byte */ if(co->path) { memcpy(co->path, path, pathlen); Loading lib/formdata.c +22 −21 Original line number Diff line number Diff line Loading @@ -556,15 +556,16 @@ static const char * ContentTypeForFilename (const char *filename, * Returns 0 on success and 1 if the malloc failed. * ***************************************************************************/ static int AllocAndCopy (char **buffer, int buffer_length) static int AllocAndCopy(char **buffer, size_t buffer_length) { const char *src = *buffer; int length, add = 0; size_t length; bool add = FALSE; if (buffer_length) length = buffer_length; else { length = strlen(*buffer); add = 1; add = TRUE; } *buffer = (char*)malloc(length+add); if (!*buffer) Loading Loading @@ -1003,7 +1004,7 @@ CURLFORMcode curl_formadd(struct curl_httppost **httppost, static int AddFormData(struct FormData **formp, const void *line, long length) size_t length) { struct FormData *newform = (struct FormData *) malloc(sizeof(struct FormData)); Loading Loading @@ -1047,7 +1048,7 @@ char *Curl_FormBoundary(void) char *retstring; static int randomizer=0; /* this is just so that two boundaries within the same form won't be identical */ int i; size_t i; static char table16[]="abcdef0123456789"; Loading Loading @@ -1114,7 +1115,7 @@ void curl_formfree(struct curl_httppost *form) CURLcode Curl_getFormData(struct FormData **finalform, struct curl_httppost *post, int *sizep) size_t *sizep) { struct FormData *form = NULL; struct FormData *firstform; Loading Loading @@ -1232,7 +1233,7 @@ CURLcode Curl_getFormData(struct FormData **finalform, /* we should include the contents from the specified file */ FILE *fileread; char buffer[1024]; int nread; size_t nread; fileread = strequal("-", file->contents)?stdin: /* binary read for win32 crap */ Loading Loading @@ -1306,14 +1307,14 @@ int Curl_FormInit(struct Form *form, struct FormData *formdata ) } /* fread() emulation */ int Curl_FormReader(char *buffer, size_t Curl_FormReader(char *buffer, size_t size, size_t nitems, FILE *mydata) { struct Form *form; int wantedsize; int gotsize = 0; size_t wantedsize; size_t gotsize = 0; form=(struct Form *)mydata; Loading Loading @@ -1352,21 +1353,21 @@ int Curl_FormReader(char *buffer, } /* possible (old) fread() emulation that copies at most one line */ int Curl_FormReadOneLine(char *buffer, size_t Curl_FormReadOneLine(char *buffer, size_t size, size_t nitems, FILE *mydata) { struct Form *form; int wantedsize; int gotsize; size_t wantedsize; size_t gotsize; form=(struct Form *)mydata; wantedsize = size * nitems; if(!form->data) return -1; /* nothing, error, empty */ return 0; /* nothing, error, empty */ do { Loading Loading @@ -1443,7 +1444,7 @@ int main() int value6length = strlen(value5); int errors = 0; int size; int nread; size_t nread; char buffer[4096]; struct curl_httppost *httppost=NULL; struct curl_httppost *last_post=NULL; Loading lib/formdata.h +15 −18 Original line number Diff line number Diff line Loading @@ -27,28 +27,25 @@ struct FormData { struct FormData *next; char *line; long length; size_t length; }; struct Form { struct FormData *data; /* current form line to send */ int sent; /* number of bytes of the current line that has already unsigned int sent; /* number of bytes of the current line that has already been sent in a previous invoke */ }; /* used by FormAdd for temporary storage */ typedef struct FormInfo { char *name; long namelength; size_t namelength; char *value; long contentslength; size_t contentslength; char *contenttype; long flags; /* CMC: Added support for buffer uploads */ char *buffer; /* pointer to existing buffer used for file upload */ long bufferlength; size_t bufferlength; char *showfilename; /* The file name to show. If not set, the actual file name will be used */ struct curl_slist* contentheader; Loading @@ -60,16 +57,16 @@ int Curl_FormInit(struct Form *form, struct FormData *formdata ); CURLcode Curl_getFormData(struct FormData **, struct curl_httppost *post, int *size); size_t *size); /* fread() emulation */ int Curl_FormReader(char *buffer, size_t Curl_FormReader(char *buffer, size_t size, size_t nitems, FILE *mydata); /* possible (old) fread() emulation that copies at most one line */ int Curl_FormReadOneLine(char *buffer, size_t Curl_FormReadOneLine(char *buffer, size_t size, size_t nitems, FILE *mydata); Loading lib/ftp.c +3 −3 Original line number Diff line number Diff line Loading @@ -134,8 +134,8 @@ static CURLcode AllowServerConnect(struct connectdata *conn) struct SessionHandle *data = conn->data; int sock = conn->sock[SECONDARYSOCKET]; struct timeval now = Curl_tvnow(); int timespent = Curl_tvdiff(Curl_tvnow(), now)/1000; int timeout = data->set.connecttimeout?data->set.connecttimeout: long timespent = Curl_tvdiff(Curl_tvnow(), now)/1000; long timeout = data->set.connecttimeout?data->set.connecttimeout: (data->set.timeout?data->set.timeout: 0); FD_ZERO(&rdset); Loading Loading @@ -1347,7 +1347,7 @@ CURLcode ftp_use_port(struct connectdata *conn) rc = Curl_wait_for_resolv(conn, &h); } else { int len = strlen(data->set.ftpport); size_t len = strlen(data->set.ftpport); if(len>1) { rc = Curl_resolv(conn, data->set.ftpport, 0, &h); if(rc == 1) Loading lib/http.c +19 −19 Original line number Diff line number Diff line Loading @@ -440,14 +440,14 @@ CURLcode Curl_http_auth(struct connectdata *conn, /* fread() emulation to provide POST and/or request data */ static int readmoredata(char *buffer, static size_t readmoredata(char *buffer, size_t size, size_t nitems, void *userp) { struct connectdata *conn = (struct connectdata *)userp; struct HTTP *http = conn->proto.http; int fullsize = size * nitems; size_t fullsize = size * nitems; if(0 == http->postsize) /* nothing to return */ Loading Loading @@ -528,9 +528,9 @@ CURLcode add_buffer_send(send_buffer *in, ssize_t amount; CURLcode res; char *ptr; int size; size_t size; struct HTTP *http = conn->proto.http; int sendsize; size_t sendsize; int sockfd = conn->sock[FIRSTSOCKET]; /* The looping below is required since we use non-blocking sockets, but due Loading Loading @@ -570,7 +570,7 @@ CURLcode add_buffer_send(send_buffer *in, *bytes_written += amount; if(amount != size) { if((size_t)amount != size) { /* The whole request could not be sent in one system call. We must queue it up and send it later when we get the chance. We must not loop here and wait until it might work again. */ Loading Loading @@ -639,7 +639,7 @@ static CURLcode add_buffer(send_buffer *in, const void *inptr, size_t size) { char *new_rb; int new_size; size_t new_size; if(!in->buffer || ((in->size_used + size) > (in->size_max - 1))) { Loading Loading @@ -744,7 +744,7 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn, bool keepon=TRUE; ssize_t gotbytes; char *ptr; int timeout = 3600; /* default timeout in seconds */ long timeout = 3600; /* default timeout in seconds */ struct timeval interval; fd_set rkeepfd; fd_set readfd; Loading Loading @@ -1164,7 +1164,7 @@ CURLcode Curl_http(struct connectdata *conn) ptr++; if(ptr != start) { int len=ptr-start; size_t len=ptr-start; conn->allocptr.cookiehost = malloc(len+1); if(!conn->allocptr.cookiehost) return CURLE_OUT_OF_MEMORY; Loading Loading @@ -1260,8 +1260,8 @@ CURLcode Curl_http(struct connectdata *conn) input. If we knew it was a proper file we could've just fseek()ed but we only have a stream here */ do { curl_off_t readthisamountnow = (conn->resume_from - passed); curl_off_t actuallyread; size_t readthisamountnow = (conn->resume_from - passed); size_t actuallyread; if(readthisamountnow > BUFSIZE) readthisamountnow = BUFSIZE; Loading Loading @@ -1509,12 +1509,12 @@ CURLcode Curl_http(struct connectdata *conn) work, but we support it anyway. */ char contentType[256]; int linelength=0; size_t linelength=0; linelength = Curl_FormReadOneLine(contentType, sizeof(contentType), 1, (FILE *)&http->form); if(linelength == -1) { if(!linelength) { failf(data, "Could not get Content-Type header line!"); return CURLE_HTTP_POST_ERROR; } Loading Loading
lib/cookie.c +4 −4 Original line number Diff line number Diff line Loading @@ -115,8 +115,8 @@ free_cookiemess(struct Cookie *co) static bool tailmatch(const char *little, const char *bigone) { unsigned int littlelen = strlen(little); unsigned int biglen = strlen(bigone); size_t littlelen = strlen(little); size_t biglen = strlen(bigone); if(littlelen > biglen) return FALSE; Loading Loading @@ -192,7 +192,7 @@ Curl_cookie_add(struct SessionHandle *data, char *whatptr; /* Strip off trailing whitespace from the 'what' */ int len=strlen(what); size_t len=strlen(what); while(len && isspace((int)what[len-1])) { what[len-1]=0; len--; Loading Loading @@ -360,7 +360,7 @@ Curl_cookie_add(struct SessionHandle *data, /* no path was given in the header line, set the default now */ char *endslash = strrchr(path, '/'); if(endslash) { int pathlen = endslash-path+1; /* include the ending slash */ size_t pathlen = endslash-path+1; /* include the ending slash */ co->path=malloc(pathlen+1); /* one extra for the zero byte */ if(co->path) { memcpy(co->path, path, pathlen); Loading
lib/formdata.c +22 −21 Original line number Diff line number Diff line Loading @@ -556,15 +556,16 @@ static const char * ContentTypeForFilename (const char *filename, * Returns 0 on success and 1 if the malloc failed. * ***************************************************************************/ static int AllocAndCopy (char **buffer, int buffer_length) static int AllocAndCopy(char **buffer, size_t buffer_length) { const char *src = *buffer; int length, add = 0; size_t length; bool add = FALSE; if (buffer_length) length = buffer_length; else { length = strlen(*buffer); add = 1; add = TRUE; } *buffer = (char*)malloc(length+add); if (!*buffer) Loading Loading @@ -1003,7 +1004,7 @@ CURLFORMcode curl_formadd(struct curl_httppost **httppost, static int AddFormData(struct FormData **formp, const void *line, long length) size_t length) { struct FormData *newform = (struct FormData *) malloc(sizeof(struct FormData)); Loading Loading @@ -1047,7 +1048,7 @@ char *Curl_FormBoundary(void) char *retstring; static int randomizer=0; /* this is just so that two boundaries within the same form won't be identical */ int i; size_t i; static char table16[]="abcdef0123456789"; Loading Loading @@ -1114,7 +1115,7 @@ void curl_formfree(struct curl_httppost *form) CURLcode Curl_getFormData(struct FormData **finalform, struct curl_httppost *post, int *sizep) size_t *sizep) { struct FormData *form = NULL; struct FormData *firstform; Loading Loading @@ -1232,7 +1233,7 @@ CURLcode Curl_getFormData(struct FormData **finalform, /* we should include the contents from the specified file */ FILE *fileread; char buffer[1024]; int nread; size_t nread; fileread = strequal("-", file->contents)?stdin: /* binary read for win32 crap */ Loading Loading @@ -1306,14 +1307,14 @@ int Curl_FormInit(struct Form *form, struct FormData *formdata ) } /* fread() emulation */ int Curl_FormReader(char *buffer, size_t Curl_FormReader(char *buffer, size_t size, size_t nitems, FILE *mydata) { struct Form *form; int wantedsize; int gotsize = 0; size_t wantedsize; size_t gotsize = 0; form=(struct Form *)mydata; Loading Loading @@ -1352,21 +1353,21 @@ int Curl_FormReader(char *buffer, } /* possible (old) fread() emulation that copies at most one line */ int Curl_FormReadOneLine(char *buffer, size_t Curl_FormReadOneLine(char *buffer, size_t size, size_t nitems, FILE *mydata) { struct Form *form; int wantedsize; int gotsize; size_t wantedsize; size_t gotsize; form=(struct Form *)mydata; wantedsize = size * nitems; if(!form->data) return -1; /* nothing, error, empty */ return 0; /* nothing, error, empty */ do { Loading Loading @@ -1443,7 +1444,7 @@ int main() int value6length = strlen(value5); int errors = 0; int size; int nread; size_t nread; char buffer[4096]; struct curl_httppost *httppost=NULL; struct curl_httppost *last_post=NULL; Loading
lib/formdata.h +15 −18 Original line number Diff line number Diff line Loading @@ -27,28 +27,25 @@ struct FormData { struct FormData *next; char *line; long length; size_t length; }; struct Form { struct FormData *data; /* current form line to send */ int sent; /* number of bytes of the current line that has already unsigned int sent; /* number of bytes of the current line that has already been sent in a previous invoke */ }; /* used by FormAdd for temporary storage */ typedef struct FormInfo { char *name; long namelength; size_t namelength; char *value; long contentslength; size_t contentslength; char *contenttype; long flags; /* CMC: Added support for buffer uploads */ char *buffer; /* pointer to existing buffer used for file upload */ long bufferlength; size_t bufferlength; char *showfilename; /* The file name to show. If not set, the actual file name will be used */ struct curl_slist* contentheader; Loading @@ -60,16 +57,16 @@ int Curl_FormInit(struct Form *form, struct FormData *formdata ); CURLcode Curl_getFormData(struct FormData **, struct curl_httppost *post, int *size); size_t *size); /* fread() emulation */ int Curl_FormReader(char *buffer, size_t Curl_FormReader(char *buffer, size_t size, size_t nitems, FILE *mydata); /* possible (old) fread() emulation that copies at most one line */ int Curl_FormReadOneLine(char *buffer, size_t Curl_FormReadOneLine(char *buffer, size_t size, size_t nitems, FILE *mydata); Loading
lib/ftp.c +3 −3 Original line number Diff line number Diff line Loading @@ -134,8 +134,8 @@ static CURLcode AllowServerConnect(struct connectdata *conn) struct SessionHandle *data = conn->data; int sock = conn->sock[SECONDARYSOCKET]; struct timeval now = Curl_tvnow(); int timespent = Curl_tvdiff(Curl_tvnow(), now)/1000; int timeout = data->set.connecttimeout?data->set.connecttimeout: long timespent = Curl_tvdiff(Curl_tvnow(), now)/1000; long timeout = data->set.connecttimeout?data->set.connecttimeout: (data->set.timeout?data->set.timeout: 0); FD_ZERO(&rdset); Loading Loading @@ -1347,7 +1347,7 @@ CURLcode ftp_use_port(struct connectdata *conn) rc = Curl_wait_for_resolv(conn, &h); } else { int len = strlen(data->set.ftpport); size_t len = strlen(data->set.ftpport); if(len>1) { rc = Curl_resolv(conn, data->set.ftpport, 0, &h); if(rc == 1) Loading
lib/http.c +19 −19 Original line number Diff line number Diff line Loading @@ -440,14 +440,14 @@ CURLcode Curl_http_auth(struct connectdata *conn, /* fread() emulation to provide POST and/or request data */ static int readmoredata(char *buffer, static size_t readmoredata(char *buffer, size_t size, size_t nitems, void *userp) { struct connectdata *conn = (struct connectdata *)userp; struct HTTP *http = conn->proto.http; int fullsize = size * nitems; size_t fullsize = size * nitems; if(0 == http->postsize) /* nothing to return */ Loading Loading @@ -528,9 +528,9 @@ CURLcode add_buffer_send(send_buffer *in, ssize_t amount; CURLcode res; char *ptr; int size; size_t size; struct HTTP *http = conn->proto.http; int sendsize; size_t sendsize; int sockfd = conn->sock[FIRSTSOCKET]; /* The looping below is required since we use non-blocking sockets, but due Loading Loading @@ -570,7 +570,7 @@ CURLcode add_buffer_send(send_buffer *in, *bytes_written += amount; if(amount != size) { if((size_t)amount != size) { /* The whole request could not be sent in one system call. We must queue it up and send it later when we get the chance. We must not loop here and wait until it might work again. */ Loading Loading @@ -639,7 +639,7 @@ static CURLcode add_buffer(send_buffer *in, const void *inptr, size_t size) { char *new_rb; int new_size; size_t new_size; if(!in->buffer || ((in->size_used + size) > (in->size_max - 1))) { Loading Loading @@ -744,7 +744,7 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn, bool keepon=TRUE; ssize_t gotbytes; char *ptr; int timeout = 3600; /* default timeout in seconds */ long timeout = 3600; /* default timeout in seconds */ struct timeval interval; fd_set rkeepfd; fd_set readfd; Loading Loading @@ -1164,7 +1164,7 @@ CURLcode Curl_http(struct connectdata *conn) ptr++; if(ptr != start) { int len=ptr-start; size_t len=ptr-start; conn->allocptr.cookiehost = malloc(len+1); if(!conn->allocptr.cookiehost) return CURLE_OUT_OF_MEMORY; Loading Loading @@ -1260,8 +1260,8 @@ CURLcode Curl_http(struct connectdata *conn) input. If we knew it was a proper file we could've just fseek()ed but we only have a stream here */ do { curl_off_t readthisamountnow = (conn->resume_from - passed); curl_off_t actuallyread; size_t readthisamountnow = (conn->resume_from - passed); size_t actuallyread; if(readthisamountnow > BUFSIZE) readthisamountnow = BUFSIZE; Loading Loading @@ -1509,12 +1509,12 @@ CURLcode Curl_http(struct connectdata *conn) work, but we support it anyway. */ char contentType[256]; int linelength=0; size_t linelength=0; linelength = Curl_FormReadOneLine(contentType, sizeof(contentType), 1, (FILE *)&http->form); if(linelength == -1) { if(!linelength) { failf(data, "Could not get Content-Type header line!"); return CURLE_HTTP_POST_ERROR; } Loading