X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstrtol.c;h=6c15d11e8f8d4047698f40d394cb2827a81f3b0c;hb=ce05829e2da40a92966f0e3d78d1b40c6f1e85b5;hp=39508b477b1b03ea40c57e154267b483d036a363;hpb=3030c5b5e0a5199e16b05927da72c43c42f211c3;p=gnulib.git diff --git a/lib/strtol.c b/lib/strtol.c index 39508b477..6c15d11e8 100644 --- a/lib/strtol.c +++ b/lib/strtol.c @@ -1,7 +1,7 @@ /* Convert string representation of a number into an integer value. - Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2005, - 2006, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2011 Free Software + Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@gnu.org. @@ -114,9 +114,9 @@ operating on `long long int's. */ #ifdef QUAD # define LONG long long -# define STRTOL_LONG_MIN LONG_LONG_MIN -# define STRTOL_LONG_MAX LONG_LONG_MAX -# define STRTOL_ULONG_MAX ULONG_LONG_MAX +# define STRTOL_LONG_MIN LLONG_MIN +# define STRTOL_LONG_MAX LLONG_MAX +# define STRTOL_ULONG_MAX ULLONG_MAX /* The extra casts in the following macros work around compiler bugs, e.g., in Cray C 5.0.3.0. */ @@ -141,25 +141,25 @@ ? (t) 0 \ : TYPE_SIGNED_MAGNITUDE (t) \ ? ~ (t) 0 \ - : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) + : ~ TYPE_MAXIMUM (t))) # define TYPE_MAXIMUM(t) \ ((t) (! TYPE_SIGNED (t) \ ? (t) -1 \ - : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) + : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) -# ifndef ULONG_LONG_MAX -# define ULONG_LONG_MAX TYPE_MAXIMUM (unsigned long long) +# ifndef ULLONG_MAX +# define ULLONG_MAX TYPE_MAXIMUM (unsigned long long) # endif -# ifndef LONG_LONG_MAX -# define LONG_LONG_MAX TYPE_MAXIMUM (long long int) +# ifndef LLONG_MAX +# define LLONG_MAX TYPE_MAXIMUM (long long int) # endif -# ifndef LONG_LONG_MIN -# define LONG_LONG_MIN TYPE_MINIMUM (long long int) +# ifndef LLONG_MIN +# define LLONG_MIN TYPE_MINIMUM (long long int) # endif # if __GNUC__ == 2 && __GNUC_MINOR__ < 7 /* Work around gcc bug with using this constant. */ - static const unsigned long long int maxquad = ULONG_LONG_MAX; + static const unsigned long long int maxquad = ULLONG_MAX; # undef STRTOL_ULONG_MAX # define STRTOL_ULONG_MAX maxquad # endif @@ -186,9 +186,8 @@ # define LOCALE_PARAM_PROTO #endif -#include - #ifdef USE_WIDE_CHAR +# include # include # define L_(Ch) L##Ch # define UCHAR_TYPE wint_t