Commit 6b5a5c64 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

browseui: Use CRT memory allocation functions.

parent 4d122a26
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
#include "shlguid.h" #include "shlguid.h"
#include "shlobj.h" #include "shlobj.h"
#include "wine/heap.h"
#include "browseui.h" #include "browseui.h"
WINE_DEFAULT_DEBUG_CHANNEL(browseui); WINE_DEFAULT_DEBUG_CHANNEL(browseui);
...@@ -80,17 +78,6 @@ static void release_obj(struct ACLMultiSublist *obj) ...@@ -80,17 +78,6 @@ static void release_obj(struct ACLMultiSublist *obj)
IACList_Release(obj->pACL); IACList_Release(obj->pACL);
} }
static void ACLMulti_Destructor(ACLMulti *This)
{
int i;
TRACE("destroying %p\n", This);
for (i = 0; i < This->nObjs; i++)
release_obj(&This->objs[i]);
heap_free(This->objs);
heap_free(This);
BROWSEUI_refCount--;
}
static HRESULT WINAPI ACLMulti_QueryInterface(IEnumString *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI ACLMulti_QueryInterface(IEnumString *iface, REFIID iid, LPVOID *ppvOut)
{ {
ACLMulti *This = impl_from_IEnumString(iface); ACLMulti *This = impl_from_IEnumString(iface);
...@@ -129,10 +116,18 @@ static ULONG WINAPI ACLMulti_Release(IEnumString *iface) ...@@ -129,10 +116,18 @@ static ULONG WINAPI ACLMulti_Release(IEnumString *iface)
{ {
ACLMulti *This = impl_from_IEnumString(iface); ACLMulti *This = impl_from_IEnumString(iface);
ULONG ret; ULONG ret;
int i;
ret = InterlockedDecrement(&This->refCount); ret = InterlockedDecrement(&This->refCount);
if (ret == 0) if (ret == 0)
ACLMulti_Destructor(This); {
for (i = 0; i < This->nObjs; i++)
release_obj(&This->objs[i]);
free(This->objs);
free(This);
BROWSEUI_refCount--;
}
return ret; return ret;
} }
...@@ -224,7 +219,7 @@ static HRESULT WINAPI ACLMulti_Append(IObjMgr *iface, IUnknown *obj) ...@@ -224,7 +219,7 @@ static HRESULT WINAPI ACLMulti_Append(IObjMgr *iface, IUnknown *obj)
if (obj == NULL) if (obj == NULL)
return E_FAIL; return E_FAIL;
This->objs = heap_realloc(This->objs, sizeof(This->objs[0]) * (This->nObjs+1)); This->objs = realloc(This->objs, sizeof(This->objs[0]) * (This->nObjs+1));
This->objs[This->nObjs].punk = obj; This->objs[This->nObjs].punk = obj;
IUnknown_AddRef(obj); IUnknown_AddRef(obj);
if (FAILED(IUnknown_QueryInterface(obj, &IID_IEnumString, (LPVOID *)&This->objs[This->nObjs].pEnum))) if (FAILED(IUnknown_QueryInterface(obj, &IID_IEnumString, (LPVOID *)&This->objs[This->nObjs].pEnum)))
...@@ -247,7 +242,7 @@ static HRESULT WINAPI ACLMulti_Remove(IObjMgr *iface, IUnknown *obj) ...@@ -247,7 +242,7 @@ static HRESULT WINAPI ACLMulti_Remove(IObjMgr *iface, IUnknown *obj)
release_obj(&This->objs[i]); release_obj(&This->objs[i]);
memmove(&This->objs[i], &This->objs[i+1], (This->nObjs-i-1)*sizeof(struct ACLMultiSublist)); memmove(&This->objs[i], &This->objs[i+1], (This->nObjs-i-1)*sizeof(struct ACLMultiSublist));
This->nObjs--; This->nObjs--;
This->objs = heap_realloc(This->objs, sizeof(This->objs[0]) * This->nObjs); This->objs = realloc(This->objs, sizeof(This->objs[0]) * This->nObjs);
return S_OK; return S_OK;
} }
...@@ -313,8 +308,7 @@ HRESULT ACLMulti_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) ...@@ -313,8 +308,7 @@ HRESULT ACLMulti_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
if (pUnkOuter) if (pUnkOuter)
return CLASS_E_NOAGGREGATION; return CLASS_E_NOAGGREGATION;
This = heap_alloc_zero(sizeof(ACLMulti)); if (!(This = calloc(1, sizeof(ACLMulti))))
if (This == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->IEnumString_iface.lpVtbl = &ACLMultiVtbl; This->IEnumString_iface.lpVtbl = &ACLMultiVtbl;
......
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
#include "shlguid.h" #include "shlguid.h"
#include "shlobj.h" #include "shlobj.h"
#include "wine/heap.h"
#include "browseui.h" #include "browseui.h"
WINE_DEFAULT_DEBUG_CHANNEL(browseui); WINE_DEFAULT_DEBUG_CHANNEL(browseui);
...@@ -57,12 +55,6 @@ static inline ACLShellSource *impl_from_IEnumString(IEnumString *iface) ...@@ -57,12 +55,6 @@ static inline ACLShellSource *impl_from_IEnumString(IEnumString *iface)
return CONTAINING_RECORD(iface, ACLShellSource, IEnumString_iface); return CONTAINING_RECORD(iface, ACLShellSource, IEnumString_iface);
} }
static void ACLShellSource_Destructor(ACLShellSource *This)
{
TRACE("destroying %p\n", This);
heap_free(This);
}
static HRESULT WINAPI ACLShellSource_QueryInterface(IEnumString *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI ACLShellSource_QueryInterface(IEnumString *iface, REFIID iid, LPVOID *ppvOut)
{ {
ACLShellSource *This = impl_from_IEnumString(iface); ACLShellSource *This = impl_from_IEnumString(iface);
...@@ -106,7 +98,7 @@ static ULONG WINAPI ACLShellSource_Release(IEnumString *iface) ...@@ -106,7 +98,7 @@ static ULONG WINAPI ACLShellSource_Release(IEnumString *iface)
TRACE("(%p)->(%lu)\n", This, ref); TRACE("(%p)->(%lu)\n", This, ref);
if (ref == 0) if (ref == 0)
ACLShellSource_Destructor(This); free(This);
return ref; return ref;
} }
...@@ -205,8 +197,7 @@ HRESULT ACLShellSource_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) ...@@ -205,8 +197,7 @@ HRESULT ACLShellSource_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
if (pUnkOuter) if (pUnkOuter)
return CLASS_E_NOAGGREGATION; return CLASS_E_NOAGGREGATION;
This = heap_alloc_zero(sizeof(ACLShellSource)); if (!(This = calloc(1, sizeof(*This))))
if (This == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->IEnumString_iface.lpVtbl = &ACLShellSourceVtbl; This->IEnumString_iface.lpVtbl = &ACLShellSourceVtbl;
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "shlguid.h" #include "shlguid.h"
#include "rpcproxy.h" #include "rpcproxy.h"
#include "wine/heap.h"
#include "browseui.h" #include "browseui.h"
#include "initguid.h" #include "initguid.h"
...@@ -72,7 +71,7 @@ static inline ClassFactory *impl_from_IClassFactory(IClassFactory *iface) ...@@ -72,7 +71,7 @@ static inline ClassFactory *impl_from_IClassFactory(IClassFactory *iface)
static void ClassFactory_Destructor(ClassFactory *This) static void ClassFactory_Destructor(ClassFactory *This)
{ {
TRACE("Destroying class factory %p\n", This); TRACE("Destroying class factory %p\n", This);
heap_free(This); free(This);
InterlockedDecrement(&BROWSEUI_refCount); InterlockedDecrement(&BROWSEUI_refCount);
} }
...@@ -147,7 +146,7 @@ static const IClassFactoryVtbl ClassFactoryVtbl = { ...@@ -147,7 +146,7 @@ static const IClassFactoryVtbl ClassFactoryVtbl = {
static HRESULT ClassFactory_Constructor(LPFNCONSTRUCTOR ctor, LPVOID *ppvOut) static HRESULT ClassFactory_Constructor(LPFNCONSTRUCTOR ctor, LPVOID *ppvOut)
{ {
ClassFactory *This = heap_alloc(sizeof(ClassFactory)); ClassFactory *This = malloc(sizeof(*This));
This->IClassFactory_iface.lpVtbl = &ClassFactoryVtbl; This->IClassFactory_iface.lpVtbl = &ClassFactoryVtbl;
This->ref = 1; This->ref = 1;
This->ctor = ctor; This->ctor = ctor;
......
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
#include "shlguid.h" #include "shlguid.h"
#include "shlobj.h" #include "shlobj.h"
#include "wine/heap.h"
#include "browseui.h" #include "browseui.h"
#include "resids.h" #include "resids.h"
...@@ -57,7 +55,7 @@ static void CompCatCacheDaemon_Destructor(CompCatCacheDaemon *This) ...@@ -57,7 +55,7 @@ static void CompCatCacheDaemon_Destructor(CompCatCacheDaemon *This)
TRACE("destroying %p\n", This); TRACE("destroying %p\n", This);
This->cs.DebugInfo->Spare[0] = 0; This->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->cs); DeleteCriticalSection(&This->cs);
heap_free(This); free(This);
InterlockedDecrement(&BROWSEUI_refCount); InterlockedDecrement(&BROWSEUI_refCount);
} }
...@@ -146,8 +144,7 @@ HRESULT CompCatCacheDaemon_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) ...@@ -146,8 +144,7 @@ HRESULT CompCatCacheDaemon_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
if (pUnkOuter) if (pUnkOuter)
return CLASS_E_NOAGGREGATION; return CLASS_E_NOAGGREGATION;
This = heap_alloc(sizeof(CompCatCacheDaemon)); if (!(This = calloc(1, sizeof(*This))))
if (This == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->IRunnableTask_iface.lpVtbl = &CompCatCacheDaemonVtbl; This->IRunnableTask_iface.lpVtbl = &CompCatCacheDaemonVtbl;
......
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
#include "shlguid.h" #include "shlguid.h"
#include "shlobj.h" #include "shlobj.h"
#include "wine/heap.h"
#include "browseui.h" #include "browseui.h"
#include "resids.h" #include "resids.h"
...@@ -88,17 +86,8 @@ static inline ProgressDialog *impl_from_IOleWindow(IOleWindow *iface) ...@@ -88,17 +86,8 @@ static inline ProgressDialog *impl_from_IOleWindow(IOleWindow *iface)
static void set_buffer(LPWSTR *buffer, LPCWSTR string) static void set_buffer(LPWSTR *buffer, LPCWSTR string)
{ {
IMalloc *malloc; free(*buffer);
ULONG cb; *buffer = wcsdup(string ? string : L"");
if (string == NULL)
string = L"";
CoGetMalloc(MEMCTX_TASK, &malloc);
cb = (lstrlenW(string) + 1)*sizeof(WCHAR);
if (*buffer == NULL || cb > IMalloc_GetSize(malloc, *buffer))
*buffer = IMalloc_Realloc(malloc, *buffer, cb);
memcpy(*buffer, string, cb);
} }
struct create_params struct create_params
...@@ -114,7 +103,7 @@ static LPWSTR load_string(HINSTANCE hInstance, UINT uiResourceId) ...@@ -114,7 +103,7 @@ static LPWSTR load_string(HINSTANCE hInstance, UINT uiResourceId)
LPWSTR ret; LPWSTR ret;
LoadStringW(hInstance, uiResourceId, string, ARRAY_SIZE(string)); LoadStringW(hInstance, uiResourceId, string, ARRAY_SIZE(string));
ret = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(string) + 1) * sizeof(WCHAR)); ret = malloc((lstrlenW(string) + 1) * sizeof(WCHAR));
lstrcpyW(ret, string); lstrcpyW(ret, string);
return ret; return ret;
} }
...@@ -277,17 +266,17 @@ static void ProgressDialog_Destructor(ProgressDialog *This) ...@@ -277,17 +266,17 @@ static void ProgressDialog_Destructor(ProgressDialog *This)
TRACE("destroying %p\n", This); TRACE("destroying %p\n", This);
if (This->hwnd) if (This->hwnd)
end_dialog(This); end_dialog(This);
for (i = 0; i < 3; i++) for (i = 0; i < ARRAY_SIZE(This->lines); i++)
heap_free(This->lines[i]); free(This->lines[i]);
heap_free(This->cancelMsg); free(This->cancelMsg);
heap_free(This->title); free(This->title);
for (i = 0; i < 2; i++) for (i = 0; i < ARRAY_SIZE(This->remainingMsg); i++)
heap_free(This->remainingMsg[i]); free(This->remainingMsg[i]);
for (i = 0; i < 3; i++) for (i = 0; i < ARRAY_SIZE(This->timeMsg); i++)
heap_free(This->timeMsg[i]); free(This->timeMsg[i]);
This->cs.DebugInfo->Spare[0] = 0; This->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->cs); DeleteCriticalSection(&This->cs);
heap_free(This); free(This);
InterlockedDecrement(&BROWSEUI_refCount); InterlockedDecrement(&BROWSEUI_refCount);
} }
...@@ -635,8 +624,7 @@ HRESULT ProgressDialog_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) ...@@ -635,8 +624,7 @@ HRESULT ProgressDialog_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
if (pUnkOuter) if (pUnkOuter)
return CLASS_E_NOAGGREGATION; return CLASS_E_NOAGGREGATION;
This = heap_alloc_zero(sizeof(ProgressDialog)); if (!(This = calloc(1, sizeof(*This))))
if (This == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->IProgressDialog_iface.lpVtbl = &ProgressDialogVtbl; This->IProgressDialog_iface.lpVtbl = &ProgressDialogVtbl;
......
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