mshtml: Wrap remaining Heap* functions by inline functions.
This commit is contained in:
parent
5a086a5210
commit
21ba0bf3e8
|
@ -141,10 +141,9 @@ static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *
|
|||
}
|
||||
|
||||
if(i == This->sinks_size)
|
||||
This->sinks = HeapReAlloc(GetProcessHeap(), 0, This->sinks,
|
||||
(++This->sinks_size)*sizeof(*This->sinks));
|
||||
This->sinks = mshtml_realloc(This->sinks,(++This->sinks_size)*sizeof(*This->sinks));
|
||||
}else {
|
||||
This->sinks = HeapAlloc(GetProcessHeap(), 0, sizeof(*This->sinks));
|
||||
This->sinks = mshtml_alloc(sizeof(*This->sinks));
|
||||
This->sinks_size = 1;
|
||||
i = 0;
|
||||
}
|
||||
|
@ -193,7 +192,7 @@ static const IConnectionPointVtbl ConnectionPointVtbl =
|
|||
|
||||
static void ConnectionPoint_Create(HTMLDocument *doc, REFIID riid, ConnectionPoint **cp)
|
||||
{
|
||||
ConnectionPoint *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(ConnectionPoint));
|
||||
ConnectionPoint *ret = mshtml_alloc(sizeof(ConnectionPoint));
|
||||
|
||||
ret->lpConnectionPointVtbl = &ConnectionPointVtbl;
|
||||
ret->doc = doc;
|
||||
|
@ -213,8 +212,8 @@ static void ConnectionPoint_Destroy(ConnectionPoint *This)
|
|||
IUnknown_Release(This->sinks[i].unk);
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, This->sinks);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
mshtml_free(This->sinks);
|
||||
mshtml_free(This);
|
||||
}
|
||||
|
||||
#define CONPTCONT_THIS(iface) DEFINE_THIS(HTMLDocument, ConnectionPointContainer, iface)
|
||||
|
|
|
@ -174,8 +174,8 @@ static ULONG WINAPI Hlink_Release(IHlink *iface)
|
|||
if(!ref) {
|
||||
if(This->mon)
|
||||
IMoniker_Release(This->mon);
|
||||
HeapFree(GetProcessHeap(), 0, This->location);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
mshtml_free(This->location);
|
||||
mshtml_free(This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -211,7 +211,7 @@ static HRESULT WINAPI Hlink_SetMonikerReference(IHlink *iface, DWORD grfHLSETF,
|
|||
|
||||
if(This->mon)
|
||||
IMoniker_Release(This->mon);
|
||||
HeapFree(GetProcessHeap(), 0, This->location);
|
||||
mshtml_free(This->location);
|
||||
|
||||
if(pimkTarget)
|
||||
IMoniker_AddRef(pimkTarget);
|
||||
|
@ -220,7 +220,7 @@ static HRESULT WINAPI Hlink_SetMonikerReference(IHlink *iface, DWORD grfHLSETF,
|
|||
if(pwzLocation) {
|
||||
DWORD len = strlenW(pwzLocation)+1;
|
||||
|
||||
This->location = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
|
||||
This->location = mshtml_alloc(len*sizeof(WCHAR));
|
||||
memcpy(This->location, pwzLocation, len*sizeof(WCHAR));
|
||||
}else {
|
||||
This->location = NULL;
|
||||
|
@ -360,7 +360,7 @@ static const IHlinkVtbl HlinkVtbl = {
|
|||
|
||||
IHlink *Hlink_Create(void)
|
||||
{
|
||||
Hlink *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(Hlink));
|
||||
Hlink *ret = mshtml_alloc(sizeof(Hlink));
|
||||
|
||||
ret->lpHlinkVtbl = &HlinkVtbl;
|
||||
ret->ref = 1;
|
||||
|
|
|
@ -52,7 +52,7 @@ static void clean_up(void)
|
|||
|
||||
if(tmp_file_name) {
|
||||
DeleteFileW(tmp_file_name);
|
||||
HeapFree(GetProcessHeap(), 0, tmp_file_name);
|
||||
mshtml_free(tmp_file_name);
|
||||
tmp_file_name = NULL;
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ static void set_registry(LPCSTR install_dir)
|
|||
}
|
||||
|
||||
len = MultiByteToWideChar(CP_ACP, 0, install_dir, -1, NULL, 0)-1;
|
||||
gecko_path = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR)+sizeof(wszWineGecko));
|
||||
gecko_path = mshtml_alloc((len+1)*sizeof(WCHAR)+sizeof(wszWineGecko));
|
||||
MultiByteToWideChar(CP_ACP, 0, install_dir, -1, gecko_path, (len+1)*sizeof(WCHAR));
|
||||
|
||||
if (len && gecko_path[len-1] != '\\')
|
||||
|
@ -105,7 +105,7 @@ static void set_registry(LPCSTR install_dir)
|
|||
size = len*sizeof(WCHAR)+sizeof(wszWineGecko);
|
||||
res = RegSetValueExW(hkey, wszGeckoPath, 0, REG_SZ, (LPVOID)gecko_path,
|
||||
len*sizeof(WCHAR)+sizeof(wszWineGecko));
|
||||
HeapFree(GetProcessHeap(), 0, gecko_path);
|
||||
mshtml_free(gecko_path);
|
||||
RegCloseKey(hkey);
|
||||
if(res != ERROR_SUCCESS)
|
||||
ERR("Failed to set GeckoPath value: %08lx\n", res);
|
||||
|
@ -141,7 +141,7 @@ static HRESULT WINAPI InstallCallback_OnStartBinding(IBindStatusCallback *iface,
|
|||
|
||||
GetTempPathW(sizeof(tmp_dir)/sizeof(WCHAR), tmp_dir);
|
||||
|
||||
tmp_file_name = HeapAlloc(GetProcessHeap(), 0, MAX_PATH*sizeof(WCHAR));
|
||||
tmp_file_name = mshtml_alloc(MAX_PATH*sizeof(WCHAR));
|
||||
GetTempFileNameW(tmp_dir, NULL, 0, tmp_file_name);
|
||||
|
||||
TRACE("creating temp file %s\n", debugstr_w(tmp_file_name));
|
||||
|
@ -210,7 +210,7 @@ static HRESULT WINAPI InstallCallback_OnStopBinding(IBindStatusCallback *iface,
|
|||
pExtractFilesA = (typeof(ExtractFilesA)*)GetProcAddress(advpack, "ExtractFiles");
|
||||
|
||||
len = WideCharToMultiByte(CP_ACP, 0, tmp_file_name, -1, NULL, 0, NULL, NULL);
|
||||
file_name = HeapAlloc(GetProcessHeap(), 0, len);
|
||||
file_name = mshtml_alloc(len);
|
||||
WideCharToMultiByte(CP_ACP, 0, tmp_file_name, -1, file_name, -1, NULL, NULL);
|
||||
|
||||
GetEnvironmentVariableA("ProgramFiles", program_files, sizeof(program_files));
|
||||
|
@ -218,7 +218,7 @@ static HRESULT WINAPI InstallCallback_OnStopBinding(IBindStatusCallback *iface,
|
|||
/* FIXME: Use unicode version (not yet implemented) */
|
||||
hres = pExtractFilesA(file_name, program_files, 0, NULL, NULL, 0);
|
||||
FreeLibrary(advpack);
|
||||
HeapFree(GetProcessHeap(), 0, file_name);
|
||||
mshtml_free(file_name);
|
||||
if(FAILED(hres)) {
|
||||
ERR("Could not extract package: %08lx\n", hres);
|
||||
clean_up();
|
||||
|
@ -296,12 +296,12 @@ static LPWSTR get_url(void)
|
|||
if(res != ERROR_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
url = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
url = mshtml_alloc(size);
|
||||
|
||||
res = RegQueryValueExW(hkey, wszGeckoUrl, NULL, &type, (LPBYTE)url, &size);
|
||||
RegCloseKey(hkey);
|
||||
if(res != ERROR_SUCCESS || type != REG_SZ) {
|
||||
HeapFree(GetProcessHeap(), 0, url);
|
||||
mshtml_free(url);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ static DWORD WINAPI download_proc(PVOID arg)
|
|||
HRESULT hres;
|
||||
|
||||
CreateURLMoniker(NULL, url, &mon);
|
||||
HeapFree(GetProcessHeap(), 0, url);
|
||||
mshtml_free(url);
|
||||
url = NULL;
|
||||
|
||||
CreateAsyncBindCtx(0, &InstallCallback, 0, &bctx);
|
||||
|
|
|
@ -106,11 +106,11 @@ static ULONG WINAPI HtmlLoadOptions_Release(IHtmlLoadOptions *iface)
|
|||
last = iter;
|
||||
iter = iter->next;
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, last->buffer);
|
||||
HeapFree(GetProcessHeap(), 0, last);
|
||||
mshtml_free(last->buffer);
|
||||
mshtml_free(last);
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
mshtml_free(This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -159,13 +159,13 @@ static HRESULT WINAPI HtmlLoadOptions_SetOption(IHtmlLoadOptions *iface, DWORD d
|
|||
}
|
||||
|
||||
if(!iter) {
|
||||
iter = HeapAlloc(GetProcessHeap(), 0, sizeof(load_opt));
|
||||
iter = mshtml_alloc(sizeof(load_opt));
|
||||
iter->next = This->opts;
|
||||
This->opts = iter;
|
||||
|
||||
iter->option = dwOption;
|
||||
}else {
|
||||
HeapFree(GetProcessHeap(), 0, iter->buffer);
|
||||
mshtml_free(iter->buffer);
|
||||
}
|
||||
|
||||
if(!cbBuf) {
|
||||
|
@ -176,7 +176,7 @@ static HRESULT WINAPI HtmlLoadOptions_SetOption(IHtmlLoadOptions *iface, DWORD d
|
|||
}
|
||||
|
||||
iter->size = cbBuf;
|
||||
iter->buffer = HeapAlloc(GetProcessHeap(), 0, cbBuf);
|
||||
iter->buffer = mshtml_alloc(cbBuf);
|
||||
memcpy(iter->buffer, pBuffer, iter->size);
|
||||
|
||||
return S_OK;
|
||||
|
@ -199,7 +199,7 @@ HRESULT HTMLLoadOptions_Create(IUnknown *pUnkOuter, REFIID riid, void** ppv)
|
|||
|
||||
TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppv);
|
||||
|
||||
ret = HeapAlloc(GetProcessHeap(), 0, sizeof(HTMLLoadOptions));
|
||||
ret = mshtml_alloc(sizeof(HTMLLoadOptions));
|
||||
|
||||
ret->lpHtmlLoadOptionsVtbl = &HtmlLoadOptionsVtbl;
|
||||
ret->ref = 1;
|
||||
|
|
|
@ -85,7 +85,7 @@ static nsrefcnt NSAPI nsInputStream_Release(nsIInputStream *iface)
|
|||
TRACE("(%p) ref=%ld\n", This, ref);
|
||||
|
||||
if(!ref)
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
mshtml_free(This);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ static const nsIInputStreamVtbl nsInputStreamVtbl = {
|
|||
|
||||
static nsProtocolStream *create_nsprotocol_stream(IStream *stream)
|
||||
{
|
||||
nsProtocolStream *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(nsProtocolStream));
|
||||
nsProtocolStream *ret = mshtml_alloc(sizeof(nsProtocolStream));
|
||||
|
||||
ret->lpInputStreamVtbl = &nsInputStreamVtbl;
|
||||
ret->ref = 1;
|
||||
|
@ -235,8 +235,8 @@ static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallback *iface)
|
|||
nsISupports_Release(This->nscontext);
|
||||
if(This->nsstream)
|
||||
nsIInputStream_Release(NSINSTREAM(This->nsstream));
|
||||
HeapFree(GetProcessHeap(), 0, This->headers);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
mshtml_free(This->headers);
|
||||
mshtml_free(This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -278,10 +278,10 @@ static HRESULT WINAPI BindStatusCallback_OnProgress(IBindStatusCallback *iface,
|
|||
|
||||
if(!This->nschannel)
|
||||
return S_OK;
|
||||
HeapFree(GetProcessHeap(), 0, This->nschannel->content);
|
||||
mshtml_free(This->nschannel->content);
|
||||
|
||||
len = WideCharToMultiByte(CP_ACP, 0, szStatusText, -1, NULL, 0, NULL, NULL);
|
||||
This->nschannel->content = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
|
||||
This->nschannel->content = mshtml_alloc(len*sizeof(WCHAR));
|
||||
WideCharToMultiByte(CP_ACP, 0, szStatusText, -1, This->nschannel->content, -1, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
@ -554,7 +554,7 @@ static const IServiceProviderVtbl ServiceProviderVtbl = {
|
|||
|
||||
BSCallback *create_bscallback(HTMLDocument *doc, LPCOLESTR url)
|
||||
{
|
||||
BSCallback *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(BSCallback));
|
||||
BSCallback *ret = mshtml_alloc(sizeof(BSCallback));
|
||||
|
||||
ret->lpBindStatusCallbackVtbl = &BindStatusCallbackVtbl;
|
||||
ret->lpServiceProviderVtbl = &ServiceProviderVtbl;
|
||||
|
@ -612,10 +612,9 @@ static void parse_post_data(nsIInputStream *post_data_stream, LPWSTR *headers_re
|
|||
len = MultiByteToWideChar(CP_ACP, 0, ptr2, ptr-ptr2, NULL, 0);
|
||||
|
||||
if(headers)
|
||||
headers = HeapReAlloc(GetProcessHeap(), 0, headers,
|
||||
(headers_len+len+1)*sizeof(WCHAR));
|
||||
headers = mshtml_realloc(headers,(headers_len+len+1)*sizeof(WCHAR));
|
||||
else
|
||||
headers = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR));
|
||||
headers = mshtml_alloc((len+1)*sizeof(WCHAR));
|
||||
|
||||
len = MultiByteToWideChar(CP_ACP, 0, ptr2, ptr-ptr2, headers+headers_len, -1);
|
||||
headers_len += len;
|
||||
|
|
|
@ -528,7 +528,7 @@ static nsrefcnt NSAPI nsWebBrowserChrome_Release(nsIWebBrowserChrome *iface)
|
|||
if(!ref) {
|
||||
if(This->parent)
|
||||
nsIWebBrowserChrome_Release(NSWBCHROME(This->parent));
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
mshtml_free(This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -1142,7 +1142,7 @@ NSContainer *NSContainer_Create(HTMLDocument *doc, NSContainer *parent)
|
|||
if(!load_gecko())
|
||||
return NULL;
|
||||
|
||||
ret = HeapAlloc(GetProcessHeap(), 0, sizeof(NSContainer));
|
||||
ret = mshtml_alloc(sizeof(NSContainer));
|
||||
|
||||
ret->lpWebBrowserChromeVtbl = &nsWebBrowserChromeVtbl;
|
||||
ret->lpContextMenuListenerVtbl = &nsContextMenuListenerVtbl;
|
||||
|
|
|
@ -136,13 +136,13 @@ static BOOL before_async_open(nsChannel *channel, NSContainer *container)
|
|||
nsIWineURI_GetSpec(channel->uri, &uri_str);
|
||||
nsACString_GetData(&uri_str, &uria, NULL);
|
||||
len = MultiByteToWideChar(CP_ACP, 0, uria, -1, NULL, 0);
|
||||
uri = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
|
||||
uri = mshtml_alloc(len*sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, uria, -1, uri, len);
|
||||
nsACString_Finish(&uri_str);
|
||||
|
||||
ret = handle_uri(container, channel, uri);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, uri);
|
||||
mshtml_free(uri);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -213,8 +213,8 @@ static nsrefcnt NSAPI nsChannel_Release(nsIHttpChannel *iface)
|
|||
nsIInterfaceRequestor_Release(This->notif_callback);
|
||||
if(This->original_uri)
|
||||
nsIURI_Release(This->original_uri);
|
||||
HeapFree(GetProcessHeap(), 0, This->content);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
mshtml_free(This->content);
|
||||
mshtml_free(This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -1046,7 +1046,7 @@ static nsrefcnt NSAPI nsURI_Release(nsIWineURI *iface)
|
|||
nsIWebBrowserChrome_Release(NSWBCHROME(This->container));
|
||||
if(This->uri)
|
||||
nsIURI_Release(This->uri);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
mshtml_free(This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -1471,7 +1471,7 @@ static const nsIWineURIVtbl nsWineURIVtbl = {
|
|||
|
||||
static nsresult create_uri(nsIURI *uri, NSContainer *container, nsIURI **_retval)
|
||||
{
|
||||
nsURI *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(nsURI));
|
||||
nsURI *ret = mshtml_alloc(sizeof(nsURI));
|
||||
|
||||
ret->lpWineURIVtbl = &nsWineURIVtbl;
|
||||
ret->ref = 1;
|
||||
|
@ -1627,7 +1627,7 @@ static nsresult NSAPI nsIOService_NewChannelFromURI(nsIIOService *iface, nsIURI
|
|||
return channel ? NS_OK : NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
ret = HeapAlloc(GetProcessHeap(), 0, sizeof(nsChannel));
|
||||
ret = mshtml_alloc(sizeof(nsChannel));
|
||||
|
||||
ret->lpHttpChannelVtbl = &nsChannelVtbl;
|
||||
ret->lpUploadChannelVtbl = &nsUploadChannelVtbl;
|
||||
|
@ -1796,7 +1796,7 @@ nsIURI *get_nsIURI(LPCWSTR url)
|
|||
int len;
|
||||
|
||||
len = WideCharToMultiByte(CP_ACP, 0, url, -1, NULL, -1, NULL, NULL);
|
||||
urla = HeapAlloc(GetProcessHeap(), 0, len);
|
||||
urla = mshtml_alloc(len);
|
||||
WideCharToMultiByte(CP_ACP, 0, url, -1, urla, -1, NULL, NULL);
|
||||
|
||||
nsACString_Init(&acstr, urla);
|
||||
|
@ -1806,7 +1806,7 @@ nsIURI *get_nsIURI(LPCWSTR url)
|
|||
FIXME("NewURI failed: %08lx\n", nsres);
|
||||
|
||||
nsACString_Finish(&acstr);
|
||||
HeapFree(GetProcessHeap(), 0, urla);
|
||||
mshtml_free(urla);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ static nsIInputStream *get_post_data_stream(IBindCtx *bctx)
|
|||
|
||||
static const char content_length[] = "Content-Length: %lu\r\n\r\n";
|
||||
|
||||
data = HeapAlloc(GetProcessHeap(), 0, headers_len+post_len+sizeof(content_length)+8);
|
||||
data = mshtml_alloc(headers_len+post_len+sizeof(content_length)+8);
|
||||
|
||||
if(headers_len) {
|
||||
WideCharToMultiByte(CP_ACP, 0, headers, -1, data, -1, NULL, NULL);
|
||||
|
|
|
@ -95,7 +95,7 @@ static ULONG WINAPI HTMLSelectionObject_Release(IHTMLSelectionObject *iface)
|
|||
if(!ref) {
|
||||
if(This->nsselection)
|
||||
nsISelection_Release(This->nsselection);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
mshtml_free(This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -195,7 +195,7 @@ static const IHTMLSelectionObjectVtbl HTMLSelectionObjectVtbl = {
|
|||
|
||||
IHTMLSelectionObject *HTMLSelectionObject_Create(nsISelection *nsselection)
|
||||
{
|
||||
HTMLSelectionObject *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(HTMLSelectionObject));
|
||||
HTMLSelectionObject *ret = mshtml_alloc(sizeof(HTMLSelectionObject));
|
||||
|
||||
ret->lpHTMLSelectionObjectVtbl = &HTMLSelectionObjectVtbl;
|
||||
ret->ref = 1;
|
||||
|
|
|
@ -94,7 +94,7 @@ static ULONG WINAPI HTMLTxtRange_Release(IHTMLTxtRange *iface)
|
|||
if(!ref) {
|
||||
if(This->nsselection)
|
||||
nsISelection_Release(This->nsselection);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
mshtml_free(This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -424,7 +424,7 @@ static const IHTMLTxtRangeVtbl HTMLTxtRangeVtbl = {
|
|||
|
||||
IHTMLTxtRange *HTMLTxtRange_Create(nsISelection *nsselection)
|
||||
{
|
||||
HTMLTxtRange *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(HTMLTxtRange));
|
||||
HTMLTxtRange *ret = mshtml_alloc(sizeof(HTMLTxtRange));
|
||||
|
||||
ret->lpHTMLTxtRangeVtbl = &HTMLTxtRangeVtbl;
|
||||
ret->ref = 1;
|
||||
|
|
|
@ -254,7 +254,7 @@ static LRESULT tooltips_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
static void create_tooltips_window(HTMLDocument *This)
|
||||
{
|
||||
tooltip_data *data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data));
|
||||
tooltip_data *data = mshtml_alloc(sizeof(*data));
|
||||
|
||||
This->tooltips_hwnd = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL, TTS_NOPREFIX | WS_POPUP,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 10, 10, This->hwnd, NULL, hInst, NULL);
|
||||
|
|
Loading…
Reference in New Issue