aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits/locale_facets.tcc
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include/bits/locale_facets.tcc')
-rw-r--r--libstdc++-v3/include/bits/locale_facets.tcc19
1 files changed, 9 insertions, 10 deletions
diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc
index 39caf632e36..4f6584432fa 100644
--- a/libstdc++-v3/include/bits/locale_facets.tcc
+++ b/libstdc++-v3/include/bits/locale_facets.tcc
@@ -2002,8 +2002,7 @@ namespace std
for (size_t __i2 = 1; __i2 < __nmatches; ++__i2)
__minlen = std::min(__minlen,
__traits_type::length(__names[__matches[__i2]]));
- ++__pos;
- ++__beg;
+ ++__beg, ++__pos;
if (__pos < __minlen && __beg != __end)
for (size_t __i3 = 0; __i3 < __nmatches;)
{
@@ -2020,8 +2019,7 @@ namespace std
if (__nmatches == 1)
{
// Make sure found name is completely extracted.
- ++__pos;
- ++__beg;
+ ++__beg, ++__pos;
__name = __names[__matches[0]];
const size_t __len = __traits_type::length(__name);
while (__pos < __len && __beg != __end && __name[__pos] == *__beg)
@@ -2094,7 +2092,7 @@ namespace std
// __days array with the same index points to a day, and that
// day's abbreviated form.
// 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]);
__tp._M_days(__days);
@@ -2109,9 +2107,10 @@ namespace std
if (__len != __pos)
__err |= ios_base::failbit;
}
- if (!__err)
- __tm->tm_wday = __tmpwday;
}
+ if (!__err)
+ __tm->tm_wday = __tmpwday;
+
if (__beg == __end)
__err |= ios_base::eofbit;
return __beg;
@@ -2139,7 +2138,7 @@ namespace std
// __months array with the same index points to a month, and that
// month's abbreviated form.
// 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]);
__tp._M_months(__months);
@@ -2154,9 +2153,9 @@ namespace std
if (__len != __pos)
__err |= ios_base::failbit;
}
- if (!__err)
- __tm->tm_mon = __tmpmon;
}
+ if (!__err)
+ __tm->tm_mon = __tmpmon;
if (__beg == __end)
__err |= ios_base::eofbit;