Commit cdb09ed2 authored by Jeff Smith's avatar Jeff Smith Committed by Alexandre Julliard

msvcrt: Correct day-of-month range for strftime.

parent 15bbe646
...@@ -1052,7 +1052,7 @@ static inline BOOL strftime_format(STRFTIME_CHAR *str, MSVCRT_size_t *pos, MSVCR ...@@ -1052,7 +1052,7 @@ static inline BOOL strftime_format(STRFTIME_CHAR *str, MSVCRT_size_t *pos, MSVCR
switch(count) { switch(count) {
case 1: case 1:
case 2: case 2:
ret = strftime_int(str, pos, max, mstm->tm_mday, count==1 ? 0 : 2, 0, 31); ret = strftime_int(str, pos, max, mstm->tm_mday, count==1 ? 0 : 2, 1, 31);
break; break;
case 3: case 3:
ret = strftime_str(str, pos, max, STRFTIME_TD(time_data, short_wday)[mstm->tm_wday]); ret = strftime_str(str, pos, max, STRFTIME_TD(time_data, short_wday)[mstm->tm_wday]);
...@@ -1286,7 +1286,7 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max, ...@@ -1286,7 +1286,7 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max,
break; break;
#endif #endif
case 'd': case 'd':
if(!strftime_int(str, &ret, max, mstm->tm_mday, alternate ? 0 : 2, 0, 31)) if(!strftime_int(str, &ret, max, mstm->tm_mday, alternate ? 0 : 2, 1, 31))
return 0; return 0;
break; break;
#if _MSVCR_VER>=140 #if _MSVCR_VER>=140
...@@ -1297,7 +1297,7 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max, ...@@ -1297,7 +1297,7 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max,
return 0; return 0;
if(ret < max) if(ret < max)
str[ret++] = '/'; str[ret++] = '/';
if(!strftime_int(str, &ret, max, mstm->tm_mday, alternate ? 0 : 2, 0, 31)) if(!strftime_int(str, &ret, max, mstm->tm_mday, alternate ? 0 : 2, 1, 31))
return 0; return 0;
if(ret < max) if(ret < max)
str[ret++] = '/'; str[ret++] = '/';
...@@ -1305,7 +1305,7 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max, ...@@ -1305,7 +1305,7 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max,
return 0; return 0;
break; break;
case 'e': case 'e':
if(!strftime_int(str, &ret, max, mstm->tm_mday, alternate ? 0 : 2, 0, 31)) if(!strftime_int(str, &ret, max, mstm->tm_mday, alternate ? 0 : 2, 1, 31))
return 0; return 0;
if(!alternate && str[ret-2] == '0') if(!alternate && str[ret-2] == '0')
str[ret-2] = ' '; str[ret-2] = ' ';
...@@ -1319,7 +1319,7 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max, ...@@ -1319,7 +1319,7 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max,
return 0; return 0;
if(ret < max) if(ret < max)
str[ret++] = '-'; str[ret++] = '-';
if(!strftime_int(str, &ret, max, mstm->tm_mday, alternate ? 0 : 2, 0, 31)) if(!strftime_int(str, &ret, max, mstm->tm_mday, alternate ? 0 : 2, 1, 31))
return 0; return 0;
break; break;
case 'g': case 'g':
......
...@@ -937,7 +937,7 @@ static void test_strftime(void) ...@@ -937,7 +937,7 @@ static void test_strftime(void)
{"%C", "19", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }}, {"%C", "19", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%C", "99", { 0, 0, 0, 1, 0, 8099, 4, 0, 0 }}, {"%C", "99", { 0, 0, 0, 1, 0, 8099, 4, 0, 0 }},
{"%C", "", { 0, 0, 0, 1, 0, 8100, 4, 0, 0 }}, {"%C", "", { 0, 0, 0, 1, 0, 8100, 4, 0, 0 }},
{"%d", "", { 0, 0, 0, 0, 0, 70, 4, 0, 0 }, TRUE}, {"%d", "", { 0, 0, 0, 0, 0, 70, 4, 0, 0 }, FALSE, TRUE},
{"%d", "01", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }}, {"%d", "01", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%d", "31", { 0, 0, 0, 31, 0, 70, 4, 0, 0 }}, {"%d", "31", { 0, 0, 0, 31, 0, 70, 4, 0, 0 }},
{"%d", "", { 0, 0, 0, 32, 0, 70, 4, 0, 0 }, FALSE, TRUE}, {"%d", "", { 0, 0, 0, 32, 0, 70, 4, 0, 0 }, FALSE, TRUE},
...@@ -948,7 +948,7 @@ static void test_strftime(void) ...@@ -948,7 +948,7 @@ static void test_strftime(void)
{"%D", "01/01/99", { 0, 0, 0, 1, 0, 8099, 4, 0, 0 }}, {"%D", "01/01/99", { 0, 0, 0, 1, 0, 8099, 4, 0, 0 }},
{"%D", "", { 0, 0, 0, 1, 0, 8100, 4, 0, 0 }}, {"%D", "", { 0, 0, 0, 1, 0, 8100, 4, 0, 0 }},
{"%#D", "1/1/70", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }}, {"%#D", "1/1/70", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%e", "", { 0, 0, 0, 0, 0, 70, 4, 0, 0 }, TRUE}, {"%e", "", { 0, 0, 0, 0, 0, 70, 4, 0, 0 }, FALSE, TRUE},
{"%e", " 1", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }}, {"%e", " 1", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%e", "31", { 0, 0, 0, 31, 0, 70, 4, 0, 0 }}, {"%e", "31", { 0, 0, 0, 31, 0, 70, 4, 0, 0 }},
{"%e", "", { 0, 0, 0, 32, 0, 70, 4, 0, 0 }, FALSE, TRUE}, {"%e", "", { 0, 0, 0, 32, 0, 70, 4, 0, 0 }, FALSE, TRUE},
......
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