diff options
author | Yang Tse <yangsita@gmail.com> | 2008-08-26 01:40:19 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2008-08-26 01:40:19 +0000 |
commit | 3e2487493ef28ea9e44931faffb04e89ed3aae8d (patch) | |
tree | 30e40bb35c060ec724fa46ef0ede265881284dfb /src | |
parent | fdcb0cd2bce920231af8c0218fe48f276817018b (diff) |
Use SIZEOF_OFF_T definition from config file
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/src/main.c b/src/main.c index 72a53163e..62c34cbdf 100644 --- a/src/main.c +++ b/src/main.c @@ -242,6 +242,32 @@ typedef enum { # define struct_stat struct stat #endif +/* + * Default sizeof(off_t) in case it hasn't been defined in config file. + */ + +#ifndef SIZEOF_OFF_T +# if defined(__VMS) && (defined(__alpha) || defined(__ia64)) +# if defined(_LARGEFILE) +# define SIZEOF_OFF_T 8 +# endif +# elif defined(__OS400__) && defined(__ILEC400__) +# if defined(_LARGE_FILES) +# define SIZEOF_OFF_T 8 +# endif +# elif defined(__MVS__) && defined(__IBMC__) +# if defined(_LP64) || defined(_LARGE_FILES) +# define SIZEOF_OFF_T 8 +# endif +# elif defined(__370__) && defined(__IBMC__) +# if defined(_LP64) || defined(_LARGE_FILES) +# define SIZEOF_OFF_T 8 +# endif +# else +# define SIZEOF_OFF_T 4 +# endif +#endif + #ifdef CURL_DOES_CONVERSIONS #ifdef HAVE_ICONV iconv_t inbound_cd = (iconv_t)-1; @@ -3205,12 +3231,6 @@ struct InStruct { #define MAX_SEEK 2147483647 -#ifndef SIZEOF_OFF_T -/* (Jan 11th 2008) this is a reasonably new define in the config.h so there - might be older handicrafted configs that don't define it properly and then - we assume 32bit off_t */ -#define SIZEOF_OFF_T 4 -#endif /* * my_seek() is the CURLOPT_SEEKFUNCTION we use */ @@ -3218,11 +3238,10 @@ static int my_seek(void *stream, curl_off_t offset, int whence) { struct InStruct *in=(struct InStruct *)stream; -#if (CURL_SIZEOF_CURL_OFF_T > SIZEOF_OFF_T) && !defined(lseek) - /* The sizeof check following here is only interesting if curl_off_t is - larger than off_t, but also not on windows-like systems for which lseek - is a defined macro that works around the 32bit off_t-problem and thus do - 64bit seeks correctly anyway */ +#if (CURL_SIZEOF_CURL_OFF_T > SIZEOF_OFF_T) && !defined(USE_WIN32_LARGE_FILES) + /* The offset check following here is only interesting if curl_off_t is + larger than off_t and we are not using the WIN32 large file support + macros that provide the support to do 64bit seeks correctly */ if(offset > MAX_SEEK) { /* Some precaution code to work around problems with different data sizes |