msvcrt: Implement %h format for strftime.

Signed-off-by: Vijay Kiran Kamuju <infyquest@gmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Vijay Kiran Kamuju 2019-10-04 19:53:20 +02:00 committed by Alexandre Julliard
parent 6ad18ca33a
commit 8e1435ef81
3 changed files with 12 additions and 0 deletions

View File

@ -628,6 +628,11 @@ static void test_strftime(void)
ok(retA == 0, "expected 0, got %ld\n", retA);
ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
errno = 0xdeadbeef;
retA = p_strftime(bufA, 256, "%h", gmt_tm);
ok(retA == 0, "expected 0, got %ld\n", retA);
ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
errno = 0xdeadbeef;
retA = p_strftime(bufA, 256, "%R", gmt_tm);
ok(retA == 0, "expected 0, got %ld\n", retA);

View File

@ -1142,6 +1142,9 @@ static MSVCRT_size_t strftime_helper(char *str, MSVCRT_size_t max, const char *f
return 0;
break;
case 'b':
#if _MSVCR_VER>=140
case 'h':
#endif
if(mstm->tm_mon<0 || mstm->tm_mon>11)
goto einval_error;
if(!strftime_str(str, &ret, max, time_data->str.names.short_mon[mstm->tm_mon]))

View File

@ -938,6 +938,10 @@ static void test_strftime(void)
retA = p_strftime(bufA, sizeof(bufA), "%#T", &epoch);
ok(retA == 5, "expected 5, got %d\n", (int)retA);
ok(!strcmp(bufA, "0:0:0"), "got %s\n", bufA);
retA = p_strftime(bufA, sizeof(bufA), "%h", &epoch);
ok(retA == 3, "expected 3, got %d\n", (int)retA);
ok(!strcmp(bufA, "Jan"), "got %s\n", bufA);
}
static LONG* get_failures_counter(HANDLE *map)