Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com>
---
dlls/wininet/internet.c | 42 +++++++++++++++++++++++++----------
dlls/wininet/tests/internet.c | 16 ++++++-------
2 files changed, 38 insertions(+), 20 deletions(-)
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index 59fae2fbc95..61e713f41e2 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -3400,36 +3400,54 @@ BOOL WINAPI InternetTimeToSystemTimeW( LPCWSTR string, SYSTEMTIME* time, DWORD r
* a SYSTEMTIME structure.
*/
- while (*s && !iswalpha( *s )) s++;
- if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0') return TRUE;
+ while (*s && !iswalnum(*s)) s++;
+ if (*s == '\0') return TRUE;
time->wDayOfWeek = 7;
- for (i = 0; i < 7; i++)
+ if (iswalpha(*s))
{
- if (!wcsnicmp( WININET_wkday[i], s, 3 ))
+ if (s[1] == '\0' || s[2] == '\0') return TRUE;
+ for (i = 0; i < 7; i++)
{
- time->wDayOfWeek = i;
- break;
+ if (!wcsnicmp(WININET_wkday[i], s, 3))
+ {
+ time->wDayOfWeek = i;
+ break;
+ }
}
}
+ else
+ {
+ time->wDayOfWeek = *s - '0';
+ ++s;
+ }
if (time->wDayOfWeek > 6) return TRUE;
while (*s && !iswdigit( *s )) s++;
time->wDay = wcstol( s, &end, 10 );
s = end;
- while (*s && !iswalpha( *s )) s++;
- if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0') return TRUE;
+ while (*s && !iswalnum(*s)) s++;
+ if (*s == '\0') return TRUE;
time->wMonth = 0;
- for (i = 0; i < 12; i++)
+ if (iswalpha(*s))
{
- if (!wcsnicmp( WININET_month[i], s, 3 ))
+ if (s[1] == '\0' || s[2] == '\0') return TRUE;
+ for (i = 0; i < 12; i++)
{
- time->wMonth = i + 1;
- break;
+ if (!wcsnicmp(WININET_month[i], s, 3))
+ {
+ time->wMonth = i + 1;
+ break;
+ }
}
}
+ else
+ {
+ time->wMonth = wcstol(s, &end, 10);
+ s = end;
+ }
if (time->wMonth == 0) return TRUE;
while (*s && !iswdigit( *s )) s++;
diff --git a/dlls/wininet/tests/internet.c b/dlls/wininet/tests/internet.c
index 4c2facb635a..317ccf9d6b8 100644
--- a/dlls/wininet/tests/internet.c
+++ b/dlls/wininet/tests/internet.c
@@ -917,14 +917,14 @@ static void test_InternetTimeToSystemTime(void)
{
{ "Fri, 07 Jan 2005 12:06:35 GMT", &expect1, TRUE },
{ " fri, 7 jan 2005 12 06 35", &expect1, TRUE },
- { "Fri, 07-01-2005 12:06:35", &expect1, TRUE, TRUE },
- { "5, 07-01-2005 12:06:35 GMT", &expect1, TRUE, TRUE },
- { "5, 07-01-2005 12:06:35 GMT;", &expect1, TRUE, TRUE },
- { "5, 07-01-2005 12:06:35 GMT123", &expect1, TRUE, TRUE },
- { "2, 11 01 2022 11 13 05", &expect2, TRUE, TRUE },
- { "2, 11-01-2022 11#13^05", &expect2, TRUE, TRUE },
- { "2, 11*01/2022 11+13=05", &expect2, TRUE, TRUE },
- { "2, 11-Jan-2022 11:13:05", &expect2, TRUE, TRUE },
+ { "Fri, 07-01-2005 12:06:35", &expect1, TRUE },
+ { "5, 07-01-2005 12:06:35 GMT", &expect1, TRUE },
+ { "5, 07-01-2005 12:06:35 GMT;", &expect1, TRUE },
+ { "5, 07-01-2005 12:06:35 GMT123", &expect1, TRUE },
+ { "2, 11 01 2022 11 13 05", &expect2, TRUE },
+ { "2, 11-01-2022 11#13^05", &expect2, TRUE },
+ { "2, 11*01/2022 11+13=05", &expect2, TRUE },
+ { "2, 11-Jan-2022 11:13:05", &expect2, TRUE },
{ "Fr", NULL, FALSE },
};
--
2.25.1