diff options
-rw-r--r-- | libstdc++-v3/ChangeLog | 11 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/fstream.tcc | 1 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/istream.tcc | 3 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/locale_facets.h | 1 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/locale_facets.tcc | 38 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/ostream.tcc | 3 |
6 files changed, 41 insertions, 16 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index eec8bf9bb46..cb0c9a384d6 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,14 @@ +2003-11-03 Benjamin Kosnik <bkoz@redhat.com> + + * include/bits/locale_facets.h (time_get::_M_extract_name): Add + ctype argument. + * include/bits/locale_facets.tcc: Same, use it to allow + capitalized names. + + * include/bits/fstream.tcc: Spacing tweak. + * include/bits/istream.tcc: Same. + * include/bits/ostream.tcc: Same. + 2003-10-30 Paolo Carlini <pcarlini@suse.de> * include/bits/locale_facets.tcc (time_get::_M_extract_via_format): diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc index a93459a71f3..29fe0e8d6c6 100644 --- a/libstdc++-v3/include/bits/fstream.tcc +++ b/libstdc++-v3/include/bits/fstream.tcc @@ -610,7 +610,6 @@ namespace std __computed_off += _M_ext_buf + __gptr_off - _M_ext_end; } } - __ret = _M_seek(__computed_off, __way); } _M_last_overflowed = false; diff --git a/libstdc++-v3/include/bits/istream.tcc b/libstdc++-v3/include/bits/istream.tcc index 1ae7cba126f..f9ff41d35f8 100644 --- a/libstdc++-v3/include/bits/istream.tcc +++ b/libstdc++-v3/include/bits/istream.tcc @@ -63,7 +63,8 @@ namespace std __c = __sb->snextc(); // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 195. Should basic_istream::sentry's constructor ever set eofbit? + // 195. Should basic_istream::sentry's constructor ever + // 195. set eofbit? if (traits_type::eq_int_type(__c, __eof)) __in.setstate(ios_base::eofbit); } diff --git a/libstdc++-v3/include/bits/locale_facets.h b/libstdc++-v3/include/bits/locale_facets.h index f55685d09a6..a433e6c69ac 100644 --- a/libstdc++-v3/include/bits/locale_facets.h +++ b/libstdc++-v3/include/bits/locale_facets.h @@ -1519,6 +1519,7 @@ namespace std void _M_extract_name(iter_type& __beg, iter_type& __end, int& __member, const _CharT** __names, size_t __indexlen, + const ctype<_CharT>& __ctype, ios_base::iostate& __err) const; // Extract on a component-by-component basis, via __format argument. diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc index 8dd98efe068..58e028441c7 100644 --- a/libstdc++-v3/include/bits/locale_facets.tcc +++ b/libstdc++-v3/include/bits/locale_facets.tcc @@ -1533,7 +1533,7 @@ namespace std const _CharT* __format) const { const locale __loc = __io.getloc(); - __timepunct<_CharT> const& __tp = use_facet<__timepunct<_CharT> >(__loc); + const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc); const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); const size_t __len = char_traits<_CharT>::length(__format); @@ -1556,14 +1556,14 @@ namespace std const char_type* __days1[7]; __tp._M_days_abbreviated(__days1); _M_extract_name(__beg, __end, __tm->tm_wday, __days1, 7, - __err); + __ctype, __err); break; case 'A': // Weekday name [tm_wday]. const char_type* __days2[7]; __tp._M_days(__days2); _M_extract_name(__beg, __end, __tm->tm_wday, __days2, 7, - __err); + __ctype, __err); break; case 'h': case 'b': @@ -1571,14 +1571,14 @@ namespace std const char_type* __months1[12]; __tp._M_months_abbreviated(__months1); _M_extract_name(__beg, __end, __tm->tm_mon, __months1, 12, - __err); + __ctype, __err); break; case 'B': // Month name [tm_mon]. const char_type* __months2[12]; __tp._M_months(__months2); _M_extract_name(__beg, __end, __tm->tm_mon, __months2, 12, - __err); + __ctype, __err); break; case 'c': // Default time and date representation. @@ -1697,7 +1697,7 @@ namespace std int __tmp; _M_extract_name(__beg, __end, __tmp, __timepunct_cache<_CharT>::_S_timezones, - 14, __err); + 14, __ctype, __err); // GMT requires special effort. if (__beg != __end && !__err && __tmp == 0 @@ -1764,6 +1764,7 @@ namespace std time_get<_CharT, _InIter>:: _M_extract_name(iter_type& __beg, iter_type& __end, int& __member, const _CharT** __names, size_t __indexlen, + const ctype<_CharT>& __ctype, ios_base::iostate& __err) const { typedef char_traits<_CharT> __traits_type; @@ -1774,12 +1775,16 @@ namespace std bool __testvalid = true; const char_type* __name; - // Look for initial matches. + // Look for initial matches. + // NB: Some of the locale data is in the form of all lowercase + // names, and some is in the form of initially-capitalized + // names. Look for both. if (__beg != __end) { const char_type __c = *__beg; for (size_t __i1 = 0; __i1 < __indexlen; ++__i1) - if (__c == __names[__i1][0]) + if (__c == __names[__i1][0] + || __c == __ctype.toupper(__names[__i1][0])) __matches[__nmatches++] = __i1; } @@ -1807,6 +1812,13 @@ namespace std if (__nmatches == 1) { + // If there was only one match, the first compare is redundant. + if (__pos == 0) + { + ++__pos; + ++__beg; + } + // Make sure found name is completely extracted. __name = __names[__matches[0]]; const size_t __len = __traits_type::length(__name); @@ -1866,11 +1878,12 @@ namespace std { typedef char_traits<_CharT> __traits_type; const locale __loc = __io.getloc(); - __timepunct<_CharT> const& __tp = use_facet<__timepunct<_CharT> >(__loc); + const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc); + const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); const char_type* __days[7]; __tp._M_days_abbreviated(__days); int __tmpwday; - _M_extract_name(__beg, __end, __tmpwday, __days, 7, __err); + _M_extract_name(__beg, __end, __tmpwday, __days, 7, __ctype, __err); // Check to see if non-abbreviated name exists, and extract. // NB: Assumes both _M_days and _M_days_abbreviated organized in @@ -1909,11 +1922,12 @@ namespace std { typedef char_traits<_CharT> __traits_type; const locale __loc = __io.getloc(); - __timepunct<_CharT> const& __tp = use_facet<__timepunct<_CharT> >(__loc); + const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc); + const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); const char_type* __months[12]; __tp._M_months_abbreviated(__months); int __tmpmon; - _M_extract_name(__beg, __end, __tmpmon, __months, 12, __err); + _M_extract_name(__beg, __end, __tmpmon, __months, 12, __ctype, __err); // Check to see if non-abbreviated name exists, and extract. // NB: Assumes both _M_months and _M_months_abbreviated organized in diff --git a/libstdc++-v3/include/bits/ostream.tcc b/libstdc++-v3/include/bits/ostream.tcc index df63364522b..c126eb8df25 100644 --- a/libstdc++-v3/include/bits/ostream.tcc +++ b/libstdc++-v3/include/bits/ostream.tcc @@ -673,8 +673,7 @@ namespace std // 25. String operator<< uses width() value wrong if (__w > __len) { - _CharT* __cs = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) - * __w)); + _CharT* __cs = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __w)); __pad<_CharT, _Traits>::_S_pad(__out, __out.fill(), __cs, __s, __w, __len, false); __s = __cs; |