Re: [5/6]wininet: handle cookie expiration
Aric Stewart <aric(a)codeweavers.com> writes:
+ LPCWSTR ptr,ptr2; + SYSTEMTIME tm; + int i; + + memset(&tm,0,sizeof(tm)); + + ptr = expiry; + for (i = 0; i < 7; i++) + { + if (strncmpiW(day[i],ptr,3)==0) + { + tm.wDayOfWeek = i; + break; + } + } + ptr += 5; + tm.wDay = strtolW(ptr,(LPWSTR*)&ptr2,10); + ptr = ptr2+1;
You should handle the various possible parsing errors, not just assume that you have a well-formatted string. -- Alexandre Julliard julliard(a)winehq.org
+ LPCWSTR ptr,ptr2; + SYSTEMTIME tm; + int i; + + memset(&tm,0,sizeof(tm)); + + ptr = expiry; + for (i = 0; i < 7; i++) + { + if (strncmpiW(day[i],ptr,3)==0) + { + tm.wDayOfWeek = i; + break; + } + } + ptr += 5; + tm.wDay = strtolW(ptr,(LPWSTR*)&ptr2,10); + ptr = ptr2+1;
You should handle the various possible parsing errors, not just assume that you have a well-formatted string.
Or use InternetTimeToSystemTimeW which does that already. -Hans
Wonderful, I was looking for a function JUST like that. Reworked patch coming up shortly. -aric Hans Leidekker wrote:
+ LPCWSTR ptr,ptr2; + SYSTEMTIME tm; + int i; + + memset(&tm,0,sizeof(tm)); + + ptr = expiry; + for (i = 0; i < 7; i++) + { + if (strncmpiW(day[i],ptr,3)==0) + { + tm.wDayOfWeek = i; + break; + } + } + ptr += 5; + tm.wDay = strtolW(ptr,(LPWSTR*)&ptr2,10); + ptr = ptr2+1; You should handle the various possible parsing errors, not just assume that you have a well-formatted string.
Or use InternetTimeToSystemTimeW which does that already.
-Hans
participants (3)
-
Alexandre Julliard -
Aric Stewart -
Hans Leidekker