msvcrt: Correct hour range for strftime.
Signed-off-by: Jeff Smith <whydoubt@gmail.com> Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
cdb09ed279
commit
bcb1aee8c7
|
@ -1344,12 +1344,10 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max,
|
|||
return 0;
|
||||
break;
|
||||
case 'I':
|
||||
tmp = mstm->tm_hour;
|
||||
if(tmp > 12)
|
||||
tmp -= 12;
|
||||
else if(!tmp)
|
||||
tmp = 12;
|
||||
if(!strftime_int(str, &ret, max, tmp, alternate ? 0 : 2, 1, 12))
|
||||
if(!MSVCRT_CHECK_PMT(mstm->tm_hour>=0 && mstm->tm_hour<=23))
|
||||
goto einval_error;
|
||||
if(!strftime_int(str, &ret, max, (mstm->tm_hour + 11) % 12 + 1,
|
||||
alternate ? 0 : 2, 1, 12))
|
||||
return 0;
|
||||
break;
|
||||
case 'j':
|
||||
|
|
|
@ -965,14 +965,14 @@ static void test_strftime(void)
|
|||
{"%u", "6", { 0, 0, 0, 1, 0, 117, 6, 0, 0 }},
|
||||
{"%u", "", { 0, 0, 0, 1, 0, 117, 7, 0, 0 }, TRUE},
|
||||
{"%h", "Jan", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
|
||||
{"%I", "", { 0, 0, -1, 1, 0, 70, 4, 0, 0 }, FALSE, TRUE},
|
||||
{"%I", "", { 0, 0, -1, 1, 0, 70, 4, 0, 0 }},
|
||||
{"%I", "12", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
|
||||
{"%I", "01", { 0, 0, 1, 1, 0, 70, 4, 0, 0 }},
|
||||
{"%I", "11", { 0, 0, 11, 1, 0, 70, 4, 0, 0 }},
|
||||
{"%I", "12", { 0, 0, 12, 1, 0, 70, 4, 0, 0 }},
|
||||
{"%I", "01", { 0, 0, 13, 1, 0, 70, 4, 0, 0 }},
|
||||
{"%I", "11", { 0, 0, 23, 1, 0, 70, 4, 0, 0 }},
|
||||
{"%I", "", { 0, 0, 24, 1, 0, 70, 4, 0, 0 }, TRUE},
|
||||
{"%I", "", { 0, 0, 24, 1, 0, 70, 4, 0, 0 }},
|
||||
{"%n", "\n", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
|
||||
{"%r", "12:00:00 AM", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }, TRUE},
|
||||
{"%r", "02:00:00 PM", { 0, 0, 14, 1, 0, 121, 6, 0, 0 }, TRUE},
|
||||
|
|
Loading…
Reference in New Issue