Commit cf5c6c8d by Paolo Carlini Committed by Paolo Carlini

locale_facets.tcc (time_get<>::do_get_weekday, [...]): Absolutely avoid…

locale_facets.tcc (time_get<>::do_get_weekday, [...]): Absolutely avoid dereferencing end iterators.

2004-11-09  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/locale_facets.tcc (time_get<>::do_get_weekday,
	time_get<>::do_get_monthname): Absolutely avoid dereferencing
	end iterators.

	* include/bits/locale_facets.tcc (time_get<>::_M_extract_name):
	Minor tweak.

From-SVN: r90341
parent 37d060a3
2004-11-09 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (time_get<>::do_get_weekday,
time_get<>::do_get_monthname): Absolutely avoid dereferencing
end iterators.
* include/bits/locale_facets.tcc (time_get<>::_M_extract_name):
Minor tweak.
2004-11-08 Benjamin Kosnik <bkoz@redhat.com> 2004-11-08 Benjamin Kosnik <bkoz@redhat.com>
Doug Gregor <dgregor@cs.indiana.edu> Doug Gregor <dgregor@cs.indiana.edu>
......
...@@ -2043,8 +2043,7 @@ namespace std ...@@ -2043,8 +2043,7 @@ namespace std
for (size_t __i2 = 1; __i2 < __nmatches; ++__i2) for (size_t __i2 = 1; __i2 < __nmatches; ++__i2)
__minlen = std::min(__minlen, __minlen = std::min(__minlen,
__traits_type::length(__names[__matches[__i2]])); __traits_type::length(__names[__matches[__i2]]));
++__pos; ++__beg, ++__pos;
++__beg;
if (__pos < __minlen && __beg != __end) if (__pos < __minlen && __beg != __end)
for (size_t __i3 = 0; __i3 < __nmatches;) for (size_t __i3 = 0; __i3 < __nmatches;)
{ {
...@@ -2061,8 +2060,7 @@ namespace std ...@@ -2061,8 +2060,7 @@ namespace std
if (__nmatches == 1) if (__nmatches == 1)
{ {
// Make sure found name is completely extracted. // Make sure found name is completely extracted.
++__pos; ++__beg, ++__pos;
++__beg;
__name = __names[__matches[0]]; __name = __names[__matches[0]];
const size_t __len = __traits_type::length(__name); const size_t __len = __traits_type::length(__name);
while (__pos < __len && __beg != __end && __name[__pos] == *__beg) while (__pos < __len && __beg != __end && __name[__pos] == *__beg)
...@@ -2135,7 +2133,7 @@ namespace std ...@@ -2135,7 +2133,7 @@ namespace std
// __days array with the same index points to a day, and that // __days array with the same index points to a day, and that
// day's abbreviated form. // day's abbreviated form.
// NB: Also assumes that an abbreviated name is a subset of the name. // NB: Also assumes that an abbreviated name is a subset of the name.
if (!__err) if (!__err && __beg != __end)
{ {
size_t __pos = __traits_type::length(__days[__tmpwday]); size_t __pos = __traits_type::length(__days[__tmpwday]);
__tp._M_days(__days); __tp._M_days(__days);
...@@ -2150,9 +2148,10 @@ namespace std ...@@ -2150,9 +2148,10 @@ namespace std
if (__len != __pos) if (__len != __pos)
__err |= ios_base::failbit; __err |= ios_base::failbit;
} }
if (!__err)
__tm->tm_wday = __tmpwday;
} }
if (!__err)
__tm->tm_wday = __tmpwday;
if (__beg == __end) if (__beg == __end)
__err |= ios_base::eofbit; __err |= ios_base::eofbit;
return __beg; return __beg;
...@@ -2180,7 +2179,7 @@ namespace std ...@@ -2180,7 +2179,7 @@ namespace std
// __months array with the same index points to a month, and that // __months array with the same index points to a month, and that
// month's abbreviated form. // month's abbreviated form.
// NB: Also assumes that an abbreviated name is a subset of the name. // NB: Also assumes that an abbreviated name is a subset of the name.
if (!__err) if (!__err && __beg != __end)
{ {
size_t __pos = __traits_type::length(__months[__tmpmon]); size_t __pos = __traits_type::length(__months[__tmpmon]);
__tp._M_months(__months); __tp._M_months(__months);
...@@ -2195,9 +2194,9 @@ namespace std ...@@ -2195,9 +2194,9 @@ namespace std
if (__len != __pos) if (__len != __pos)
__err |= ios_base::failbit; __err |= ios_base::failbit;
} }
if (!__err)
__tm->tm_mon = __tmpmon;
} }
if (!__err)
__tm->tm_mon = __tmpmon;
if (__beg == __end) if (__beg == __end)
__err |= ios_base::eofbit; __err |= ios_base::eofbit;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment