mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 04:39:45 +00:00
hhctrl.ocx: Rename the wrappers around HeapAlloc() &Co to use the standard names.
This commit is contained in:
parent
41937c5756
commit
7e8d79fa3d
@ -39,10 +39,10 @@ static LPCSTR GetChmString(CHMInfo *chm, DWORD offset)
|
||||
|
||||
if(chm->strings_size <= (offset >> BLOCK_BITS)) {
|
||||
if(chm->strings)
|
||||
chm->strings = hhctrl_realloc_zero(chm->strings,
|
||||
chm->strings = heap_realloc_zero(chm->strings,
|
||||
chm->strings_size = ((offset >> BLOCK_BITS)+1)*sizeof(char*));
|
||||
else
|
||||
chm->strings = hhctrl_alloc_zero(
|
||||
chm->strings = heap_alloc_zero(
|
||||
chm->strings_size = ((offset >> BLOCK_BITS)+1)*sizeof(char*));
|
||||
|
||||
}
|
||||
@ -59,13 +59,13 @@ static LPCSTR GetChmString(CHMInfo *chm, DWORD offset)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
chm->strings[offset >> BLOCK_BITS] = hhctrl_alloc(BLOCK_SIZE);
|
||||
chm->strings[offset >> BLOCK_BITS] = heap_alloc(BLOCK_SIZE);
|
||||
|
||||
hres = IStream_Read(chm->strings_stream, chm->strings[offset >> BLOCK_BITS],
|
||||
BLOCK_SIZE, &read);
|
||||
if(FAILED(hres)) {
|
||||
WARN("Read failed: %08x\n", hres);
|
||||
hhctrl_free(chm->strings[offset >> BLOCK_BITS]);
|
||||
heap_free(chm->strings[offset >> BLOCK_BITS]);
|
||||
chm->strings[offset >> BLOCK_BITS] = NULL;
|
||||
return NULL;
|
||||
}
|
||||
@ -97,7 +97,7 @@ static BOOL ReadChmSystem(CHMInfo *chm)
|
||||
IStream_Read(stream, &ver, sizeof(ver), &read);
|
||||
TRACE("version is %x\n", ver);
|
||||
|
||||
buf = hhctrl_alloc(8*sizeof(DWORD));
|
||||
buf = heap_alloc(8*sizeof(DWORD));
|
||||
buf_size = 8*sizeof(DWORD);
|
||||
|
||||
while(1) {
|
||||
@ -106,7 +106,7 @@ static BOOL ReadChmSystem(CHMInfo *chm)
|
||||
break;
|
||||
|
||||
if(entry.len > buf_size)
|
||||
buf = hhctrl_realloc(buf, buf_size=entry.len);
|
||||
buf = heap_realloc(buf, buf_size=entry.len);
|
||||
|
||||
hres = IStream_Read(stream, buf, entry.len, &read);
|
||||
if(hres != S_OK)
|
||||
@ -142,7 +142,7 @@ static BOOL ReadChmSystem(CHMInfo *chm)
|
||||
}
|
||||
}
|
||||
|
||||
hhctrl_free(buf);
|
||||
heap_free(buf);
|
||||
IStream_Release(stream);
|
||||
|
||||
return SUCCEEDED(hres);
|
||||
@ -171,12 +171,12 @@ LPWSTR FindContextAlias(CHMInfo *chm, DWORD index)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
buf = hhctrl_alloc(size);
|
||||
buf = heap_alloc(size);
|
||||
hres = IStream_Read(ivb_stream, buf, size, &read);
|
||||
IStream_Release(ivb_stream);
|
||||
if(FAILED(hres)) {
|
||||
WARN("Read failed: %08x\n", hres);
|
||||
hhctrl_free(buf);
|
||||
heap_free(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ LPWSTR FindContextAlias(CHMInfo *chm, DWORD index)
|
||||
}
|
||||
}
|
||||
|
||||
hhctrl_free(buf);
|
||||
heap_free(buf);
|
||||
|
||||
TRACE("returning %s\n", debugstr_a(ret));
|
||||
return strdupAtoW(ret);
|
||||
@ -340,7 +340,7 @@ CHMInfo *OpenCHM(LPCWSTR szFile)
|
||||
|
||||
static const WCHAR wszSTRINGS[] = {'#','S','T','R','I','N','G','S',0};
|
||||
|
||||
CHMInfo *ret = hhctrl_alloc_zero(sizeof(CHMInfo));
|
||||
CHMInfo *ret = heap_alloc_zero(sizeof(CHMInfo));
|
||||
|
||||
res = GetFullPathNameW(szFile, sizeof(file), file, NULL);
|
||||
ret->szFile = strdupW(file);
|
||||
@ -389,11 +389,11 @@ CHMInfo *CloseCHM(CHMInfo *chm)
|
||||
int i;
|
||||
|
||||
for(i=0; i<chm->strings_size; i++)
|
||||
hhctrl_free(chm->strings[i]);
|
||||
heap_free(chm->strings[i]);
|
||||
}
|
||||
|
||||
hhctrl_free(chm->strings);
|
||||
hhctrl_free(chm);
|
||||
heap_free(chm->strings);
|
||||
heap_free(chm);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -41,10 +41,10 @@ static void free_content_item(ContentItem *item)
|
||||
|
||||
free_content_item(item->child);
|
||||
|
||||
hhctrl_free(item->name);
|
||||
hhctrl_free(item->local);
|
||||
hhctrl_free(item->merge.chm_file);
|
||||
hhctrl_free(item->merge.chm_index);
|
||||
heap_free(item->name);
|
||||
heap_free(item->local);
|
||||
heap_free(item->merge.chm_file);
|
||||
heap_free(item->merge.chm_index);
|
||||
|
||||
item = next;
|
||||
}
|
||||
@ -60,7 +60,7 @@ static void strbuf_init(strbuf_t *buf)
|
||||
{
|
||||
buf->size = 8;
|
||||
buf->len = 0;
|
||||
buf->buf = hhctrl_alloc(buf->size);
|
||||
buf->buf = heap_alloc(buf->size);
|
||||
}
|
||||
|
||||
static void strbuf_zero(strbuf_t *buf)
|
||||
@ -70,14 +70,14 @@ static void strbuf_zero(strbuf_t *buf)
|
||||
|
||||
static void strbuf_free(strbuf_t *buf)
|
||||
{
|
||||
hhctrl_free(buf->buf);
|
||||
heap_free(buf->buf);
|
||||
}
|
||||
|
||||
static void strbuf_append(strbuf_t *buf, const char *data, int len)
|
||||
{
|
||||
if(buf->len+len > buf->size) {
|
||||
buf->size = buf->len+len;
|
||||
buf->buf = hhctrl_realloc(buf->buf, buf->size);
|
||||
buf->buf = heap_realloc(buf->buf, buf->size);
|
||||
}
|
||||
|
||||
memcpy(buf->buf+buf->len, data, len);
|
||||
@ -208,13 +208,13 @@ static void parse_obj_node_param(ContentItem *item, ContentItem *hhc_root, const
|
||||
}
|
||||
|
||||
wlen = MultiByteToWideChar(CP_ACP, 0, ptr, len, NULL, 0);
|
||||
*param = hhctrl_alloc((wlen+1)*sizeof(WCHAR));
|
||||
*param = heap_alloc((wlen+1)*sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, ptr, len, *param, wlen);
|
||||
(*param)[wlen] = 0;
|
||||
|
||||
if(param == &merge) {
|
||||
SetChmPath(&item->merge, hhc_root->merge.chm_file, merge);
|
||||
hhctrl_free(merge);
|
||||
heap_free(merge);
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,7 +258,7 @@ static ContentItem *parse_sitemap_object(HHInfo *info, stream_t *stream, Content
|
||||
strbuf_init(&node);
|
||||
strbuf_init(&node_name);
|
||||
|
||||
item = hhctrl_alloc_zero(sizeof(ContentItem));
|
||||
item = heap_alloc_zero(sizeof(ContentItem));
|
||||
|
||||
while(next_node(stream, &node)) {
|
||||
get_node_name(&node, &node_name);
|
||||
@ -421,7 +421,7 @@ void InitContent(HHInfo *info)
|
||||
IStream *stream;
|
||||
insert_type_t insert_type;
|
||||
|
||||
info->content = hhctrl_alloc_zero(sizeof(ContentItem));
|
||||
info->content = heap_alloc_zero(sizeof(ContentItem));
|
||||
SetChmPath(&info->content->merge, info->pCHMInfo->szFile, info->WinType.pszToc);
|
||||
|
||||
stream = GetChmStream(info->pCHMInfo, info->pCHMInfo->szFile, &info->content->merge);
|
||||
|
@ -56,7 +56,7 @@ static LPWSTR HH_LoadString(DWORD dwID)
|
||||
iSize = LoadStringW(hhctrl_hinstance, dwID, NULL, 0);
|
||||
iSize += 2; /* some strings (tab text) needs double-null termination */
|
||||
|
||||
string = hhctrl_alloc(iSize * sizeof(WCHAR));
|
||||
string = heap_alloc(iSize * sizeof(WCHAR));
|
||||
LoadStringW(hhctrl_hinstance, dwID, string, iSize);
|
||||
|
||||
return string;
|
||||
@ -95,8 +95,8 @@ BOOL NavigateToUrl(HHInfo *info, LPCWSTR surl)
|
||||
SetChmPath(&chm_path, info->pCHMInfo->szFile, surl);
|
||||
ret = NavigateToChm(info, chm_path.chm_file, chm_path.chm_index);
|
||||
|
||||
hhctrl_free(chm_path.chm_file);
|
||||
hhctrl_free(chm_path.chm_index);
|
||||
heap_free(chm_path.chm_file);
|
||||
heap_free(chm_path.chm_index);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -577,7 +577,7 @@ static BOOL HH_AddToolbar(HHInfo *pHHInfo)
|
||||
szBuf[dwLen + 2] = 0; /* Double-null terminate */
|
||||
|
||||
buttons[dwIndex].iString = (DWORD)SendMessageW(hToolbar, TB_ADDSTRINGW, 0, (LPARAM)szBuf);
|
||||
hhctrl_free(szBuf);
|
||||
heap_free(szBuf);
|
||||
}
|
||||
|
||||
SendMessageW(hToolbar, TB_ADDBUTTONSW, dwNumButtons, (LPARAM)&buttons);
|
||||
@ -623,7 +623,7 @@ static DWORD NP_CreateTab(HINSTANCE hInstance, HWND hwndTabCtrl, DWORD index)
|
||||
|
||||
ret = SendMessageW( hwndTabCtrl, TCM_INSERTITEMW, index, (LPARAM)&tie );
|
||||
|
||||
hhctrl_free(tabText);
|
||||
heap_free(tabText);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -922,16 +922,16 @@ void ReleaseHelpViewer(HHInfo *info)
|
||||
return;
|
||||
|
||||
/* Free allocated strings */
|
||||
hhctrl_free((LPWSTR)info->WinType.pszType);
|
||||
hhctrl_free((LPWSTR)info->WinType.pszCaption);
|
||||
hhctrl_free((LPWSTR)info->WinType.pszToc);
|
||||
hhctrl_free((LPWSTR)info->WinType.pszIndex);
|
||||
hhctrl_free((LPWSTR)info->WinType.pszFile);
|
||||
hhctrl_free((LPWSTR)info->WinType.pszHome);
|
||||
hhctrl_free((LPWSTR)info->WinType.pszJump1);
|
||||
hhctrl_free((LPWSTR)info->WinType.pszJump2);
|
||||
hhctrl_free((LPWSTR)info->WinType.pszUrlJump1);
|
||||
hhctrl_free((LPWSTR)info->WinType.pszUrlJump2);
|
||||
heap_free((LPWSTR)info->WinType.pszType);
|
||||
heap_free((LPWSTR)info->WinType.pszCaption);
|
||||
heap_free((LPWSTR)info->WinType.pszToc);
|
||||
heap_free((LPWSTR)info->WinType.pszIndex);
|
||||
heap_free((LPWSTR)info->WinType.pszFile);
|
||||
heap_free((LPWSTR)info->WinType.pszHome);
|
||||
heap_free((LPWSTR)info->WinType.pszJump1);
|
||||
heap_free((LPWSTR)info->WinType.pszJump2);
|
||||
heap_free((LPWSTR)info->WinType.pszUrlJump1);
|
||||
heap_free((LPWSTR)info->WinType.pszUrlJump2);
|
||||
|
||||
if (info->pCHMInfo)
|
||||
CloseCHM(info->pCHMInfo);
|
||||
@ -942,13 +942,13 @@ void ReleaseHelpViewer(HHInfo *info)
|
||||
if(info->WinType.hwndHelp)
|
||||
DestroyWindow(info->WinType.hwndHelp);
|
||||
|
||||
hhctrl_free(info);
|
||||
heap_free(info);
|
||||
OleUninitialize();
|
||||
}
|
||||
|
||||
HHInfo *CreateHelpViewer(LPCWSTR filename)
|
||||
{
|
||||
HHInfo *info = hhctrl_alloc_zero(sizeof(HHInfo));
|
||||
HHInfo *info = heap_alloc_zero(sizeof(HHInfo));
|
||||
|
||||
OleInitialize(NULL);
|
||||
|
||||
|
@ -147,7 +147,7 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
|
||||
return NULL;
|
||||
|
||||
NavigateToUrl(info, url);
|
||||
hhctrl_free(url);
|
||||
heap_free(url);
|
||||
|
||||
return NULL; /* FIXME */
|
||||
}
|
||||
@ -180,7 +180,7 @@ HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD_PTR data
|
||||
if (filename)
|
||||
{
|
||||
len = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 );
|
||||
wfile = hhctrl_alloc(len*sizeof(WCHAR));
|
||||
wfile = heap_alloc(len*sizeof(WCHAR));
|
||||
MultiByteToWideChar( CP_ACP, 0, filename, -1, wfile, len );
|
||||
}
|
||||
|
||||
@ -205,7 +205,7 @@ HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD_PTR data
|
||||
case HH_GET_WIN_HANDLE:
|
||||
case HH_SAFE_DISPLAY_TOPIC:
|
||||
len = MultiByteToWideChar( CP_ACP, 0, (const char*)data, -1, NULL, 0 );
|
||||
wdata = hhctrl_alloc(len*sizeof(WCHAR));
|
||||
wdata = heap_alloc(len*sizeof(WCHAR));
|
||||
MultiByteToWideChar( CP_ACP, 0, (const char*)data, -1, wdata, len );
|
||||
break;
|
||||
|
||||
@ -227,8 +227,8 @@ HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD_PTR data
|
||||
|
||||
result = HtmlHelpW( caller, wfile, command, wdata ? (DWORD_PTR)wdata : data );
|
||||
|
||||
hhctrl_free(wfile);
|
||||
hhctrl_free(wdata);
|
||||
heap_free(wfile);
|
||||
heap_free(wdata);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -124,27 +124,27 @@ BOOL NavigateToChm(HHInfo*,LPCWSTR,LPCWSTR);
|
||||
|
||||
/* memory allocation functions */
|
||||
|
||||
static inline void *hhctrl_alloc(size_t len)
|
||||
static inline void *heap_alloc(size_t len)
|
||||
{
|
||||
return HeapAlloc(GetProcessHeap(), 0, len);
|
||||
}
|
||||
|
||||
static inline void *hhctrl_alloc_zero(size_t len)
|
||||
static inline void *heap_alloc_zero(size_t len)
|
||||
{
|
||||
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
|
||||
}
|
||||
|
||||
static inline void *hhctrl_realloc(void *mem, size_t len)
|
||||
static inline void *heap_realloc(void *mem, size_t len)
|
||||
{
|
||||
return HeapReAlloc(GetProcessHeap(), 0, mem, len);
|
||||
}
|
||||
|
||||
static inline void *hhctrl_realloc_zero(void *mem, size_t len)
|
||||
static inline void *heap_realloc_zero(void *mem, size_t len)
|
||||
{
|
||||
return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
|
||||
}
|
||||
|
||||
static inline BOOL hhctrl_free(void *mem)
|
||||
static inline BOOL heap_free(void *mem)
|
||||
{
|
||||
return HeapFree(GetProcessHeap(), 0, mem);
|
||||
}
|
||||
@ -158,7 +158,7 @@ static inline LPWSTR strdupW(LPCWSTR str)
|
||||
return NULL;
|
||||
|
||||
size = (strlenW(str)+1)*sizeof(WCHAR);
|
||||
ret = hhctrl_alloc(size);
|
||||
ret = heap_alloc(size);
|
||||
memcpy(ret, str, size);
|
||||
|
||||
return ret;
|
||||
@ -173,7 +173,7 @@ static inline LPWSTR strdupAtoW(LPCSTR str)
|
||||
return NULL;
|
||||
|
||||
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
|
||||
ret = hhctrl_alloc(len*sizeof(WCHAR));
|
||||
ret = heap_alloc(len*sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
|
||||
|
||||
return ret;
|
||||
|
@ -74,7 +74,7 @@ static ULONG STDMETHODCALLTYPE Site_Release(IOleClientSite *iface)
|
||||
if (refCount)
|
||||
return refCount;
|
||||
|
||||
hhctrl_free(This);
|
||||
heap_free(This);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -576,7 +576,7 @@ BOOL InitWebBrowser(HHInfo *info, HWND hwndParent)
|
||||
HRESULT hr;
|
||||
RECT rc;
|
||||
|
||||
iOleClientSiteImpl = hhctrl_alloc_zero(sizeof(IOleClientSiteImpl));
|
||||
iOleClientSiteImpl = heap_alloc_zero(sizeof(IOleClientSiteImpl));
|
||||
if (!iOleClientSiteImpl)
|
||||
return FALSE;
|
||||
|
||||
@ -625,7 +625,7 @@ BOOL InitWebBrowser(HHInfo *info, HWND hwndParent)
|
||||
|
||||
error:
|
||||
ReleaseWebBrowser(info);
|
||||
hhctrl_free(iOleClientSiteImpl);
|
||||
heap_free(iOleClientSiteImpl);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user