]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
Added macros for minimum-width signed and unsigned curl_off_t integer
authorYang Tse <yangsita@gmail.com>
Tue, 12 Aug 2008 03:00:24 +0000 (03:00 +0000)
committerYang Tse <yangsita@gmail.com>
Tue, 12 Aug 2008 03:00:24 +0000 (03:00 +0000)
constants CURL_OFF_T_C and CURL_OFF_TU_C. The clever double helper macro
used internally to provide its functionality is thanks to Lars Nilsson.

CHANGES
RELEASE-NOTES
include/curl/curl.h
include/curl/curlrules.h

diff --git a/CHANGES b/CHANGES
index 755c79d2f54689720cc7639255095918f742cae2..ed925e80c9927714f496c9ef347d617f27fc38b2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,10 @@
 
                                   Changelog
 
+Yang Tse (12 Aug 2008)
+- Added macros for minimum-width signed and unsigned curl_off_t integer
+  constants CURL_OFF_T_C and CURL_OFF_TU_C. The clever double helper macro
+  used internally to provide its functionality is thanks to Lars Nilsson.
 
 Daniel Fandrich (11 Aug 2008)
 - Fixed a boundary condition error in ftp_readresp() whereby a non-terminal
index b5ade6f3c518c8d630a1f86e586b5475d0d4e8e7..8d12c7d5da5f1b1420a3b7c68bf5a196b2df68c7 100644 (file)
@@ -72,7 +72,7 @@ advice from friends like these:
  Phil Pellouchoud, Eduard Bloch, John Lightsey, Stephen Collyer, Tor Arntsen,
  Rolland Dudemaine, Phil Blundell, Scott Barrett, Andreas Schuldei,
  Peter Lamberg, David Bau, Pramod Sharma, Yehoshua Hershberg,
- Constantine Sapuntzakis
+ Constantine Sapuntzakis, Lars Nilsson
 
 
         Thanks! (and sorry if I forgot to mention someone)
index 9dd54ff69a9455ebc1b49f041bd33e40cd2627e8..0aaad88fadef313c51d192a7320044edb5e16721 100644 (file)
@@ -548,23 +548,6 @@ typedef enum {
 #ifdef CINIT
 #undef CINIT
 #endif
-/*
- * Figure out if we can use the ## operator, which is supported by ISO/ANSI C
- * and C++. Some compilers support it without setting __STDC__ or __cplusplus
- * so we need to carefully check for them too. We don't use configure-checks
- * for these since we want these headers to remain generic and working for all
- * platforms.
- */
-#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
-  defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
-  defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
-  defined(__ILEC400__)
-  /* This compiler is believed to have an ISO compatible preprocessor */
-#define CURL_ISOCPP
-#else
-  /* This compiler is believed NOT to have an ISO compatible preprocessor */
-#undef CURL_ISOCPP
-#endif
 
 #ifdef CURL_ISOCPP
 #define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number
index 56499f9a259296f2958df0722a15de20e0753aa5..cda33b21be504cb7eabe6b930bc103050c08cd21 100644 (file)
    Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing
 #endif
 
+#ifndef CURL_SUFFIX_CURL_OFF_T
+#  error "CURL_SUFFIX_CURL_OFF_T definition is missing!"
+   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing
+#endif
+
+#ifndef CURL_SUFFIX_CURL_OFF_TU
+#  error "CURL_SUFFIX_CURL_OFF_TU definition is missing!"
+   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing
+#endif
+
 /*
  * Macros private to this header file.
  */
@@ -129,6 +139,49 @@ typedef char
   __curl_rule_02__
     [CurlchkszGE(curl_off_t, long)];
 
+/* ================================================================ */
+/*          EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS           */
+/* ================================================================ */
+
+/* 
+ * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
+ * these to be visible and exported by the external libcurl interface API,
+ * while also making them visible to the library internals, simply including
+ * setup.h, without actually needing to include curl.h internally.
+ * If some day this section would grow big enough, all this should be moved
+ * to its own header file.
+ */
+
+/*
+ * Figure out if we can use the ## preprocessor operator, which is supported
+ * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
+ * or  __cplusplus so we need to carefully check for them too.
+ */
+
+#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
+  defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
+  defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
+  defined(__ILEC400__)
+  /* This compiler is believed to have an ISO compatible preprocessor */
+#define CURL_ISOCPP
+#else
+  /* This compiler is believed NOT to have an ISO compatible preprocessor */
+#undef CURL_ISOCPP
+#endif
+
+/*
+ * Macros for minimum-width signed and unsigned curl_off_t integer constants.
+ */
+
+#ifdef CURL_ISOCPP
+#  define __CURL_OFF_T_C_HELPER2(Val,Suffix) Val ## Suffix
+#else
+#  define __CURL_OFF_T_C_HELPER2(Val,Suffix) Val/**/Suffix
+#endif
+#define __CURL_OFF_T_C_HELPER1(Val,Suffix) __CURL_OFF_T_C_HELPER2(Val,Suffix)
+#define CURL_OFF_T_C(Val)  __CURL_OFF_T_C_HELPER1(Val,CURL_SUFFIX_CURL_OFF_T)
+#define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HELPER1(Val,CURL_SUFFIX_CURL_OFF_TU)
+
 /*
  * Get rid of macros private to this header file.
  */