[PATCH resend] wininet: Support more internet time format.
Jacek Caban
jacek at codeweavers.com
Fri Feb 18 04:42:18 CST 2022
Hi Ziqing,
On 2/14/22 02:43, Ziqing Hui wrote:
> Signed-off-by: Ziqing Hui <zhui at 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
This else branch will be executed for any Unicode digit, not only '0' -
'9'. Something like an explicit comparison to '0' and '9' would be
better (and yeah, we already got it wrong in other places in this function).
> + {
> + time->wDayOfWeek = *s - '0';
> + ++s;
> + }
I'm not sure how we should behave if more digits were given in input,
but it seems that we could just use wcstol() here (and let it fail day >
6 tests).
Thanks,
Jacek
More information about the wine-devel
mailing list