Initial commit.
[CMakeLuaTailorHgBridge.git] / CMakeLua / Utilities / cmcurl / strtoofft.h
blob35dacba963ee2057e5964312429b4b07da880cbe
1 #ifndef _CURL_STRTOOFFT_H
2 #define _CURL_STRTOOFFT_H
3 /***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
10 * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
14 * are also available at http://curl.haxx.se/docs/copyright.html.
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
23 * $Id: strtoofft.h,v 1.2 2007/03/15 19:22:13 andy Exp $
24 ***************************************************************************/
27 * CAUTION: this header is designed to work when included by the app-side
28 * as well as the library. Do not mix with library internals!
31 #include "setup.h"
32 #include <stddef.h>
33 #include <curl/curl.h> /* for the curl_off_t type */
35 /* Determine what type of file offset conversion handling we wish to use. For
36 * systems with a 32-bit curl_off_t type, we should use strtol. For systems
37 * with a 64-bit curl_off_t type, we should use strtoll if it exists, and if
38 * not, should try to emulate its functionality. At any rate, we define
39 * 'strtoofft' such that it can be used to work with curl_off_t's regardless.
41 #if (SIZEOF_CURL_OFF_T > 4) && (SIZEOF_LONG < 8)
42 #if HAVE_STRTOLL
43 #define curlx_strtoofft strtoll
44 #else /* HAVE_STRTOLL */
46 /* For MSVC7 we can use _strtoi64() which seems to be a strtoll() clone */
47 #if defined(_MSC_VER) && (_MSC_VER >= 1300)
48 #define curlx_strtoofft _strtoi64
49 #else /* MSVC7 or later */
50 curl_off_t curlx_strtoll(const char *nptr, char **endptr, int base);
51 #define curlx_strtoofft curlx_strtoll
52 #define NEED_CURL_STRTOLL
53 #endif /* MSVC7 or later */
55 #endif /* HAVE_STRTOLL */
56 #else /* (SIZEOF_CURL_OFF_T > 4) && (SIZEOF_LONG < 8) */
57 /* simply use strtol() to get numbers, either 32 or 64 bit */
58 #define curlx_strtoofft strtol
59 #endif
61 #if defined(_MSC_VER) || defined(__WATCOMC__)
62 #define CURL_LLONG_MIN 0x8000000000000000i64
63 #define CURL_LLONG_MAX 0x7FFFFFFFFFFFFFFFi64
64 #elif defined(HAVE_LL)
65 #define CURL_LLONG_MIN 0x8000000000000000LL
66 #define CURL_LLONG_MAX 0x7FFFFFFFFFFFFFFFLL
67 #else
68 #define CURL_LLONG_MIN 0x8000000000000000L
69 #define CURL_LLONG_MAX 0x7FFFFFFFFFFFFFFFL
70 #endif
72 #endif