#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
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 */
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;
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);
}
*/
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;
static
CURLcode ftp_getsize(struct connectdata *conn, char *file,
- off_t *size)
+ curl_off_t *size)
{
struct SessionHandle *data = conn->data;
int ftpcode;
/* 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) {
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");
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;
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;
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;
(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);
E:
125 Data connection already open; Transfer starting. */
- off_t size=-1; /* default unknown size */
+ curl_off_t size=-1; /* default unknown size */
/*
/* 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;
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;
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,
#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
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;
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 */
#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
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 */
)
{
conn->bits.getheader = getheader;
conn->bytecountp = bytecountp;
conn->writesockfd = writesockindex==-1?-1:conn->sock[writesockindex];
- conn->writebytecountp = writebytecountp;
+ conn->writebytecountp = writecountp;
return CURLE_OK;
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
* 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:
/*
/*
* 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:
/*
/*
* 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:
#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>
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;
* 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 */
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. */
*/
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 */
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 */
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 */
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 */
/**** 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. **/
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 */
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