Commit e3057aea authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

winhttp: Build with msvcrt.

parent 5a212dff
...@@ -3,6 +3,8 @@ IMPORTLIB = winhttp ...@@ -3,6 +3,8 @@ IMPORTLIB = winhttp
IMPORTS = uuid jsproxy user32 advapi32 ws2_32 IMPORTS = uuid jsproxy user32 advapi32 ws2_32
DELAYIMPORTS = oleaut32 ole32 crypt32 secur32 iphlpapi dhcpcsvc DELAYIMPORTS = oleaut32 ole32 crypt32 secur32 iphlpapi dhcpcsvc
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \ C_SRCS = \
cookie.c \ cookie.c \
handle.c \ handle.c \
......
...@@ -16,12 +16,12 @@ ...@@ -16,12 +16,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "ws2tcpip.h"
#include <stdarg.h> #include <stdarg.h>
#include <wchar.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "ws2tcpip.h"
#include "winhttp.h" #include "winhttp.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -69,7 +69,7 @@ static struct cookie *find_cookie( struct domain *domain, const WCHAR *path, con ...@@ -69,7 +69,7 @@ static struct cookie *find_cookie( struct domain *domain, const WCHAR *path, con
LIST_FOR_EACH( item, &domain->cookies ) LIST_FOR_EACH( item, &domain->cookies )
{ {
cookie = LIST_ENTRY( item, struct cookie, entry ); cookie = LIST_ENTRY( item, struct cookie, entry );
if (!strcmpW( cookie->path, path ) && !strcmpW( cookie->name, name )) if (!wcscmp( cookie->path, path ) && !wcscmp( cookie->name, name ))
{ {
TRACE("found %s=%s\n", debugstr_w(cookie->name), debugstr_w(cookie->value)); TRACE("found %s=%s\n", debugstr_w(cookie->name), debugstr_w(cookie->value));
return cookie; return cookie;
...@@ -82,8 +82,8 @@ static BOOL domain_match( const WCHAR *name, struct domain *domain, BOOL partial ...@@ -82,8 +82,8 @@ static BOOL domain_match( const WCHAR *name, struct domain *domain, BOOL partial
{ {
TRACE("comparing %s with %s\n", debugstr_w(name), debugstr_w(domain->name)); TRACE("comparing %s with %s\n", debugstr_w(name), debugstr_w(domain->name));
if (partial && !strstrW( name, domain->name )) return FALSE; if (partial && !wcsstr( name, domain->name )) return FALSE;
else if (!partial && strcmpW( name, domain->name )) return FALSE; else if (!partial && wcscmp( name, domain->name )) return FALSE;
return TRUE; return TRUE;
} }
...@@ -165,7 +165,7 @@ static struct cookie *parse_cookie( const WCHAR *string ) ...@@ -165,7 +165,7 @@ static struct cookie *parse_cookie( const WCHAR *string )
const WCHAR *p; const WCHAR *p;
int len; int len;
if (!(p = strchrW( string, '=' ))) p = string + strlenW( string ); if (!(p = wcschr( string, '=' ))) p = string + lstrlenW( string );
len = p - string; len = p - string;
while (len && string[len - 1] == ' ') len--; while (len && string[len - 1] == ' ') len--;
if (!len) return NULL; if (!len) return NULL;
...@@ -184,7 +184,7 @@ static struct cookie *parse_cookie( const WCHAR *string ) ...@@ -184,7 +184,7 @@ static struct cookie *parse_cookie( const WCHAR *string )
if (*p++ == '=') if (*p++ == '=')
{ {
while (*p == ' ') p++; while (*p == ' ') p++;
len = strlenW( p ); len = lstrlenW( p );
while (len && p[len - 1] == ' ') len--; while (len && p[len - 1] == ' ') len--;
if (!(cookie->value = heap_alloc( (len + 1) * sizeof(WCHAR) ))) if (!(cookie->value = heap_alloc( (len + 1) * sizeof(WCHAR) )))
...@@ -272,9 +272,9 @@ BOOL set_cookies( struct request *request, const WCHAR *cookies ) ...@@ -272,9 +272,9 @@ BOOL set_cookies( struct request *request, const WCHAR *cookies )
struct cookie *cookie; struct cookie *cookie;
int len, used; int len, used;
len = strlenW( cookies ); len = lstrlenW( cookies );
if (!(buffer = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return FALSE; if (!(buffer = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return FALSE;
strcpyW( buffer, cookies ); lstrcpyW( buffer, cookies );
p = buffer; p = buffer;
while (*p && *p != ';') p++; while (*p && *p != ';') p++;
...@@ -284,15 +284,15 @@ BOOL set_cookies( struct request *request, const WCHAR *cookies ) ...@@ -284,15 +284,15 @@ BOOL set_cookies( struct request *request, const WCHAR *cookies )
heap_free( buffer ); heap_free( buffer );
return FALSE; return FALSE;
} }
len = strlenW( p ); len = lstrlenW( p );
while (len && (attr = parse_attr( p, &used ))) while (len && (attr = parse_attr( p, &used )))
{ {
if (!strcmpiW( attr->name, domainW )) if (!wcsicmp( attr->name, domainW ))
{ {
domain = attr; domain = attr;
cookie_domain = attr->value; cookie_domain = attr->value;
} }
else if (!strcmpiW( attr->name, pathW )) else if (!wcsicmp( attr->name, pathW ))
{ {
path = attr; path = attr;
cookie_path = attr->value; cookie_path = attr->value;
...@@ -308,7 +308,7 @@ BOOL set_cookies( struct request *request, const WCHAR *cookies ) ...@@ -308,7 +308,7 @@ BOOL set_cookies( struct request *request, const WCHAR *cookies )
if (!cookie_domain && !(cookie_domain = strdupW( request->connect->servername ))) goto end; if (!cookie_domain && !(cookie_domain = strdupW( request->connect->servername ))) goto end;
if (!cookie_path && !(cookie_path = strdupW( request->path ))) goto end; if (!cookie_path && !(cookie_path = strdupW( request->path ))) goto end;
if ((p = strrchrW( cookie_path, '/' )) && p != cookie_path) *p = 0; if ((p = wcsrchr( cookie_path, '/' )) && p != cookie_path) *p = 0;
ret = add_cookie( session, cookie, cookie_domain, cookie_path ); ret = add_cookie( session, cookie, cookie_domain, cookie_path );
end: end:
...@@ -342,14 +342,14 @@ BOOL add_cookie_headers( struct request *request ) ...@@ -342,14 +342,14 @@ BOOL add_cookie_headers( struct request *request )
TRACE("comparing path %s with %s\n", debugstr_w(request->path), debugstr_w(cookie->path)); TRACE("comparing path %s with %s\n", debugstr_w(request->path), debugstr_w(cookie->path));
if (strstrW( request->path, cookie->path ) == request->path) if (wcsstr( request->path, cookie->path ) == request->path)
{ {
static const WCHAR cookieW[] = {'C','o','o','k','i','e',':',' '}; static const WCHAR cookieW[] = {'C','o','o','k','i','e',':',' '};
int len, len_cookie = ARRAY_SIZE( cookieW ), len_name = strlenW( cookie->name ); int len, len_cookie = ARRAY_SIZE( cookieW ), len_name = lstrlenW( cookie->name );
WCHAR *header; WCHAR *header;
len = len_cookie + len_name; len = len_cookie + len_name;
if (cookie->value) len += strlenW( cookie->value ) + 1; if (cookie->value) len += lstrlenW( cookie->value ) + 1;
if (!(header = heap_alloc( (len + 1) * sizeof(WCHAR) ))) if (!(header = heap_alloc( (len + 1) * sizeof(WCHAR) )))
{ {
LeaveCriticalSection( &session->cs ); LeaveCriticalSection( &session->cs );
...@@ -357,11 +357,11 @@ BOOL add_cookie_headers( struct request *request ) ...@@ -357,11 +357,11 @@ BOOL add_cookie_headers( struct request *request )
} }
memcpy( header, cookieW, len_cookie * sizeof(WCHAR) ); memcpy( header, cookieW, len_cookie * sizeof(WCHAR) );
strcpyW( header + len_cookie, cookie->name ); lstrcpyW( header + len_cookie, cookie->name );
if (cookie->value) if (cookie->value)
{ {
header[len_cookie + len_name] = '='; header[len_cookie + len_name] = '=';
strcpyW( header + len_cookie + len_name + 1, cookie->value ); lstrcpyW( header + len_cookie + len_name + 1, cookie->value );
} }
TRACE("%s\n", debugstr_w(header)); TRACE("%s\n", debugstr_w(header));
......
...@@ -18,12 +18,11 @@ ...@@ -18,12 +18,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "ws2tcpip.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "ws2tcpip.h"
#include "winhttp.h" #include "winhttp.h"
#include "wine/debug.h" #include "wine/debug.h"
......
...@@ -16,13 +16,12 @@ ...@@ -16,13 +16,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#define COBJMACROS
#include "config.h"
#include "ws2tcpip.h"
#include <stdarg.h> #include <stdarg.h>
#define COBJMACROS
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "ws2tcpip.h"
#include "objbase.h" #include "objbase.h"
#include "rpcproxy.h" #include "rpcproxy.h"
#include "httprequest.h" #include "httprequest.h"
......
...@@ -17,20 +17,17 @@ ...@@ -17,20 +17,17 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#define NONAMELESSUNION
#include "ws2tcpip.h"
#include <stdarg.h>
#include <stdio.h>
#include <assert.h> #include <assert.h>
#include <stdarg.h>
#define NONAMELESSUNION
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "ws2tcpip.h"
#include "winhttp.h" #include "winhttp.h"
#include "schannel.h" #include "schannel.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/library.h"
#include "winhttp_private.h" #include "winhttp_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(winhttp); WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
...@@ -207,7 +204,9 @@ struct netconn *netconn_create( struct hostdata *host, const struct sockaddr_sto ...@@ -207,7 +204,9 @@ struct netconn *netconn_create( struct hostdata *host, const struct sockaddr_sto
addr_len = sizeof(struct sockaddr_in6); addr_len = sizeof(struct sockaddr_in6);
break; break;
default: default:
assert(0); ERR( "unhandled family %u\n", conn->sockaddr.ss_family );
heap_free( conn );
return NULL;
} }
if (timeout > 0) set_blocking( conn, FALSE ); if (timeout > 0) set_blocking( conn, FALSE );
...@@ -374,7 +373,7 @@ BOOL netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD securi ...@@ -374,7 +373,7 @@ BOOL netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD securi
heap_free(read_buf); heap_free(read_buf);
if(status != SEC_E_OK || res != ERROR_SUCCESS) { if(status != SEC_E_OK || res != ERROR_SUCCESS) {
WARN("Failed to initialize security context failed: %08x\n", status); WARN("Failed to initialize security context: %08x\n", status);
heap_free(conn->ssl_buf); heap_free(conn->ssl_buf);
conn->ssl_buf = NULL; conn->ssl_buf = NULL;
DeleteSecurityContext(&ctx); DeleteSecurityContext(&ctx);
......
...@@ -16,9 +16,7 @@ ...@@ -16,9 +16,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
...@@ -379,7 +377,7 @@ static BOOL domain_matches(LPCWSTR server, LPCWSTR domain) ...@@ -379,7 +377,7 @@ static BOOL domain_matches(LPCWSTR server, LPCWSTR domain)
static const WCHAR localW[] = { '<','l','o','c','a','l','>',0 }; static const WCHAR localW[] = { '<','l','o','c','a','l','>',0 };
BOOL ret = FALSE; BOOL ret = FALSE;
if (!strcmpiW( domain, localW ) && !strchrW( server, '.' )) if (!wcsicmp( domain, localW ) && !wcschr( server, '.' ))
ret = TRUE; ret = TRUE;
else if (*domain == '*') else if (*domain == '*')
{ {
...@@ -391,12 +389,12 @@ static BOOL domain_matches(LPCWSTR server, LPCWSTR domain) ...@@ -391,12 +389,12 @@ static BOOL domain_matches(LPCWSTR server, LPCWSTR domain)
* the wildcard exactly. E.g. if the wildcard is *.a.b, and the * the wildcard exactly. E.g. if the wildcard is *.a.b, and the
* hostname is www.foo.a.b, it matches, but a.b does not. * hostname is www.foo.a.b, it matches, but a.b does not.
*/ */
dot = strchrW( server, '.' ); dot = wcschr( server, '.' );
if (dot) if (dot)
{ {
int len = strlenW( dot + 1 ); int len = lstrlenW( dot + 1 );
if (len > strlenW( domain + 2 )) if (len > lstrlenW( domain + 2 ))
{ {
LPCWSTR ptr; LPCWSTR ptr;
...@@ -404,8 +402,8 @@ static BOOL domain_matches(LPCWSTR server, LPCWSTR domain) ...@@ -404,8 +402,8 @@ static BOOL domain_matches(LPCWSTR server, LPCWSTR domain)
* could be a subdomain. Compare the last portion of the * could be a subdomain. Compare the last portion of the
* server's domain. * server's domain.
*/ */
ptr = dot + len + 1 - strlenW( domain + 2 ); ptr = dot + len + 1 - lstrlenW( domain + 2 );
if (!strcmpiW( ptr, domain + 2 )) if (!wcsicmp( ptr, domain + 2 ))
{ {
/* This is only a match if the preceding character is /* This is only a match if the preceding character is
* a '.', i.e. that it is a matching domain. E.g. * a '.', i.e. that it is a matching domain. E.g.
...@@ -416,12 +414,12 @@ static BOOL domain_matches(LPCWSTR server, LPCWSTR domain) ...@@ -416,12 +414,12 @@ static BOOL domain_matches(LPCWSTR server, LPCWSTR domain)
} }
} }
else else
ret = !strcmpiW( dot + 1, domain + 2 ); ret = !wcsicmp( dot + 1, domain + 2 );
} }
} }
} }
else else
ret = !strcmpiW( server, domain ); ret = !wcsicmp( server, domain );
return ret; return ret;
} }
...@@ -438,9 +436,9 @@ static BOOL should_bypass_proxy(struct session *session, LPCWSTR server) ...@@ -438,9 +436,9 @@ static BOOL should_bypass_proxy(struct session *session, LPCWSTR server)
do { do {
LPCWSTR tmp = ptr; LPCWSTR tmp = ptr;
ptr = strchrW( ptr, ';' ); ptr = wcschr( ptr, ';' );
if (!ptr) if (!ptr)
ptr = strchrW( tmp, ' ' ); ptr = wcschr( tmp, ' ' );
if (ptr) if (ptr)
{ {
if (ptr - tmp < MAX_HOST_NAME_LENGTH) if (ptr - tmp < MAX_HOST_NAME_LENGTH)
...@@ -468,9 +466,9 @@ BOOL set_server_for_hostname( struct connect *connect, const WCHAR *server, INTE ...@@ -468,9 +466,9 @@ BOOL set_server_for_hostname( struct connect *connect, const WCHAR *server, INTE
{ {
LPCWSTR colon; LPCWSTR colon;
if ((colon = strchrW( session->proxy_server, ':' ))) if ((colon = wcschr( session->proxy_server, ':' )))
{ {
if (!connect->servername || strncmpiW( connect->servername, if (!connect->servername || wcsnicmp( connect->servername,
session->proxy_server, colon - session->proxy_server - 1 )) session->proxy_server, colon - session->proxy_server - 1 ))
{ {
heap_free( connect->servername ); heap_free( connect->servername );
...@@ -485,14 +483,14 @@ BOOL set_server_for_hostname( struct connect *connect, const WCHAR *server, INTE ...@@ -485,14 +483,14 @@ BOOL set_server_for_hostname( struct connect *connect, const WCHAR *server, INTE
(colon - session->proxy_server) * sizeof(WCHAR) ); (colon - session->proxy_server) * sizeof(WCHAR) );
connect->servername[colon - session->proxy_server] = 0; connect->servername[colon - session->proxy_server] = 0;
if (*(colon + 1)) if (*(colon + 1))
connect->serverport = atoiW( colon + 1 ); connect->serverport = wcstol( colon + 1, NULL, 10 );
else else
connect->serverport = INTERNET_DEFAULT_PORT; connect->serverport = INTERNET_DEFAULT_PORT;
} }
} }
else else
{ {
if (!connect->servername || strcmpiW( connect->servername, if (!connect->servername || wcsicmp( connect->servername,
session->proxy_server )) session->proxy_server ))
{ {
heap_free( connect->servername ); heap_free( connect->servername );
...@@ -635,7 +633,7 @@ static void request_destroy( struct object_header *hdr ) ...@@ -635,7 +633,7 @@ static void request_destroy( struct object_header *hdr )
static void str_to_buffer( WCHAR *buffer, const WCHAR *str, LPDWORD buflen ) static void str_to_buffer( WCHAR *buffer, const WCHAR *str, LPDWORD buflen )
{ {
int len = 0; int len = 0;
if (str) len = strlenW( str ); if (str) len = lstrlenW( str );
if (buffer && *buflen > len) if (buffer && *buflen > len)
{ {
if (str) memcpy( buffer, str, len * sizeof(WCHAR) ); if (str) memcpy( buffer, str, len * sizeof(WCHAR) );
...@@ -1075,13 +1073,13 @@ static BOOL add_accept_types_header( struct request *request, const WCHAR **type ...@@ -1075,13 +1073,13 @@ static BOOL add_accept_types_header( struct request *request, const WCHAR **type
static WCHAR *get_request_path( const WCHAR *object ) static WCHAR *get_request_path( const WCHAR *object )
{ {
int len = object ? strlenW(object) : 0; int len = object ? lstrlenW(object) : 0;
WCHAR *p, *ret; WCHAR *p, *ret;
if (!object || object[0] != '/') len++; if (!object || object[0] != '/') len++;
if (!(p = ret = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return NULL; if (!(p = ret = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return NULL;
if (!object || object[0] != '/') *p++ = '/'; if (!object || object[0] != '/') *p++ = '/';
if (object) strcpyW( p, object ); if (object) lstrcpyW( p, object );
ret[len] = 0; ret[len] = 0;
return ret; return ret;
} }
...@@ -1421,12 +1419,12 @@ static WCHAR *build_wpad_url( const char *hostname, const struct addrinfo *ai ) ...@@ -1421,12 +1419,12 @@ static WCHAR *build_wpad_url( const char *hostname, const struct addrinfo *ai )
if (!reverse_lookup( ai, name, sizeof(name) )) hostname = name; if (!reverse_lookup( ai, name, sizeof(name) )) hostname = name;
len = strlenW( httpW ) + strlen( hostname ) + strlenW( wpadW ); len = lstrlenW( httpW ) + strlen( hostname ) + lstrlenW( wpadW );
if (!(ret = p = GlobalAlloc( 0, (len + 1) * sizeof(WCHAR) ))) return NULL; if (!(ret = p = GlobalAlloc( 0, (len + 1) * sizeof(WCHAR) ))) return NULL;
strcpyW( p, httpW ); lstrcpyW( p, httpW );
p += strlenW( httpW ); p += lstrlenW( httpW );
while (*hostname) { *p++ = *hostname++; } while (*hostname) { *p++ = *hostname++; }
strcpyW( p, wpadW ); lstrcpyW( p, wpadW );
return ret; return ret;
} }
...@@ -2007,9 +2005,9 @@ BOOL WINAPI WinHttpSetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info ) ...@@ -2007,9 +2005,9 @@ BOOL WINAPI WinHttpSetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
if (info->dwAccessType == WINHTTP_ACCESS_TYPE_NAMED_PROXY) if (info->dwAccessType == WINHTTP_ACCESS_TYPE_NAMED_PROXY)
{ {
size += strlenW( info->lpszProxy ); size += lstrlenW( info->lpszProxy );
if (info->lpszProxyBypass) if (info->lpszProxyBypass)
size += strlenW( info->lpszProxyBypass ); size += lstrlenW( info->lpszProxyBypass );
} }
buf = heap_alloc( size ); buf = heap_alloc( size );
if (buf) if (buf)
...@@ -2025,14 +2023,14 @@ BOOL WINAPI WinHttpSetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info ) ...@@ -2025,14 +2023,14 @@ BOOL WINAPI WinHttpSetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
BYTE *dst; BYTE *dst;
hdr->flags = PROXY_TYPE_PROXY; hdr->flags = PROXY_TYPE_PROXY;
*len++ = strlenW( info->lpszProxy ); *len++ = lstrlenW( info->lpszProxy );
for (dst = (BYTE *)len, src = info->lpszProxy; *src; for (dst = (BYTE *)len, src = info->lpszProxy; *src;
src++, dst++) src++, dst++)
*dst = *src; *dst = *src;
len = (DWORD *)dst; len = (DWORD *)dst;
if (info->lpszProxyBypass) if (info->lpszProxyBypass)
{ {
*len++ = strlenW( info->lpszProxyBypass ); *len++ = lstrlenW( info->lpszProxyBypass );
for (dst = (BYTE *)len, src = info->lpszProxyBypass; *src; for (dst = (BYTE *)len, src = info->lpszProxyBypass; *src;
src++, dst++) src++, dst++)
*dst = *src; *dst = *src;
...@@ -2176,7 +2174,7 @@ BOOL WINAPI WinHttpTimeFromSystemTime( const SYSTEMTIME *time, LPWSTR string ) ...@@ -2176,7 +2174,7 @@ BOOL WINAPI WinHttpTimeFromSystemTime( const SYSTEMTIME *time, LPWSTR string )
return FALSE; return FALSE;
} }
sprintfW( string, format, swprintf( string, WINHTTP_TIME_FORMAT_BUFSIZE / sizeof(WCHAR), format,
wkday[time->wDayOfWeek], wkday[time->wDayOfWeek],
time->wDay, time->wDay,
month[time->wMonth - 1], month[time->wMonth - 1],
...@@ -2215,15 +2213,15 @@ BOOL WINAPI WinHttpTimeToSystemTime( LPCWSTR string, SYSTEMTIME *time ) ...@@ -2215,15 +2213,15 @@ BOOL WINAPI WinHttpTimeToSystemTime( LPCWSTR string, SYSTEMTIME *time )
SetLastError( ERROR_SUCCESS ); SetLastError( ERROR_SUCCESS );
while (*s && !isalphaW( *s )) s++; while (*s && !iswalpha( *s )) s++;
if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0') return TRUE; if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0') return TRUE;
time->wDayOfWeek = 7; time->wDayOfWeek = 7;
for (i = 0; i < 7; i++) for (i = 0; i < 7; i++)
{ {
if (toupperW( wkday[i][0] ) == toupperW( s[0] ) && if (towupper( wkday[i][0] ) == towupper( s[0] ) &&
toupperW( wkday[i][1] ) == toupperW( s[1] ) && towupper( wkday[i][1] ) == towupper( s[1] ) &&
toupperW( wkday[i][2] ) == toupperW( s[2] ) ) towupper( wkday[i][2] ) == towupper( s[2] ) )
{ {
time->wDayOfWeek = i; time->wDayOfWeek = i;
break; break;
...@@ -2231,19 +2229,19 @@ BOOL WINAPI WinHttpTimeToSystemTime( LPCWSTR string, SYSTEMTIME *time ) ...@@ -2231,19 +2229,19 @@ BOOL WINAPI WinHttpTimeToSystemTime( LPCWSTR string, SYSTEMTIME *time )
} }
if (time->wDayOfWeek > 6) return TRUE; if (time->wDayOfWeek > 6) return TRUE;
while (*s && !isdigitW( *s )) s++; while (*s && !iswdigit( *s )) s++;
time->wDay = strtolW( s, &end, 10 ); time->wDay = wcstol( s, &end, 10 );
s = end; s = end;
while (*s && !isalphaW( *s )) s++; while (*s && !iswalpha( *s )) s++;
if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0') return TRUE; if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0') return TRUE;
time->wMonth = 0; time->wMonth = 0;
for (i = 0; i < 12; i++) for (i = 0; i < 12; i++)
{ {
if (toupperW( month[i][0]) == toupperW( s[0] ) && if (towupper( month[i][0]) == towupper( s[0] ) &&
toupperW( month[i][1]) == toupperW( s[1] ) && towupper( month[i][1]) == towupper( s[1] ) &&
toupperW( month[i][2]) == toupperW( s[2] ) ) towupper( month[i][2]) == towupper( s[2] ) )
{ {
time->wMonth = i + 1; time->wMonth = i + 1;
break; break;
...@@ -2251,24 +2249,24 @@ BOOL WINAPI WinHttpTimeToSystemTime( LPCWSTR string, SYSTEMTIME *time ) ...@@ -2251,24 +2249,24 @@ BOOL WINAPI WinHttpTimeToSystemTime( LPCWSTR string, SYSTEMTIME *time )
} }
if (time->wMonth == 0) return TRUE; if (time->wMonth == 0) return TRUE;
while (*s && !isdigitW( *s )) s++; while (*s && !iswdigit( *s )) s++;
if (*s == '\0') return TRUE; if (*s == '\0') return TRUE;
time->wYear = strtolW( s, &end, 10 ); time->wYear = wcstol( s, &end, 10 );
s = end; s = end;
while (*s && !isdigitW( *s )) s++; while (*s && !iswdigit( *s )) s++;
if (*s == '\0') return TRUE; if (*s == '\0') return TRUE;
time->wHour = strtolW( s, &end, 10 ); time->wHour = wcstol( s, &end, 10 );
s = end; s = end;
while (*s && !isdigitW( *s )) s++; while (*s && !iswdigit( *s )) s++;
if (*s == '\0') return TRUE; if (*s == '\0') return TRUE;
time->wMinute = strtolW( s, &end, 10 ); time->wMinute = wcstol( s, &end, 10 );
s = end; s = end;
while (*s && !isdigitW( *s )) s++; while (*s && !iswdigit( *s )) s++;
if (*s == '\0') return TRUE; if (*s == '\0') return TRUE;
time->wSecond = strtolW( s, &end, 10 ); time->wSecond = wcstol( s, &end, 10 );
time->wMilliseconds = 0; time->wMilliseconds = 0;
return TRUE; return TRUE;
......
...@@ -16,12 +16,10 @@ ...@@ -16,12 +16,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h" #include <wchar.h>
#include "ws2tcpip.h"
#include <stdarg.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "ws2tcpip.h"
#include "winreg.h" #include "winreg.h"
#include "winhttp.h" #include "winhttp.h"
#include "shlwapi.h" #include "shlwapi.h"
...@@ -74,12 +72,12 @@ static WCHAR *decode_url( LPCWSTR url, DWORD *len ) ...@@ -74,12 +72,12 @@ static WCHAR *decode_url( LPCWSTR url, DWORD *len )
q = ret; q = ret;
while (*len > 0) while (*len > 0)
{ {
if (p[0] == '%' && isxdigitW( p[1] ) && isxdigitW( p[2] )) if (p[0] == '%' && iswxdigit( p[1] ) && iswxdigit( p[2] ))
{ {
hex[0] = p[1]; hex[0] = p[1];
hex[1] = p[2]; hex[1] = p[2];
hex[2] = 0; hex[2] = 0;
*q++ = strtolW( hex, NULL, 16 ); *q++ = wcstol( hex, NULL, 16 );
p += 3; p += 3;
*len -= 3; *len -= 3;
} }
...@@ -139,7 +137,7 @@ static DWORD escape_url( const WCHAR *url, DWORD *len, WCHAR **ret ) ...@@ -139,7 +137,7 @@ static DWORD escape_url( const WCHAR *url, DWORD *len, WCHAR **ret )
const WCHAR *p; const WCHAR *p;
DWORD len_base, len_path; DWORD len_base, len_path;
if ((p = strrchrW( url, '/' ))) if ((p = wcsrchr( url, '/' )))
{ {
len_base = p - url; len_base = p - url;
if (!escape_string( p, *len - len_base, NULL, &len_path )) return ERROR_INVALID_PARAMETER; if (!escape_string( p, *len - len_base, NULL, &len_path )) return ERROR_INVALID_PARAMETER;
...@@ -164,7 +162,7 @@ static DWORD parse_port( const WCHAR *str, DWORD len, INTERNET_PORT *ret ) ...@@ -164,7 +162,7 @@ static DWORD parse_port( const WCHAR *str, DWORD len, INTERNET_PORT *ret )
{ {
const WCHAR *p = str; const WCHAR *p = str;
DWORD port = 0; DWORD port = 0;
while (len && isdigitW( *p )) while (len && iswdigit( *p ))
{ {
if ((port = port * 10 + *p - '0') > 65535) return ERROR_WINHTTP_INVALID_URL; if ((port = port * 10 + *p - '0') > 65535) return ERROR_WINHTTP_INVALID_URL;
p++; len--; p++; len--;
...@@ -191,7 +189,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN ...@@ -191,7 +189,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
SetLastError( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
return FALSE; return FALSE;
} }
if (!len) len = strlenW( url ); if (!len) len = lstrlenW( url );
if (flags & ICU_ESCAPE) if (flags & ICU_ESCAPE)
{ {
...@@ -211,13 +209,13 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN ...@@ -211,13 +209,13 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
} }
url = url_decoded; url = url_decoded;
} }
if (!(p = strchrW( url, ':' ))) if (!(p = wcschr( url, ':' )))
{ {
SetLastError( ERROR_WINHTTP_UNRECOGNIZED_SCHEME ); SetLastError( ERROR_WINHTTP_UNRECOGNIZED_SCHEME );
return FALSE; return FALSE;
} }
if (p - url == 4 && !strncmpiW( url, scheme_http, 4 )) scheme_number = INTERNET_SCHEME_HTTP; if (p - url == 4 && !wcsnicmp( url, scheme_http, 4 )) scheme_number = INTERNET_SCHEME_HTTP;
else if (p - url == 5 && !strncmpiW( url, scheme_https, 5 )) scheme_number = INTERNET_SCHEME_HTTPS; else if (p - url == 5 && !wcsnicmp( url, scheme_https, 5 )) scheme_number = INTERNET_SCHEME_HTTPS;
else else
{ {
err = ERROR_WINHTTP_UNRECOGNIZED_SCHEME; err = ERROR_WINHTTP_UNRECOGNIZED_SCHEME;
...@@ -248,10 +246,10 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN ...@@ -248,10 +246,10 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
password.str = &uc->lpszPassword; password.str = &uc->lpszPassword;
password.len = &uc->dwPasswordLength; password.len = &uc->dwPasswordLength;
if ((q = memchrW( p, '@', len - (p - url) )) && !(memchrW( p, '/', q - p ))) if ((q = wmemchr( p, '@', len - (p - url) )) && !(wmemchr( p, '/', q - p )))
{ {
if ((r = memchrW( p, ':', q - p ))) if ((r = wmemchr( p, ':', q - p )))
{ {
if ((err = set_component( &username, p, r - p, flags, &overflow ))) goto exit; if ((err = set_component( &username, p, r - p, flags, &overflow ))) goto exit;
r++; r++;
...@@ -279,9 +277,9 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN ...@@ -279,9 +277,9 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
extra.str = &uc->lpszExtraInfo; extra.str = &uc->lpszExtraInfo;
extra.len = &uc->dwExtraInfoLength; extra.len = &uc->dwExtraInfoLength;
if ((q = memchrW( p, '/', len - (p - url) ))) if ((q = wmemchr( p, '/', len - (p - url) )))
{ {
if ((r = memchrW( p, ':', q - p ))) if ((r = wmemchr( p, ':', q - p )))
{ {
if ((err = set_component( &hostname, p, r - p, flags, &overflow ))) goto exit; if ((err = set_component( &hostname, p, r - p, flags, &overflow ))) goto exit;
r++; r++;
...@@ -294,7 +292,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN ...@@ -294,7 +292,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
if (scheme_number == INTERNET_SCHEME_HTTPS) uc->nPort = INTERNET_DEFAULT_HTTPS_PORT; if (scheme_number == INTERNET_SCHEME_HTTPS) uc->nPort = INTERNET_DEFAULT_HTTPS_PORT;
} }
if ((r = memchrW( q, '?', len - (q - url) ))) if ((r = wmemchr( q, '?', len - (q - url) )))
{ {
if (*extra.len) if (*extra.len)
{ {
...@@ -311,7 +309,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN ...@@ -311,7 +309,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
} }
else else
{ {
if ((r = memchrW( p, ':', len - (p - url) ))) if ((r = wmemchr( p, ':', len - (p - url) )))
{ {
if ((err = set_component( &hostname, p, r - p, flags, &overflow ))) goto exit; if ((err = set_component( &hostname, p, r - p, flags, &overflow ))) goto exit;
r++; r++;
...@@ -345,8 +343,8 @@ exit: ...@@ -345,8 +343,8 @@ exit:
static INTERNET_SCHEME get_scheme( const WCHAR *scheme, DWORD len ) static INTERNET_SCHEME get_scheme( const WCHAR *scheme, DWORD len )
{ {
if (!strncmpW( scheme, scheme_http, len )) return INTERNET_SCHEME_HTTP; if (!wcsncmp( scheme, scheme_http, len )) return INTERNET_SCHEME_HTTP;
if (!strncmpW( scheme, scheme_https, len )) return INTERNET_SCHEME_HTTPS; if (!wcsncmp( scheme, scheme_https, len )) return INTERNET_SCHEME_HTTPS;
return 0; return 0;
} }
...@@ -369,7 +367,7 @@ static DWORD get_comp_length( DWORD len, DWORD flags, WCHAR *comp ) ...@@ -369,7 +367,7 @@ static DWORD get_comp_length( DWORD len, DWORD flags, WCHAR *comp )
DWORD ret; DWORD ret;
unsigned int i; unsigned int i;
ret = len ? len : strlenW( comp ); ret = len ? len : lstrlenW( comp );
if (!(flags & ICU_ESCAPE)) return ret; if (!(flags & ICU_ESCAPE)) return ret;
for (i = 0; i < len; i++) if (need_escape( comp[i] )) ret += 2; for (i = 0; i < len; i++) if (need_escape( comp[i] )) ret += 2;
return ret; return ret;
...@@ -391,7 +389,7 @@ static BOOL get_url_length( URL_COMPONENTS *uc, DWORD flags, DWORD *len ) ...@@ -391,7 +389,7 @@ static BOOL get_url_length( URL_COMPONENTS *uc, DWORD flags, DWORD *len )
{ {
scheme = uc->nScheme; scheme = uc->nScheme;
if (!scheme) scheme = INTERNET_SCHEME_HTTP; if (!scheme) scheme = INTERNET_SCHEME_HTTP;
*len += strlenW( get_scheme_string( scheme ) ); *len += lstrlenW( get_scheme_string( scheme ) );
} }
*len += 3; /* "://" */ *len += 3; /* "://" */
...@@ -421,7 +419,7 @@ static BOOL get_url_length( URL_COMPONENTS *uc, DWORD flags, DWORD *len ) ...@@ -421,7 +419,7 @@ static BOOL get_url_length( URL_COMPONENTS *uc, DWORD flags, DWORD *len )
{ {
WCHAR port[sizeof("65535")]; WCHAR port[sizeof("65535")];
*len += sprintfW( port, formatW, uc->nPort ); *len += swprintf( port, ARRAY_SIZE(port), formatW, uc->nPort );
*len += 1; /* ":" */ *len += 1; /* ":" */
} }
if (uc->lpszUrlPath && *uc->lpszUrlPath != '/') *len += 1; /* '/' */ if (uc->lpszUrlPath && *uc->lpszUrlPath != '/') *len += 1; /* '/' */
...@@ -480,7 +478,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW ...@@ -480,7 +478,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
if (!scheme) scheme = INTERNET_SCHEME_HTTP; if (!scheme) scheme = INTERNET_SCHEME_HTTP;
schemeW = get_scheme_string( scheme ); schemeW = get_scheme_string( scheme );
len = strlenW( schemeW ); len = lstrlenW( schemeW );
memcpy( url, schemeW, len * sizeof(WCHAR) ); memcpy( url, schemeW, len * sizeof(WCHAR) );
url += len; url += len;
} }
...@@ -513,7 +511,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW ...@@ -513,7 +511,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
if (!uses_default_port( scheme, uc->nPort )) if (!uses_default_port( scheme, uc->nPort ))
{ {
*url++ = ':'; *url++ = ':';
url += sprintfW( url, formatW, uc->nPort ); url += swprintf( url, sizeof("65535"), formatW, uc->nPort );
} }
/* add slash between hostname and path if necessary */ /* add slash between hostname and path if necessary */
......
...@@ -19,13 +19,8 @@ ...@@ -19,13 +19,8 @@
#ifndef _WINE_WINHTTP_PRIVATE_H_ #ifndef _WINE_WINHTTP_PRIVATE_H_
#define _WINE_WINHTTP_PRIVATE_H_ #define _WINE_WINHTTP_PRIVATE_H_
#ifndef __WINE_CONFIG_H
# error You must include config.h to use this header
#endif
#include "wine/heap.h" #include "wine/heap.h"
#include "wine/list.h" #include "wine/list.h"
#include "wine/unicode.h"
#include "ole2.h" #include "ole2.h"
#include "sspi.h" #include "sspi.h"
...@@ -304,8 +299,8 @@ static inline WCHAR *strdupW( const WCHAR *src ) ...@@ -304,8 +299,8 @@ static inline WCHAR *strdupW( const WCHAR *src )
WCHAR *dst; WCHAR *dst;
if (!src) return NULL; if (!src) return NULL;
dst = heap_alloc( (strlenW( src ) + 1) * sizeof(WCHAR) ); dst = heap_alloc( (lstrlenW( src ) + 1) * sizeof(WCHAR) );
if (dst) strcpyW( dst, src ); if (dst) lstrcpyW( dst, src );
return dst; return dst;
} }
......
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