1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

use size_t for the data, but keep the protos use ssize_t to better fit

with the existing transfer.c code
This commit is contained in:
Daniel Stenberg 2004-03-04 15:25:06 +00:00
parent 78e47fbb5c
commit 1eb9fd6c4d
2 changed files with 10 additions and 6 deletions

View File

@ -100,14 +100,17 @@ void Curl_httpchunk_init(struct connectdata *conn)
*/ */
CHUNKcode Curl_httpchunk_read(struct connectdata *conn, CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
char *datap, char *datap,
ssize_t length, ssize_t datalen,
ssize_t *wrote) ssize_t *wrotep)
{ {
CURLcode result=CURLE_OK; CURLcode result=CURLE_OK;
struct Curl_chunker *ch = &conn->proto.http->chunk; struct Curl_chunker *ch = &conn->proto.http->chunk;
struct Curl_transfer_keeper *k = &conn->keep; struct Curl_transfer_keeper *k = &conn->keep;
int piece; size_t piece;
*wrote = 0; /* nothing yet */ size_t length = (size_t)datalen;
size_t *wrote = (size_t *)wrotep;
*wrote = 0; /* nothing's written yet */
while(length) { while(length) {
switch(ch->state) { switch(ch->state) {
@ -212,6 +215,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
if(result) if(result)
return CHUNKE_WRITE_ERROR; return CHUNKE_WRITE_ERROR;
*wrote += piece; *wrote += piece;
ch->datasize -= piece; /* decrease amount left to expect */ ch->datasize -= piece; /* decrease amount left to expect */

View File

@ -81,8 +81,8 @@ struct Curl_chunker {
char hexbuffer[ MAXNUM_SIZE + 1]; char hexbuffer[ MAXNUM_SIZE + 1];
int hexindex; int hexindex;
ChunkyState state; ChunkyState state;
ssize_t datasize; size_t datasize;
ssize_t dataleft; /* untouched data amount at the end of the last buffer */ size_t dataleft; /* untouched data amount at the end of the last buffer */
}; };
#endif #endif