c_locale_generic.cc: Check errno for ERANGE instead of non-zero to aid portability.
* config/locale/c_locale_generic.cc: Check errno for ERANGE instead of non-zero to aid portability. From-SVN: r49350
This commit is contained in:
parent
c3a7de6ad8
commit
2083b5be4d
|
@ -1,3 +1,8 @@
|
||||||
|
2002-01-30 Loren Rittle <ljrittle@acm.org>
|
||||||
|
|
||||||
|
* config/locale/c_locale_generic.cc: Check errno for ERANGE
|
||||||
|
instead of non-zero to aid portability.
|
||||||
|
|
||||||
2002-01-30 Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de>
|
2002-01-30 Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de>
|
||||||
|
|
||||||
* docs/html/22_locale/messages.html: Fix example code.
|
* docs/html/22_locale/messages.html: Fix example code.
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace std
|
||||||
char* __sanity;
|
char* __sanity;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
long __l = strtol(__s, &__sanity, __base);
|
long __l = strtol(__s, &__sanity, __base);
|
||||||
if (__sanity != __s && *__sanity == '\0' && errno == 0)
|
if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
|
||||||
__v = __l;
|
__v = __l;
|
||||||
else
|
else
|
||||||
__err |= ios_base::failbit;
|
__err |= ios_base::failbit;
|
||||||
|
@ -65,7 +65,7 @@ namespace std
|
||||||
char* __sanity;
|
char* __sanity;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
unsigned long __ul = strtoul(__s, &__sanity, __base);
|
unsigned long __ul = strtoul(__s, &__sanity, __base);
|
||||||
if (__sanity != __s && *__sanity == '\0' && errno == 0)
|
if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
|
||||||
__v = __ul;
|
__v = __ul;
|
||||||
else
|
else
|
||||||
__err |= ios_base::failbit;
|
__err |= ios_base::failbit;
|
||||||
|
@ -83,7 +83,7 @@ namespace std
|
||||||
char* __sanity;
|
char* __sanity;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
long long __ll = strtoll(__s, &__sanity, __base);
|
long long __ll = strtoll(__s, &__sanity, __base);
|
||||||
if (__sanity != __s && *__sanity == '\0' && errno == 0)
|
if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
|
||||||
__v = __ll;
|
__v = __ll;
|
||||||
else
|
else
|
||||||
__err |= ios_base::failbit;
|
__err |= ios_base::failbit;
|
||||||
|
@ -100,7 +100,7 @@ namespace std
|
||||||
char* __sanity;
|
char* __sanity;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
unsigned long long __ull = strtoull(__s, &__sanity, __base);
|
unsigned long long __ull = strtoull(__s, &__sanity, __base);
|
||||||
if (__sanity != __s && *__sanity == '\0' && errno == 0)
|
if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
|
||||||
__v = __ull;
|
__v = __ull;
|
||||||
else
|
else
|
||||||
__err |= ios_base::failbit;
|
__err |= ios_base::failbit;
|
||||||
|
@ -124,7 +124,7 @@ namespace std
|
||||||
#else
|
#else
|
||||||
float __f = static_cast<float>(strtod(__s, &__sanity));
|
float __f = static_cast<float>(strtod(__s, &__sanity));
|
||||||
#endif
|
#endif
|
||||||
if (__sanity != __s && *__sanity == '\0' && errno == 0)
|
if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
|
||||||
__v = __f;
|
__v = __f;
|
||||||
else
|
else
|
||||||
__err |= ios_base::failbit;
|
__err |= ios_base::failbit;
|
||||||
|
@ -144,7 +144,7 @@ namespace std
|
||||||
char* __sanity;
|
char* __sanity;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
double __d = strtod(__s, &__sanity);
|
double __d = strtod(__s, &__sanity);
|
||||||
if (__sanity != __s && *__sanity == '\0' && errno == 0)
|
if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
|
||||||
__v = __d;
|
__v = __d;
|
||||||
else
|
else
|
||||||
__err |= ios_base::failbit;
|
__err |= ios_base::failbit;
|
||||||
|
@ -165,7 +165,7 @@ namespace std
|
||||||
char* __sanity;
|
char* __sanity;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
long double __ld = strtold(__s, &__sanity);
|
long double __ld = strtold(__s, &__sanity);
|
||||||
if (__sanity != __s && *__sanity == '\0' && errno == 0)
|
if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
|
||||||
__v = __ld;
|
__v = __ld;
|
||||||
#else
|
#else
|
||||||
typedef char_traits<char>::int_type int_type;
|
typedef char_traits<char>::int_type int_type;
|
||||||
|
|
Loading…
Reference in New Issue