urlmon: Binding_Create clean up.

This commit is contained in:
Jacek Caban 2007-12-30 17:43:39 +01:00 committed by Alexandre Julliard
parent 91938977e9
commit e3c47c88fd

View File

@ -1162,7 +1162,6 @@ static BOOL is_urlmon_protocol(LPCWSTR url)
static HRESULT Binding_Create(LPCWSTR url, IBindCtx *pbc, REFIID riid, Binding **binding) static HRESULT Binding_Create(LPCWSTR url, IBindCtx *pbc, REFIID riid, Binding **binding)
{ {
Binding *ret; Binding *ret;
int len;
HRESULT hres; HRESULT hres;
if(!IsEqualGUID(&IID_IStream, riid)) { if(!IsEqualGUID(&IID_IStream, riid)) {
@ -1172,7 +1171,7 @@ static HRESULT Binding_Create(LPCWSTR url, IBindCtx *pbc, REFIID riid, Binding *
URLMON_LockModule(); URLMON_LockModule();
ret = heap_alloc(sizeof(Binding)); ret = heap_alloc_zero(sizeof(Binding));
ret->lpBindingVtbl = &BindingVtbl; ret->lpBindingVtbl = &BindingVtbl;
ret->lpInternetProtocolSinkVtbl = &InternetProtocolSinkVtbl; ret->lpInternetProtocolSinkVtbl = &InternetProtocolSinkVtbl;
@ -1181,25 +1180,12 @@ static HRESULT Binding_Create(LPCWSTR url, IBindCtx *pbc, REFIID riid, Binding *
ret->ref = 1; ret->ref = 1;
ret->callback = NULL;
ret->protocol = NULL;
ret->service_provider = NULL;
ret->stream = NULL;
ret->mime = NULL;
ret->clipboard_format = 0;
ret->url = NULL;
ret->apartment_thread = GetCurrentThreadId(); ret->apartment_thread = GetCurrentThreadId();
ret->notif_hwnd = get_notif_hwnd(); ret->notif_hwnd = get_notif_hwnd();
ret->report_mime = TRUE; ret->report_mime = TRUE;
ret->continue_call = 0;
ret->state = 0;
ret->download_state = BEFORE_DOWNLOAD; ret->download_state = BEFORE_DOWNLOAD;
ret->task_queue_head = ret->task_queue_tail = NULL;
ret->hres = S_OK;
memset(&ret->bindinfo, 0, sizeof(BINDINFO));
ret->bindinfo.cbSize = sizeof(BINDINFO); ret->bindinfo.cbSize = sizeof(BINDINFO);
ret->bindf = 0;
InitializeCriticalSection(&ret->section); InitializeCriticalSection(&ret->section);
ret->section.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": Binding.section"); ret->section.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": Binding.section");
@ -1235,9 +1221,7 @@ static HRESULT Binding_Create(LPCWSTR url, IBindCtx *pbc, REFIID riid, Binding *
if(!is_urlmon_protocol(url)) if(!is_urlmon_protocol(url))
ret->bindf |= BINDF_NEEDFILE; ret->bindf |= BINDF_NEEDFILE;
len = strlenW(url)+1; ret->url = heap_strdupW(url);
ret->url = heap_alloc(len*sizeof(WCHAR));
memcpy(ret->url, url, len*sizeof(WCHAR));
ret->stream = create_stream(ret->protocol); ret->stream = create_stream(ret->protocol);
ret->stgmed.tymed = TYMED_ISTREAM; ret->stgmed.tymed = TYMED_ISTREAM;