cURL / Mailing Lists / curl-library / Single Mail

curl-library

64/32/16bit curl_off_t for MINGW32 and MSC

From: Yang Tse <yangsita_at_gmail.com>
Date: Tue, 3 Jun 2008 14:22:12 +0200

Hi, all

I'm requesting verification/validation of the correctness of the
following snippet for MINGW32 and MSC compilers by those who
_actually_ have or really understand them.

The following snippet is intended to define a 64bit curl_off_t for
those configurations that are capable of the following requisites
simultaneously:

1) Have a 64bit data type to which curl_off_t can be typedef'ed.
2) Does pointer math correctly with the above defined curl_off_t.

If for some reason the above conditions can not be satisfied then the
curl_off_t definition is intended to be a 32bit one for which similar
requisites should apply.

I'm assuming that a 32bit curl_off_t would be possible in all
configurations of this compilers. But if for some configuration/reason
it should fall back to 16bit please show us.

I understand that the 64/32/16 bit capability could also depend on
compiler version being used, so if this is the case, please, also fix
the following snippet.

#if defined(__MINGW32__)
  typedef long long curl_off_t;
  #define CURL_FORMAT_OFF_T "%I64d"
  #define CURL_SIZEOF_CURL_OFF_T 8

#elif defined(_MSC_VER)
  #if (_MSC_VER >= 900)
    typedef signed __int64 curl_off_t;
    #define CURL_FORMAT_OFF_T "%I64d"
    #define CURL_SIZEOF_CURL_OFF_T 8
  #else
    typedef long curl_off_t;
    #define CURL_FORMAT_OFF_T "%ld"
    #define CURL_SIZEOF_CURL_OFF_T 4
  #endif

#endif

PS: _WIN32_WCE targets have a different check. Dont include them here.

-- 
-=[Yang]=-
Received on 2008-06-03