1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

Use SIZEOF_OFF_T definition from config file

This commit is contained in:
Yang Tse 2008-08-26 01:40:19 +00:00
parent fdcb0cd2bc
commit 3e2487493e
4 changed files with 59 additions and 22 deletions

View File

@ -78,7 +78,7 @@ static char *max5data(curl_off_t bytes, char *max5)
bytes/ONE_MEGABYTE, bytes/ONE_MEGABYTE,
(bytes%ONE_MEGABYTE) / (ONE_MEGABYTE/CURL_OFF_T_C(10)) ); (bytes%ONE_MEGABYTE) / (ONE_MEGABYTE/CURL_OFF_T_C(10)) );
#if CURL_SIZEOF_CURL_OFF_T > 4 #if (CURL_SIZEOF_CURL_OFF_T > 4)
else if(bytes < CURL_OFF_T_C(10000) * ONE_MEGABYTE) else if(bytes < CURL_OFF_T_C(10000) * ONE_MEGABYTE)
/* 'XXXXM' is good until we're at 10000MB or above */ /* 'XXXXM' is good until we're at 10000MB or above */

View File

@ -302,6 +302,32 @@
# define struct_stat struct stat # define struct_stat struct stat
#endif #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
/* Below we define some functions. They should /* Below we define some functions. They should
1. close a socket 1. close a socket

View File

@ -190,16 +190,8 @@ static curl_version_info_data version_info = {
#ifdef HAVE_SPNEGO #ifdef HAVE_SPNEGO
| CURL_VERSION_SPNEGO | CURL_VERSION_SPNEGO
#endif #endif
/* #if (CURL_SIZEOF_CURL_OFF_T > 4) && \
* FIXME before 7.19.0 release. ( (SIZEOF_OFF_T > 4) || defined(USE_WIN32_LARGE_FILES) )
*
* libcurl is largefile enabled when (CURL_SIZEOF_CURL_OFF_T > 4) _AND_
* libcurl has been built with sizeof(system off_t) > 4 or when large
* file support is available even with sizeof(system off_t) <= 4.
*
* Until this is adjusted, only the (CURL_SIZEOF_CURL_OFF_T > 4) check is done.
*/
#if (CURL_SIZEOF_CURL_OFF_T > 4)
| CURL_VERSION_LARGEFILE | CURL_VERSION_LARGEFILE
#endif #endif
#if defined(CURL_DOES_CONVERSIONS) #if defined(CURL_DOES_CONVERSIONS)

View File

@ -242,6 +242,32 @@ typedef enum {
# define struct_stat struct stat # define struct_stat struct stat
#endif #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 CURL_DOES_CONVERSIONS
#ifdef HAVE_ICONV #ifdef HAVE_ICONV
iconv_t inbound_cd = (iconv_t)-1; iconv_t inbound_cd = (iconv_t)-1;
@ -3205,12 +3231,6 @@ struct InStruct {
#define MAX_SEEK 2147483647 #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 * 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; struct InStruct *in=(struct InStruct *)stream;
#if (CURL_SIZEOF_CURL_OFF_T > SIZEOF_OFF_T) && !defined(lseek) #if (CURL_SIZEOF_CURL_OFF_T > SIZEOF_OFF_T) && !defined(USE_WIN32_LARGE_FILES)
/* The sizeof check following here is only interesting if curl_off_t is /* The offset 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 larger than off_t and we are not using the WIN32 large file support
is a defined macro that works around the 32bit off_t-problem and thus do macros that provide the support to do 64bit seeks correctly */
64bit seeks correctly anyway */
if(offset > MAX_SEEK) { if(offset > MAX_SEEK) {
/* Some precaution code to work around problems with different data sizes /* Some precaution code to work around problems with different data sizes