This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project. See the libstdc++ home page for more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
1999-05-03 Ryszard Kabatek <kabatek@chemie.uni-halle.de> * bits/locfacets.tcc (num_get<>::do_get): Check the errno variable. Use strtoul/strtoull for unsigned types. Check the ranges for short/unsigned short and if necessary for int/unsigned int. I am using RedHat 5.1 and egcs-19990428. I today installed the CVS-source again. Hello, world! still does not work. The file bits/stl_range_errors.h is still missed after make install. Ryszard Kabatek Martin-Luther University Halle-Wittenberg, Department of Physical Chemistry Geusaer Str. 88, 06217 Merseburg, Germany Tel. +49 3461 46 2487 Fax. +49 3461 46 2129
Index: bits/locfacets.tcc =================================================================== RCS file: /cvs/libstdc++/libstdc++/bits/locfacets.tcc,v retrieving revision 1.46 diff -c -2 -p -r1.46 locfacets.tcc *** locfacets.tcc 1999/04/30 00:10:23 1.46 --- locfacets.tcc 1999/05/03 11:12:29 *************** *** 34,37 **** --- 34,38 ---- #include <bits/std_vector.h> + #include <bits/std_cerrno.h> namespace std *************** namespace std *** 374,380 **** // Stage 2: convert and store results. char* __sanity; ! __v = static_cast<short>(strtol(__xtrc, &__sanity, __base)); ! if (__sanity != __xtrc && *__sanity == '\0') __err = ios_base::goodbit; else __err |= ios_base::failbit; --- 375,385 ---- // Stage 2: convert and store results. char* __sanity; ! errno = 0; ! long __vl = strtol(__xtrc, &__sanity, __base); ! if (__sanity != __xtrc && *__sanity == '\0' && errno == 0 ! && __vl >= SHRT_MIN && __vl <= SHRT_MAX) { ! __v = static_cast<short>(__vl); __err = ios_base::goodbit; + } else __err |= ios_base::failbit; *************** namespace std *** 398,404 **** // Stage 2: convert and store results. char* __sanity; ! __v = static_cast<int>(strtol(__xtrc, &__sanity, __base)); ! if (__sanity != __xtrc && *__sanity == '\0') __err = ios_base::goodbit; else __err |= ios_base::failbit; --- 403,416 ---- // Stage 2: convert and store results. char* __sanity; ! errno = 0; ! long __vl = strtol(__xtrc, &__sanity, __base); ! if (__sanity != __xtrc && *__sanity == '\0' && errno == 0 ! # if (INT_MAX) != (LONG_MAX) ! && __vl >= INT_MIN && __vl <= INT_MAX ! # endif ! ) { ! __v = static_cast<int>(__vl); __err = ios_base::goodbit; + } else __err |= ios_base::failbit; *************** namespace std *** 423,428 **** // Stage 2: convert and store results. char* __sanity; __v = strtol(__xtrc, &__sanity, __base); ! if (__sanity != __xtrc && *__sanity == '\0') __err = ios_base::goodbit; else --- 435,441 ---- // Stage 2: convert and store results. char* __sanity; + errno = 0; __v = strtol(__xtrc, &__sanity, __base); ! if (__sanity != __xtrc && *__sanity == '\0' && errno == 0) __err = ios_base::goodbit; else *************** namespace std *** 448,453 **** // Stage 2: convert and store results. char* __sanity; __v = strtoll(__xtrc, &__sanity, __base); ! if (__sanity != __xtrc && *__sanity == '\0') __err = ios_base::goodbit; else --- 461,467 ---- // Stage 2: convert and store results. char* __sanity; + errno = 0; __v = strtoll(__xtrc, &__sanity, __base); ! if (__sanity != __xtrc && *__sanity == '\0' && errno == 0) __err = ios_base::goodbit; else *************** namespace std *** 473,479 **** // Stage 2: convert and store results. char* __sanity; ! __v = static_cast<short>(strtol(__xtrc, &__sanity, __base)); ! if (__sanity != __xtrc && *__sanity == '\0') ! __err = ios_base::goodbit; else __err |= ios_base::failbit; --- 487,497 ---- // Stage 2: convert and store results. char* __sanity; ! errno = 0; ! unsigned long __vl = strtoul(__xtrc, &__sanity, __base); ! if (__sanity != __xtrc && *__sanity == '\0' && errno == 0 ! && __vl <= USHRT_MAX) { ! __v = static_cast<unsigned short>(__vl); ! __err = ios_base::goodbit; ! } else __err |= ios_base::failbit; *************** namespace std *** 497,503 **** // Stage 2: convert and store results. char* __sanity; ! __v = static_cast<int>(strtol(__xtrc, &__sanity, __base)); ! if (__sanity != __xtrc && *__sanity == '\0') ! __err = ios_base::goodbit; else __err |= ios_base::failbit; --- 515,528 ---- // Stage 2: convert and store results. char* __sanity; ! errno = 0; ! unsigned long __vl = strtoul(__xtrc, &__sanity, __base); ! if (__sanity != __xtrc && *__sanity == '\0' && errno == 0 ! # if (UINT_MAX) != (ULONG_MAX) ! && __vl <= UINT_MAX ! # endif ! ) { ! __v = static_cast<unsigned int>(__vl); ! __err = ios_base::goodbit; ! } else __err |= ios_base::failbit; *************** namespace std *** 521,526 **** // Stage 2: convert and store results. char* __sanity; ! __v = strtol(__xtrc, &__sanity, __base); ! if (__sanity != __xtrc && *__sanity == '\0') __err = ios_base::goodbit; else --- 546,552 ---- // Stage 2: convert and store results. char* __sanity; ! errno = 0; ! __v = strtoul(__xtrc, &__sanity, __base); ! if (__sanity != __xtrc && *__sanity == '\0' && errno == 0) __err = ios_base::goodbit; else *************** namespace std *** 546,551 **** // Stage 2: convert and store results. char* __sanity; ! __v = strtoll(__xtrc, &__sanity, __base); ! if (__sanity != __xtrc && *__sanity == '\0') __err = ios_base::goodbit; else --- 572,578 ---- // Stage 2: convert and store results. char* __sanity; ! errno = 0; ! __v = strtoull(__xtrc, &__sanity, __base); ! if (__sanity != __xtrc && *__sanity == '\0' && errno == 0) __err = ios_base::goodbit; else *************** namespace std *** 571,577 **** // Stage 2: convert and store results. char* __sanity; //__v = strtof(__xtrc, &__sanity, __base); __v = strtof(__xtrc, &__sanity); ! if (__sanity != __xtrc && *__sanity == '\0') __err = ios_base::goodbit; else --- 598,605 ---- // Stage 2: convert and store results. char* __sanity; + errno = 0; //__v = strtof(__xtrc, &__sanity, __base); __v = strtof(__xtrc, &__sanity); ! if (__sanity != __xtrc && *__sanity == '\0' && errno == 0) __err = ios_base::goodbit; else *************** namespace std *** 596,602 **** // Stage 2: convert and store results. char* __sanity; //__v = strtod(__xtrc, &__sanity, __base); __v = strtod(__xtrc, &__sanity); ! if (__sanity != __xtrc && *__sanity == '\0') __err = ios_base::goodbit; else --- 624,631 ---- // Stage 2: convert and store results. char* __sanity; + errno = 0; //__v = strtod(__xtrc, &__sanity, __base); __v = strtod(__xtrc, &__sanity); ! if (__sanity != __xtrc && *__sanity == '\0' && errno == 0) __err = ios_base::goodbit; else *************** namespace std *** 621,627 **** // Stage 2: convert and store results. char* __sanity; //__v = strtold(__xtrc, &__sanity, __base); __v = strtold(__xtrc, &__sanity); ! if (__sanity != __xtrc && *__sanity == '\0') __err = ios_base::goodbit; else --- 650,657 ---- // Stage 2: convert and store results. char* __sanity; + errno = 0; //__v = strtold(__xtrc, &__sanity, __base); __v = strtold(__xtrc, &__sanity); ! if (__sanity != __xtrc && *__sanity == '\0' && errno == 0) __err = ios_base::goodbit; else *************** namespace std *** 646,651 **** // Stage 2: convert and store results. char* __sanity; __v = reinterpret_cast<void*>(strtol(__xtrc, &__sanity, __base)); ! if (__sanity != __xtrc && *__sanity == '\0') __err = ios_base::goodbit; else --- 676,682 ---- // Stage 2: convert and store results. char* __sanity; + errno = 0; __v = reinterpret_cast<void*>(strtol(__xtrc, &__sanity, __base)); ! if (__sanity != __xtrc && *__sanity == '\0' && errno == 0) __err = ios_base::goodbit; else