diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-06-13 09:52:14 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-06-13 09:52:14 +0000 |
commit | f4fed3897d93d052ffdab36b224c3fdbee813627 (patch) | |
tree | 2e4ee8c87d1bb9e0d13ac2977c4aea1e11a07707 /libstdc++-v3 | |
parent | 9c098241f5a382e0def0c5eeb1e16d47ec3f8053 (diff) | |
download | gcc-f4fed3897d93d052ffdab36b224c3fdbee813627.tar.gz |
2004-06-13 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (time_get<>::do_get_time,
time_get<>::do_get_date): Use only once _M_extract_via_format,
instead of going through "%X"/"%x" and calling it two times
(+ using widen).
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83059 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 7 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/locale_facets.tcc | 26 |
2 files changed, 19 insertions, 14 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d1cde4bc432..1454a0d4576 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2004-06-13 Paolo Carlini <pcarlini@suse.de> + + * include/bits/locale_facets.tcc (time_get<>::do_get_time, + time_get<>::do_get_date): Use only once _M_extract_via_format, + instead of going through "%X"/"%x" and calling it two times + (+ using widen). + 2004-06-12 Paolo Carlini <pcarlini@suse.de> * include/ext/algorithm: Trivial formatting fixes. diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc index ea723fce99c..c732e09d8c6 100644 --- a/libstdc++-v3/include/bits/locale_facets.tcc +++ b/libstdc++-v3/include/bits/locale_facets.tcc @@ -1724,10 +1724,8 @@ namespace std time_get<_CharT, _InIter>::do_date_order() const { return time_base::no_order; } - // Recursively expand a strftime format string and parse it. Starts w/ %x - // and %X from do_get_time() and do_get_date(), which translate to a more - // specific string, which may contain yet more strings. I.e. %x => %r => - // %H:%M:%S => extracted characters. + // Expand a strftime format string and parse it. E.g., do_get_date() may + // pass %m/%d/%Y => extracted characters. template<typename _CharT, typename _InIter> _InIter time_get<_CharT, _InIter>:: @@ -2056,12 +2054,12 @@ namespace std do_get_time(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, tm* __tm) const { - _CharT __wcs[3]; - const char* __cs = "%X"; const locale& __loc = __io._M_getloc(); - ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc); - __ctype.widen(__cs, __cs + 3, __wcs); - __beg = _M_extract_via_format(__beg, __end, __io, __err, __tm, __wcs); + const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc); + const char_type* __times[2]; + __tp._M_time_formats(__times); + __beg = _M_extract_via_format(__beg, __end, __io, __err, + __tm, __times[0]); if (__beg == __end) __err |= ios_base::eofbit; return __beg; @@ -2073,12 +2071,12 @@ namespace std do_get_date(iter_type __beg, iter_type __end, ios_base& __io, ios_base::iostate& __err, tm* __tm) const { - _CharT __wcs[3]; - const char* __cs = "%x"; const locale& __loc = __io._M_getloc(); - ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc); - __ctype.widen(__cs, __cs + 3, __wcs); - __beg = _M_extract_via_format(__beg, __end, __io, __err, __tm, __wcs); + const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc); + const char_type* __dates[2]; + __tp._M_date_formats(__dates); + __beg = _M_extract_via_format(__beg, __end, __io, __err, + __tm, __dates[0]); if (__beg == __end) __err |= ios_base::eofbit; return __beg; |