urlmon: Avoid LPWSTR to LPCWSTR cast.
This commit is contained in:
parent
dd61ebe6cf
commit
2d1bc5b861
|
@ -36,7 +36,7 @@ typedef struct {
|
||||||
|
|
||||||
BOOL https;
|
BOOL https;
|
||||||
IHttpNegotiate *http_negotiate;
|
IHttpNegotiate *http_negotiate;
|
||||||
LPWSTR full_header;
|
WCHAR *full_header;
|
||||||
|
|
||||||
LONG ref;
|
LONG ref;
|
||||||
} HttpProtocol;
|
} HttpProtocol;
|
||||||
|
@ -56,9 +56,8 @@ static inline HttpProtocol *impl_from_IWinInetHttpInfo(IWinInetHttpInfo *iface)
|
||||||
return CONTAINING_RECORD(iface, HttpProtocol, IWinInetHttpInfo_iface);
|
return CONTAINING_RECORD(iface, HttpProtocol, IWinInetHttpInfo_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Default headers from native */
|
static const WCHAR default_headersW[] = {
|
||||||
static const WCHAR wszHeaders[] = {'A','c','c','e','p','t','-','E','n','c','o','d','i','n','g',
|
'A','c','c','e','p','t','-','E','n','c','o','d','i','n','g',':',' ','g','z','i','p',',',' ','d','e','f','l','a','t','e',0};
|
||||||
':',' ','g','z','i','p',',',' ','d','e','f','l','a','t','e',0};
|
|
||||||
|
|
||||||
static LPWSTR query_http_info(HttpProtocol *This, DWORD option)
|
static LPWSTR query_http_info(HttpProtocol *This, DWORD option)
|
||||||
{
|
{
|
||||||
|
@ -277,7 +276,7 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques
|
||||||
LPOLESTR accept_mimes[257];
|
LPOLESTR accept_mimes[257];
|
||||||
const WCHAR **accept_types;
|
const WCHAR **accept_types;
|
||||||
BYTE security_id[512];
|
BYTE security_id[512];
|
||||||
DWORD len = 0, port;
|
DWORD len, port;
|
||||||
ULONG num, error;
|
ULONG num, error;
|
||||||
BOOL res, b;
|
BOOL res, b;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
@ -371,7 +370,7 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques
|
||||||
return hres;
|
return hres;
|
||||||
}
|
}
|
||||||
|
|
||||||
hres = IHttpNegotiate_BeginningTransaction(This->http_negotiate, url, wszHeaders,
|
hres = IHttpNegotiate_BeginningTransaction(This->http_negotiate, url, default_headersW,
|
||||||
0, &addl_header);
|
0, &addl_header);
|
||||||
SysFreeString(url);
|
SysFreeString(url);
|
||||||
if(hres != S_OK) {
|
if(hres != S_OK) {
|
||||||
|
@ -380,18 +379,19 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques
|
||||||
return hres;
|
return hres;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(addl_header) {
|
len = addl_header ? strlenW(addl_header) : 0;
|
||||||
int len_addl_header = strlenW(addl_header);
|
|
||||||
|
|
||||||
This->full_header = heap_alloc(len_addl_header*sizeof(WCHAR)+sizeof(wszHeaders));
|
This->full_header = heap_alloc(len*sizeof(WCHAR)+sizeof(default_headersW));
|
||||||
|
if(!This->full_header) {
|
||||||
lstrcpyW(This->full_header, addl_header);
|
IServiceProvider_Release(service_provider);
|
||||||
lstrcpyW(&This->full_header[len_addl_header], wszHeaders);
|
return E_OUTOFMEMORY;
|
||||||
CoTaskMemFree(addl_header);
|
|
||||||
}else {
|
|
||||||
This->full_header = (LPWSTR)wszHeaders;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(len)
|
||||||
|
memcpy(This->full_header, addl_header, len*sizeof(WCHAR));
|
||||||
|
CoTaskMemFree(addl_header);
|
||||||
|
memcpy(This->full_header+len, default_headersW, sizeof(default_headersW));
|
||||||
|
|
||||||
hres = IServiceProvider_QueryService(service_provider, &IID_IHttpNegotiate2,
|
hres = IServiceProvider_QueryService(service_provider, &IID_IHttpNegotiate2,
|
||||||
&IID_IHttpNegotiate2, (void **)&http_negotiate2);
|
&IID_IHttpNegotiate2, (void **)&http_negotiate2);
|
||||||
IServiceProvider_Release(service_provider);
|
IServiceProvider_Release(service_provider);
|
||||||
|
@ -525,13 +525,12 @@ static void HttpProtocol_close_connection(Protocol *prot)
|
||||||
|
|
||||||
if(This->http_negotiate) {
|
if(This->http_negotiate) {
|
||||||
IHttpNegotiate_Release(This->http_negotiate);
|
IHttpNegotiate_Release(This->http_negotiate);
|
||||||
This->http_negotiate = 0;
|
This->http_negotiate = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(This->full_header) {
|
if(This->full_header) {
|
||||||
if(This->full_header != wszHeaders)
|
heap_free(This->full_header);
|
||||||
heap_free(This->full_header);
|
This->full_header = NULL;
|
||||||
This->full_header = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue