forked from HowardHinnant/date
Have parse of %p set failbit if unsuccessful.
This commit is contained in:
10
date.h
10
date.h
@@ -5845,14 +5845,14 @@ from_stream(std::basic_istream<CharT, Traits>& is, const CharT* fmt,
|
|||||||
{
|
{
|
||||||
if (I == not_a_hour_12_value)
|
if (I == not_a_hour_12_value)
|
||||||
goto broken;
|
goto broken;
|
||||||
|
tm = std::tm{};
|
||||||
tm.tm_hour = I;
|
tm.tm_hour = I;
|
||||||
ios_base::iostate err = ios_base::goodbit;
|
ios_base::iostate err = ios_base::goodbit;
|
||||||
f.get(is, 0, is, err, &tm, command, fmt+1);
|
f.get(is, 0, is, err, &tm, command, fmt+1);
|
||||||
if (!(err & ios::failbit))
|
if (err & ios::failbit)
|
||||||
{
|
goto broken;
|
||||||
h = hours{tm.tm_hour};
|
h = hours{tm.tm_hour};
|
||||||
I = not_a_hour_12_value;
|
I = not_a_hour_12_value;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
read(is, CharT{'%'}, width, modified, *fmt);
|
read(is, CharT{'%'}, width, modified, *fmt);
|
||||||
|
Reference in New Issue
Block a user