]> sjero.net Git - wget/commitdiff
[svn] Also check for short for int32_t.
authorhniksic <devnull@localhost>
Sat, 11 Oct 2003 12:41:13 +0000 (05:41 -0700)
committerhniksic <devnull@localhost>
Sat, 11 Oct 2003 12:41:13 +0000 (05:41 -0700)
configure.in
src/ChangeLog
src/config.h.in
src/snprintf.c
src/sysdep.h
windows/config.h.bor
windows/config.h.ms

index d5f3ffd7f84c92de717c799b252055315f88726c..d9104895ebb171d52780f89506152f12db45c078 100644 (file)
@@ -160,6 +160,7 @@ AC_C_BIGENDIAN
 dnl
 dnl Check integral type sizes.
 dnl
+AC_CHECK_SIZEOF(short)
 AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(long)
 AC_CHECK_SIZEOF(long long)
index 2e7fc75083e2ad61343cb46620b4a46ebc6c5db3..eaa9ec4991df22b90aaf84f4c4c8c75d44b17ef2 100644 (file)
@@ -1,3 +1,7 @@
+2003-10-11  Hrvoje Niksic  <hniksic@xemacs.org>
+
+       * sysdep.h: Also check size of short for int32_t.
+
 2003-10-11  Hrvoje Niksic  <hniksic@xemacs.org>
 
        * host.c (lookup_host): Use u_int32_t to store the result of
index c05f00c35a034819232c929f000ebb3e8e788caf..64d1459f03d6f7c24dae3e4557c9409a574b77a2 100644 (file)
@@ -80,6 +80,9 @@ char *alloca ();
    significant byte first).  */
 #undef WORDS_BIGENDIAN
 
+/* Define to the length of short. */
+#undef SIZEOF_SHORT
+
 /* Define to the length of int. */
 #undef SIZEOF_INT
 
@@ -89,11 +92,6 @@ char *alloca ();
 /* Define to the length of long long. */
 #undef SIZEOF_LONG_LONG
 
-#undef HAVE_LONG_LONG
-#if SIZEOF_LONG_LONG != 0
-# define HAVE_LONG_LONG
-#endif
-
 /* Define this if you want the NLS support.  */
 #undef HAVE_NLS
 
index f8dffa4ab12a4a380146c8e405acc10181ce62b4..5baa98b6bb59ef9087bbe66aa75c13e5b947be90 100644 (file)
 #define LDOUBLE double
 #endif
 
-#ifdef HAVE_LONG_LONG
+#if SIZEOF_LONG_LONG != 0
 # define LLONG long long
 #else
 # define LLONG long
@@ -849,7 +849,7 @@ int main (void)
     NULL
   };
   long int_nums[] = { -1, 134, 91340, 341, 0203, 0};
-#ifdef HAVE_LONG_LONG
+#if SIZEOF_LONG_LONG != 0
   char *llong_fmt[] = {
     "%lld",            "%llu",
     "%-1.5lld",                "%-1.5llu",
@@ -905,7 +905,7 @@ int main (void)
       num++;
     }
 
-#ifdef HAVE_LONG_LONG
+#if SIZEOF_LONG_LONG != 0
   for (x = 0; llong_fmt[x] != NULL ; x++)
     for (y = 0; llong_nums[y] != 0 ; y++)
     {
index 2defc65a349676a9445d31ff1561bde52de27906..05a0e773bdda5ec77c47386629d5b9baa6b7c26b 100644 (file)
@@ -129,23 +129,19 @@ do {                                              \
 } while (0)
 
 /* Define a large ("very long") type useful for storing large
-   non-negative quantities that exceed sizes of normal download, such
-   as the *total* number of bytes downloaded.  To fit today's needs,
-   this needs to be an integral type at least 64 bits wide.  On the
-   machines where `long' is 64-bit, we use long.  Otherwise, we check
-   whether `long long' is available and if yes, use that.  If long
-   long is unavailable, we give up and just use `long'.
-
-   This check could be smarter and moved to configure, which could
-   check for a bunch of non-standard types such as uint64_t.  But I
-   don't see the need for it -- the current test will work on all
-   modern architectures, and if it fails, nothing bad happens, we just
-   end up with long.
+   non-negative quantities that exceed sizes of normal download.  Note
+   that this has nothing to do with large file support.  For example,
+   one should be able to say `--quota=10G', large files
+   notwithstanding.
+
+   On the machines where `long' is 64-bit, we use long.  Otherwise, we
+   check whether `long long' is available and if yes, use that.  If
+   long long is unavailable, we give up and just use `long'.
 
    Note: you cannot use VERY_LONG_TYPE along with printf().  When you
    need to print it, use very_long_to_string().  */
 
-#if (SIZEOF_LONG >= 8) || !defined(HAVE_LONG_LONG)
+#if SIZEOF_LONG >= 8 || SIZEOF_LONG_LONG == 0
 /* either long is "big enough", or long long is unavailable which
    leaves long as the only choice. */ 
 # define VERY_LONG_TYPE   unsigned long
@@ -243,7 +239,10 @@ void *memcpy ();
 int fnmatch ();
 #endif
 
-/* Provide 32-bit types for the code that really needs it.  */
+/* Provide 32-bit types.  Most code shouldn't care, but there is code
+   that really needs a 32-bit integral type.  If int32_t and u_int32_t
+   are present, we use them, otherwise we pick one of int/short/long,
+   and throw an error if none of them works.  */
 
 #ifndef HAVE_INT32_T
 # if SIZEOF_INT == 4
@@ -252,7 +251,11 @@ typedef int int32_t;
 #  if SIZEOF_LONG == 4
 typedef long int32_t;
 #  else
-     "Cannot determine a 32-bit type"
+#   if SIZEOF_SHORT == 4
+typedef short int32_t;
+#   else
+ #error "Cannot determine a 32-bit type"
+#   endif
 #  endif
 # endif
 #endif
@@ -264,7 +267,11 @@ typedef unsigned int u_int32_t;
 #  if SIZEOF_LONG == 4
 typedef unsigned long u_int32_t;
 #  else
-     "Cannot determine a 32-bit type"
+#   if SIZEOF_SHORT == 4
+typedef unsigned short u_int32_t;
+#   else
+ #error "Cannot determine a 32-bit type"
+#   endif
 #  endif
 # endif
 #endif
index 459ce39621e47635e9d247bc807a5f04812a25dd..a350c90befab0973b5f20958c58dae6842983342 100644 (file)
 /* Define if you have the isatty function.  */
 #define HAVE_ISATTY
 
+/* Define to the length of short. */
+#define SIZEOF_SHORT 2
+
 /* Define to the length of int. */
 #define SIZEOF_INT 4
 
index b825ce95e72c9dcbfb2c00ca7a89e0794b3d14af..c3a3ca8b1b371f71e7047c995b23d6442a9dc33a 100644 (file)
 /* Define if you have the memmove function */
 #define HAVE_MEMMOVE 1
 
+/* Define to the length of short. */
+#define SIZEOF_SHORT 2
+
 /* Define to the length of int. */
 #define SIZEOF_INT 4
 
 #define HAVE_U_INT32_T 1
 
 #endif /* CONFIG_H */
-