diff options
-rw-r--r-- | lib/config-amigaos.h | 2 | ||||
-rw-r--r-- | lib/dict.c | 2 | ||||
-rw-r--r-- | lib/easy.c | 6 | ||||
-rw-r--r-- | lib/file.c | 4 | ||||
-rw-r--r-- | lib/ftp.c | 24 | ||||
-rw-r--r-- | lib/http.c | 9 | ||||
-rw-r--r-- | lib/mprintf.c | 7 | ||||
-rw-r--r-- | lib/setup.h | 17 | ||||
-rw-r--r-- | lib/strtoofft.h | 13 | ||||
-rw-r--r-- | lib/transfer.c | 12 | ||||
-rw-r--r-- | lib/transfer.h | 6 | ||||
-rw-r--r-- | lib/url.c | 6 | ||||
-rw-r--r-- | lib/urldata.h | 40 |
13 files changed, 67 insertions, 81 deletions
diff --git a/lib/config-amigaos.h b/lib/config-amigaos.h index f0fa83e2f..5d617fe16 100644 --- a/lib/config-amigaos.h +++ b/lib/config-amigaos.h @@ -69,7 +69,7 @@ #define SELECT_TYPE_ARG1 int #define SELECT_TYPE_ARG234 (fd_set *) #define SELECT_TYPE_ARG5 (struct timeval *) -#define SIZEOF_OFF_T 4 +#define SIZEOF_CURL_OFF_T 4 #define STDC_HEADERS 1 #define TIME_WITH_SYS_TIME 1 diff --git a/lib/dict.c b/lib/dict.c index af3298327..62d629821 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -92,7 +92,7 @@ CURLcode Curl_dict(struct connectdata *conn) int sockfd = conn->sock[FIRSTSOCKET]; char *path = conn->path; - off_t *bytecount = &conn->bytecount; + curl_off_t *bytecount = &conn->bytecount; if(conn->bits.user_passwd) { /* AUTH is missing */ diff --git a/lib/easy.c b/lib/easy.c index ce83238d6..5ecd10575 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -211,7 +211,7 @@ CURLcode curl_easy_setopt(CURL *curl, CURLoption tag, ...) func_T param_func = (func_T)0; long param_long = 0; void *param_obj = NULL; - off_t param_offset = 0; + curl_off_t param_offset = 0; struct SessionHandle *data = curl; CURLcode ret=CURLE_FAILED_INIT; @@ -239,8 +239,8 @@ CURLcode curl_easy_setopt(CURL *curl, CURLoption tag, ...) param_func = va_arg(arg, func_T ); ret = Curl_setopt(data, tag, param_func); } else { - /* This is an off_t type */ - param_offset = va_arg(arg, off_t); + /* This is a curl_off_t type */ + param_offset = va_arg(arg, curl_off_t); ret = Curl_setopt(data, tag, param_offset); } diff --git a/lib/file.c b/lib/file.c index 93b7977e2..2bf544add 100644 --- a/lib/file.c +++ b/lib/file.c @@ -163,12 +163,12 @@ CURLcode Curl_file(struct connectdata *conn) */ CURLcode res = CURLE_OK; struct stat statbuf; - off_t expected_size=0; + curl_off_t expected_size=0; bool fstated=FALSE; ssize_t nread; struct SessionHandle *data = conn->data; char *buf = data->state.buffer; - off_t bytecount = 0; + curl_off_t bytecount = 0; struct timeval start = Curl_tvnow(); struct timeval now = start; int fd; @@ -921,7 +921,7 @@ static CURLcode ftp_transfertype(struct connectdata *conn, static CURLcode ftp_getsize(struct connectdata *conn, char *file, - off_t *size) + curl_off_t *size) { struct SessionHandle *data = conn->data; int ftpcode; @@ -1660,7 +1660,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn) /* the ftp struct is already inited in Curl_ftp_connect() */ struct FTP *ftp = conn->proto.ftp; - off_t *bytecountp = ftp->bytecountp; + curl_off_t *bytecountp = ftp->bytecountp; if(data->set.upload) { @@ -1692,7 +1692,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn) if(conn->resume_from < 0 ) { /* we could've got a specified offset from the command line, but now we know we didn't */ - off_t gottensize; + curl_off_t gottensize; if(CURLE_OK != ftp_getsize(conn, ftp->file, &gottensize)) { failf(data, "Couldn't get remote file size"); @@ -1703,7 +1703,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn) if(conn->resume_from) { /* do we still game? */ - off_t passed=0; + curl_off_t passed=0; /* enable append instead */ data->set.ftp_append = 1; @@ -1711,8 +1711,8 @@ CURLcode Curl_ftp_nextconnect(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 { - off_t readthisamountnow = (conn->resume_from - passed); - off_t actuallyread; + curl_off_t readthisamountnow = (conn->resume_from - passed); + curl_off_t actuallyread; if(readthisamountnow > BUFSIZE) readthisamountnow = BUFSIZE; @@ -1802,11 +1802,11 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn) else if(!data->set.no_body) { /* Retrieve file or directory */ bool dirlist=FALSE; - off_t downloadsize=-1; + curl_off_t downloadsize=-1; if(conn->bits.use_range && conn->range) { - off_t from, to; - off_t totalsize=-1; + curl_off_t from, to; + curl_off_t totalsize=-1; char *ptr; char *ptr2; @@ -1863,7 +1863,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn) (data->set.ftp_list_only?"NLST":"LIST")); } else { - off_t foundsize; + curl_off_t foundsize; /* Set type to binary (unless specified ASCII) */ result = ftp_transfertype(conn, data->set.ftp_ascii); @@ -1986,7 +1986,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn) E: 125 Data connection already open; Transfer starting. */ - off_t size=-1; /* default unknown size */ + curl_off_t size=-1; /* default unknown size */ /* @@ -2170,7 +2170,7 @@ CURLcode ftp_perform(struct connectdata *conn, /* The SIZE command is _not_ RFC 959 specified, and therefor many servers may not support it! It is however the only way we have to get a file's size! */ - off_t filesize; + curl_off_t filesize; ssize_t nread; int ftpcode; diff --git a/lib/http.c b/lib/http.c index 6002ad977..2d8e87b65 100644 --- a/lib/http.c +++ b/lib/http.c @@ -1245,14 +1245,14 @@ CURLcode Curl_http(struct connectdata *conn) if(conn->resume_from) { /* do we still game? */ - off_t passed=0; + curl_off_t passed=0; /* Now, let's read off the proper amount of bytes from the input. If we knew it was a proper file we could've just fseek()ed but we only have a stream here */ do { - off_t readthisamountnow = (conn->resume_from - passed); - off_t actuallyread; + curl_off_t readthisamountnow = (conn->resume_from - passed); + curl_off_t actuallyread; if(readthisamountnow > BUFSIZE) readthisamountnow = BUFSIZE; @@ -1299,7 +1299,8 @@ CURLcode Curl_http(struct connectdata *conn) if(conn->resume_from) { /* This is because "resume" was selected */ - off_t total_expected_size= conn->resume_from + data->set.infilesize; + curl_off_t total_expected_size= + conn->resume_from + data->set.infilesize; conn->allocptr.rangeline = aprintf("Content-Range: bytes %s%Od/%Od\r\n", conn->range, total_expected_size-1, diff --git a/lib/mprintf.c b/lib/mprintf.c index 2b1356af7..a323bf554 100644 --- a/lib/mprintf.c +++ b/lib/mprintf.c @@ -38,6 +38,8 @@ #include <ctype.h> #include <string.h> +#include <curl/curl.h> /* for the curl_off_t type */ + #ifndef SIZEOF_LONG_DOUBLE #define SIZEOF_LONG_DOUBLE 0 #endif @@ -377,9 +379,10 @@ static int dprintf_Pass1(char *format, va_stack_t *vto, char **endpos, va_list a flags |= FLAGS_LONG; break; case 'O': - if (sizeof(off_t) > sizeof(unsigned long int)) { + if (sizeof(curl_off_t) > sizeof(unsigned long int)) { flags |= FLAGS_LONGLONG; - } else if (sizeof(off_t) > sizeof(unsigned int)) { + } + else if (sizeof(curl_off_t) > sizeof(unsigned int)) { flags |= FLAGS_LONG; } break; diff --git a/lib/setup.h b/lib/setup.h index e4dac8b98..36e4c7f14 100644 --- a/lib/setup.h +++ b/lib/setup.h @@ -244,21 +244,4 @@ typedef struct hostent Curl_addrinfo; typedef struct in_addr Curl_ipconnect; #endif -#if 0 -#if (SIZEOF_OFF_T > 4) -/* off_t is bigger than 4 bytes, and that makes it our prefered variable - type for filesizes */ -typedef off_t filesize_t; -#else -#ifdef HAVE_LONGLONG -/* we have long long, use this for filesizes internally */ -typedef long long filesize_t; -#else -/* small off_t and no long long, no support for large files :-( */ -typedef long filesize_t; -#endif /* didn't have long long */ -#endif /* sizeof wasn't bigger than 4 */ - -#endif /* 0 */ - #endif /* __CONFIG_H */ diff --git a/lib/strtoofft.h b/lib/strtoofft.h index ccaf6cb87..4b6e6b136 100644 --- a/lib/strtoofft.h +++ b/lib/strtoofft.h @@ -27,14 +27,13 @@ #include "setup.h" #include <stddef.h> -/* Determine what type of file offset conversion handling we wish - * to use. For systems with a 32-bit off_t type, we should use - * strtol. For systems with a 64-bit off_t type, we should use - * strtoll if it exists, and if not, should try to emulate its - * functionality. At any rate, we define 'strtoofft' such that it - * can be used to work with off_t's regardless. +/* Determine what type of file offset conversion handling we wish to use. For + * systems with a 32-bit curl_off_t type, we should use strtol. For systems + * with a 64-bit curl_off_t type, we should use strtoll if it exists, and if + * not, should try to emulate its functionality. At any rate, we define + * 'strtoofft' such that it can be used to work with curl_off_t's regardless. */ -#if SIZEOF_OFF_T > 4 +#if SIZEOF_CURL_OFF_T > 4 #if HAVE_STRTOLL #define strtoofft strtoll #else diff --git a/lib/transfer.c b/lib/transfer.c index 0cf9ef222..3c2bf4baf 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -1955,14 +1955,14 @@ CURLcode Curl_perform(struct SessionHandle *data) CURLcode Curl_Transfer(struct connectdata *c_conn, /* connection data */ - int sockindex, /* socket index to read from or -1 */ - off_t size, /* -1 if unknown at this point */ - bool getheader, /* TRUE if header parsing is wanted */ - off_t *bytecountp, /* return number of bytes read or NULL */ + int sockindex, /* socket index to read from or -1 */ + curl_off_t size, /* -1 if unknown at this point */ + bool getheader, /* TRUE if header parsing is wanted */ + curl_off_t *bytecountp, /* return number of bytes read or NULL */ int writesockindex, /* socket index to write to, it may very well be the same we read from. -1 disables */ - off_t *writebytecountp /* return number of bytes written or + curl_off_t *writecountp /* return number of bytes written or NULL */ ) { @@ -1978,7 +1978,7 @@ Curl_Transfer(struct connectdata *c_conn, /* connection data */ conn->bits.getheader = getheader; conn->bytecountp = bytecountp; conn->writesockfd = writesockindex==-1?-1:conn->sock[writesockindex]; - conn->writebytecountp = writebytecountp; + conn->writebytecountp = writecountp; return CURLE_OK; diff --git a/lib/transfer.h b/lib/transfer.h index cd89a9a04..d1b1a7697 100644 --- a/lib/transfer.h +++ b/lib/transfer.h @@ -38,11 +38,11 @@ CURLcode Curl_readwrite_init(struct connectdata *conn); CURLcode Curl_Transfer (struct connectdata *data, int sockfd, /* socket to read from or -1 */ - off_t size, /* -1 if unknown at this point */ + curl_off_t size, /* -1 if unknown at this point */ bool getheader, /* TRUE if header parsing is wanted */ - off_t *bytecountp, /* return number of bytes read */ + curl_off_t *bytecountp, /* return number of bytes read */ int writesockfd, /* socket to write to, it may very well be the same we read from. -1 disables */ - off_t *writebytecountp /* return number of bytes written */ + curl_off_t *writecountp /* return number of bytes written */ ); #endif @@ -716,7 +716,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...) * If known, this should inform curl about the file size of the * to-be-uploaded file. */ - data->set.infilesize = va_arg(param, off_t); + data->set.infilesize = va_arg(param, curl_off_t); break; case CURLOPT_LOW_SPEED_LIMIT: /* @@ -966,7 +966,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...) /* * Resume transfer at the give file position */ - data->set.set_resume_from = va_arg(param, off_t); + data->set.set_resume_from = va_arg(param, curl_off_t); break; case CURLOPT_DEBUGFUNCTION: /* @@ -1279,7 +1279,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...) /* * Set the maximum size of a file to download. */ - data->set.max_filesize = va_arg(param, off_t); + data->set.max_filesize = va_arg(param, curl_off_t); break; default: diff --git a/lib/urldata.h b/lib/urldata.h index aa00c7210..f4a923817 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -77,16 +77,16 @@ #include "timeval.h" +#ifdef HAVE_ZLIB_H +#include <zlib.h> /* for content-encoding */ +#endif + #include <curl/curl.h> #include "http_chunks.h" /* for the structs and enum stuff */ #include "hostip.h" #include "hash.h" -#ifdef HAVE_ZLIB_H -#include <zlib.h> /* for content-encoding */ -#endif - #ifdef HAVE_GSSAPI #ifdef HAVE_GSSMIT #include <gssapi/gssapi.h> @@ -211,8 +211,8 @@ struct HTTP { const char *p_pragma; /* Pragma: string */ const char *p_accept; /* Accept: string */ - off_t readbytecount; - off_t writebytecount; + curl_off_t readbytecount; + curl_off_t writebytecount; /* For FORM posting */ struct Form form; @@ -240,7 +240,7 @@ struct HTTP { * FTP unique setup ***************************************************************************/ struct FTP { - off_t *bytecountp; + curl_off_t *bytecountp; char *user; /* user name string */ char *passwd; /* password string */ char *urlpath; /* the originally given path part of the URL */ @@ -250,7 +250,7 @@ struct FTP { char *entrypath; /* the PWD reply when we logged on */ char *cache; /* data cache between getresponse()-calls */ - off_t cache_size; /* size of cache in bytes */ + curl_off_t cache_size; /* size of cache in bytes */ bool dont_check; /* Set to TRUE to prevent the final (post-transfer) file size and 226/250 status check. It should still read the line, just ignore the result. */ @@ -305,7 +305,7 @@ struct ConnectBits { */ struct Curl_transfer_keeper { - off_t bytecount; /* total number of bytes read */ + curl_off_t bytecount; /* total number of bytes read */ int writebytecount; /* number of bytes written */ struct timeval start; /* transfer started at this time */ struct timeval now; /* current time */ @@ -326,7 +326,7 @@ struct Curl_transfer_keeper { char *end_ptr; /* within buf */ char *p; /* within headerbuff */ bool content_range; /* set TRUE if Content-Range: was found */ - off_t offset; /* possible resume offset read from the + curl_off_t offset; /* possible resume offset read from the Content-Range: header */ int httpcode; /* error code from the 'HTTP/1.? XXX' line */ int httpversion; /* the HTTP version*10 */ @@ -428,12 +428,12 @@ struct connectdata { unsigned short remote_port; /* what remote port to connect to, not the proxy port! */ char *ppath; - off_t bytecount; + curl_off_t bytecount; long headerbytecount; /* only count received headers */ char *range; /* range, if used. See README for detailed specification on this syntax. */ - off_t resume_from; /* continue [ftp] transfer from here */ + curl_off_t resume_from; /* continue [ftp] transfer from here */ char *proxyhost; /* name of the http proxy host */ @@ -447,7 +447,7 @@ struct connectdata { struct timeval created; /* creation time */ int sock[2]; /* two sockets, the second is used for the data transfer when doing FTP */ - off_t maxdownload; /* in bytes, the maximum amount of data to fetch, 0 + curl_off_t maxdownload; /* in bytes, the maximum amount of data to fetch, 0 means unlimited */ struct ssl_connect_data ssl[2]; /* this is for ssl-stuff */ @@ -484,14 +484,14 @@ struct connectdata { /**** curl_get() phase fields */ /* READ stuff */ - int sockfd; /* socket to read from or -1 */ - off_t size; /* -1 if unknown at this point */ - off_t *bytecountp; /* return number of bytes read or NULL */ + int sockfd; /* socket to read from or -1 */ + curl_off_t size; /* -1 if unknown at this point */ + curl_off_t *bytecountp; /* return number of bytes read or NULL */ /* WRITE stuff */ int writesockfd; /* socket to write to, it may very well be the same we read from. -1 disables */ - off_t *writebytecountp; /* return number of bytes written or NULL */ + curl_off_t *writebytecountp; /* return number of bytes written or NULL */ /** Dynamicly allocated strings, may need to be freed before this **/ /** struct is killed. **/ @@ -785,10 +785,10 @@ struct UserDefined { long timeout; /* in seconds, 0 means no timeout */ long connecttimeout; /* in seconds, 0 means no timeout */ long ftp_response_timeout; /* in seconds, 0 means no timeout */ - off_t infilesize; /* size of file to upload, -1 means unknown */ + curl_off_t infilesize; /* size of file to upload, -1 means unknown */ long low_speed_limit; /* bytes/second */ long low_speed_time; /* number of seconds */ - off_t set_resume_from; /* continue [ftp] transfer from here */ + curl_off_t set_resume_from; /* continue [ftp] transfer from here */ char *cookie; /* HTTP cookie string to send */ struct curl_slist *headers; /* linked list of extra headers */ struct curl_httppost *httppost; /* linked list of POST data */ @@ -830,7 +830,7 @@ struct UserDefined { int ip_version; - off_t max_filesize; /* Maximum file size to download */ + curl_off_t max_filesize; /* Maximum file size to download */ /* Here follows boolean settings that define how to behave during this session. They are STATIC, set by libcurl users or at least initially |