Commit 9dba420d authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

hhctrl: Use standard C functions for memory allocation.

parent 7ed17ec2
...@@ -33,25 +33,20 @@ static LPCSTR GetChmString(CHMInfo *chm, DWORD offset) ...@@ -33,25 +33,20 @@ static LPCSTR GetChmString(CHMInfo *chm, DWORD offset)
{ {
LPCSTR str; LPCSTR str;
char **new_strings; char **new_strings;
DWORD new_strings_size;
if(!chm->strings_stream) if(!chm->strings_stream)
return NULL; return NULL;
if(chm->strings_size <= (offset >> BLOCK_BITS)) { if(chm->strings_size <= (offset >> BLOCK_BITS)) {
chm->strings_size = (offset >> BLOCK_BITS)+1; new_strings_size = (offset >> BLOCK_BITS) + 1;
if(chm->strings) { new_strings = realloc(chm->strings, new_strings_size * sizeof(char*));
new_strings = heap_realloc_zero(chm->strings, if(!new_strings)
chm->strings_size*sizeof(char*)); return NULL;
if(!new_strings) memset(new_strings + chm->strings_size, 0,
return NULL; (new_strings_size - chm->strings_size) * sizeof(char*));
chm->strings = new_strings; chm->strings = new_strings;
}else { chm->strings_size = new_strings_size;
chm->strings = heap_alloc_zero(
chm->strings_size*sizeof(char*));
if(!chm->strings)
return NULL;
}
} }
if(!chm->strings[offset >> BLOCK_BITS]) { if(!chm->strings[offset >> BLOCK_BITS]) {
...@@ -66,13 +61,13 @@ static LPCSTR GetChmString(CHMInfo *chm, DWORD offset) ...@@ -66,13 +61,13 @@ static LPCSTR GetChmString(CHMInfo *chm, DWORD offset)
return NULL; return NULL;
} }
chm->strings[offset >> BLOCK_BITS] = heap_alloc(BLOCK_SIZE); chm->strings[offset >> BLOCK_BITS] = malloc(BLOCK_SIZE);
hres = IStream_Read(chm->strings_stream, chm->strings[offset >> BLOCK_BITS], hres = IStream_Read(chm->strings_stream, chm->strings[offset >> BLOCK_BITS],
BLOCK_SIZE, &read); BLOCK_SIZE, &read);
if(FAILED(hres)) { if(FAILED(hres)) {
WARN("Read failed: %08lx\n", hres); WARN("Read failed: %08lx\n", hres);
heap_free(chm->strings[offset >> BLOCK_BITS]); free(chm->strings[offset >> BLOCK_BITS]);
chm->strings[offset >> BLOCK_BITS] = NULL; chm->strings[offset >> BLOCK_BITS] = NULL;
return NULL; return NULL;
} }
...@@ -106,7 +101,7 @@ static BOOL ReadChmSystem(CHMInfo *chm) ...@@ -106,7 +101,7 @@ static BOOL ReadChmSystem(CHMInfo *chm)
IStream_Read(stream, &ver, sizeof(ver), &read); IStream_Read(stream, &ver, sizeof(ver), &read);
TRACE("version is %lx\n", ver); TRACE("version is %lx\n", ver);
buf = heap_alloc(8*sizeof(DWORD)); buf = malloc(8 * sizeof(DWORD));
buf_size = 8*sizeof(DWORD); buf_size = 8*sizeof(DWORD);
while(1) { while(1) {
...@@ -115,7 +110,7 @@ static BOOL ReadChmSystem(CHMInfo *chm) ...@@ -115,7 +110,7 @@ static BOOL ReadChmSystem(CHMInfo *chm)
break; break;
if(entry.len > buf_size) if(entry.len > buf_size)
buf = heap_realloc(buf, buf_size=entry.len); buf = realloc(buf, buf_size=entry.len);
hres = IStream_Read(stream, buf, entry.len, &read); hres = IStream_Read(stream, buf, entry.len, &read);
if(hres != S_OK) if(hres != S_OK)
...@@ -124,17 +119,17 @@ static BOOL ReadChmSystem(CHMInfo *chm) ...@@ -124,17 +119,17 @@ static BOOL ReadChmSystem(CHMInfo *chm)
switch(entry.code) { switch(entry.code) {
case 0x0: case 0x0:
TRACE("TOC is %s\n", debugstr_an(buf, entry.len)); TRACE("TOC is %s\n", debugstr_an(buf, entry.len));
heap_free(chm->defToc); free(chm->defToc);
chm->defToc = strdupnAtoW(buf, entry.len); chm->defToc = strdupnAtoW(buf, entry.len);
break; break;
case 0x2: case 0x2:
TRACE("Default topic is %s\n", debugstr_an(buf, entry.len)); TRACE("Default topic is %s\n", debugstr_an(buf, entry.len));
heap_free(chm->defTopic); free(chm->defTopic);
chm->defTopic = strdupnAtoW(buf, entry.len); chm->defTopic = strdupnAtoW(buf, entry.len);
break; break;
case 0x3: case 0x3:
TRACE("Title is %s\n", debugstr_an(buf, entry.len)); TRACE("Title is %s\n", debugstr_an(buf, entry.len));
heap_free(chm->defTitle); free(chm->defTitle);
chm->defTitle = strdupnAtoW(buf, entry.len); chm->defTitle = strdupnAtoW(buf, entry.len);
break; break;
case 0x4: case 0x4:
...@@ -150,7 +145,7 @@ static BOOL ReadChmSystem(CHMInfo *chm) ...@@ -150,7 +145,7 @@ static BOOL ReadChmSystem(CHMInfo *chm)
break; break;
case 0x6: case 0x6:
TRACE("Compiled file is %s\n", debugstr_an(buf, entry.len)); TRACE("Compiled file is %s\n", debugstr_an(buf, entry.len));
heap_free(chm->compiledFile); free(chm->compiledFile);
chm->compiledFile = strdupnAtoW(buf, entry.len); chm->compiledFile = strdupnAtoW(buf, entry.len);
break; break;
case 0x9: case 0x9:
...@@ -170,7 +165,7 @@ static BOOL ReadChmSystem(CHMInfo *chm) ...@@ -170,7 +165,7 @@ static BOOL ReadChmSystem(CHMInfo *chm)
} }
} }
heap_free(buf); free(buf);
IStream_Release(stream); IStream_Release(stream);
return SUCCEEDED(hres); return SUCCEEDED(hres);
...@@ -199,12 +194,12 @@ LPWSTR FindContextAlias(CHMInfo *chm, DWORD index) ...@@ -199,12 +194,12 @@ LPWSTR FindContextAlias(CHMInfo *chm, DWORD index)
return NULL; return NULL;
} }
buf = heap_alloc(size); buf = malloc(size);
hres = IStream_Read(ivb_stream, buf, size, &read); hres = IStream_Read(ivb_stream, buf, size, &read);
IStream_Release(ivb_stream); IStream_Release(ivb_stream);
if(FAILED(hres)) { if(FAILED(hres)) {
WARN("Read failed: %08lx\n", hres); WARN("Read failed: %08lx\n", hres);
heap_free(buf); free(buf);
return NULL; return NULL;
} }
...@@ -217,7 +212,7 @@ LPWSTR FindContextAlias(CHMInfo *chm, DWORD index) ...@@ -217,7 +212,7 @@ LPWSTR FindContextAlias(CHMInfo *chm, DWORD index)
} }
} }
heap_free(buf); free(buf);
TRACE("returning %s\n", debugstr_a(ret)); TRACE("returning %s\n", debugstr_a(ret));
return strdupAtoW(ret); return strdupAtoW(ret);
...@@ -235,15 +230,15 @@ static WCHAR *FindHTMLHelpSetting(HHInfo *info, const WCHAR *extW) ...@@ -235,15 +230,15 @@ static WCHAR *FindHTMLHelpSetting(HHInfo *info, const WCHAR *extW)
WCHAR *filename; WCHAR *filename;
HRESULT hr; HRESULT hr;
filename = heap_alloc( (lstrlenW(info->pCHMInfo->compiledFile) filename = malloc( (wcslen(info->pCHMInfo->compiledFile)
+ lstrlenW(periodW) + lstrlenW(extW) + 1) * sizeof(WCHAR) ); + wcslen(periodW) + wcslen(extW) + 1) * sizeof(WCHAR) );
lstrcpyW(filename, info->pCHMInfo->compiledFile); lstrcpyW(filename, info->pCHMInfo->compiledFile);
lstrcatW(filename, periodW); lstrcatW(filename, periodW);
lstrcatW(filename, extW); lstrcatW(filename, extW);
hr = IStorage_OpenStream(pStorage, filename, NULL, STGM_READ, 0, &pStream); hr = IStorage_OpenStream(pStorage, filename, NULL, STGM_READ, 0, &pStream);
if (FAILED(hr)) if (FAILED(hr))
{ {
heap_free(filename); free(filename);
return strdupAtoW(""); return strdupAtoW("");
} }
IStream_Release(pStream); IStream_Release(pStream);
...@@ -253,7 +248,7 @@ static WCHAR *FindHTMLHelpSetting(HHInfo *info, const WCHAR *extW) ...@@ -253,7 +248,7 @@ static WCHAR *FindHTMLHelpSetting(HHInfo *info, const WCHAR *extW)
static inline WCHAR *MergeChmString(LPCWSTR src, WCHAR **dst) static inline WCHAR *MergeChmString(LPCWSTR src, WCHAR **dst)
{ {
if(*dst == NULL) if(*dst == NULL)
*dst = strdupW(src); *dst = wcsdup(src);
return *dst; return *dst;
} }
...@@ -326,18 +321,18 @@ static inline WCHAR *ConvertChmString(HHInfo *info, DWORD id) ...@@ -326,18 +321,18 @@ static inline WCHAR *ConvertChmString(HHInfo *info, DWORD id)
static inline void wintype_free(HH_WINTYPEW *wintype) static inline void wintype_free(HH_WINTYPEW *wintype)
{ {
heap_free((void *)wintype->pszType); free((void *)wintype->pszType);
heap_free((void *)wintype->pszCaption); free((void *)wintype->pszCaption);
heap_free(wintype->paInfoTypes); free(wintype->paInfoTypes);
heap_free((void *)wintype->pszToc); free((void *)wintype->pszToc);
heap_free((void *)wintype->pszIndex); free((void *)wintype->pszIndex);
heap_free((void *)wintype->pszFile); free((void *)wintype->pszFile);
heap_free((void *)wintype->pszHome); free((void *)wintype->pszHome);
heap_free((void *)wintype->pszJump1); free((void *)wintype->pszJump1);
heap_free((void *)wintype->pszJump2); free((void *)wintype->pszJump2);
heap_free((void *)wintype->pszUrlJump1); free((void *)wintype->pszUrlJump1);
heap_free((void *)wintype->pszUrlJump2); free((void *)wintype->pszUrlJump2);
heap_free((void *)wintype->pszCustomTabs); free((void *)wintype->pszCustomTabs);
} }
/* Loads the HH_WINTYPE data from the CHM file /* Loads the HH_WINTYPE data from the CHM file
...@@ -452,9 +447,9 @@ BOOL LoadWinTypeFromCHM(HHInfo *info) ...@@ -452,9 +447,9 @@ BOOL LoadWinTypeFromCHM(HHInfo *info)
{ {
/* no defined window types so use (hopefully) sane defaults */ /* no defined window types so use (hopefully) sane defaults */
static const WCHAR defaultwinW[] = {'d','e','f','a','u','l','t','w','i','n','\0'}; static const WCHAR defaultwinW[] = {'d','e','f','a','u','l','t','w','i','n','\0'};
wintype.pszType = strdupW(info->pCHMInfo->defWindow ? info->pCHMInfo->defWindow : defaultwinW); wintype.pszType = wcsdup(info->pCHMInfo->defWindow ? info->pCHMInfo->defWindow : defaultwinW);
wintype.pszToc = strdupW(info->pCHMInfo->defToc ? info->pCHMInfo->defToc : empty); wintype.pszToc = wcsdup(info->pCHMInfo->defToc ? info->pCHMInfo->defToc : empty);
wintype.pszIndex = strdupW(empty); wintype.pszIndex = wcsdup(empty);
wintype.fsValidMembers = 0; wintype.fsValidMembers = 0;
wintype.fsWinProperties = HHWIN_PROP_TRI_PANE; wintype.fsWinProperties = HHWIN_PROP_TRI_PANE;
wintype.dwStyles = WS_POPUP; wintype.dwStyles = WS_POPUP;
...@@ -466,9 +461,9 @@ BOOL LoadWinTypeFromCHM(HHInfo *info) ...@@ -466,9 +461,9 @@ BOOL LoadWinTypeFromCHM(HHInfo *info)
/* merge the new data with any pre-existing HH_WINTYPE structure */ /* merge the new data with any pre-existing HH_WINTYPE structure */
MergeChmProperties(&wintype, info, FALSE); MergeChmProperties(&wintype, info, FALSE);
if (!info->WinType.pszCaption) if (!info->WinType.pszCaption)
info->WinType.pszCaption = info->stringsW.pszCaption = strdupW(info->pCHMInfo->defTitle ? info->pCHMInfo->defTitle : empty); info->WinType.pszCaption = info->stringsW.pszCaption = wcsdup(info->pCHMInfo->defTitle ? info->pCHMInfo->defTitle : empty);
if (!info->WinType.pszFile) if (!info->WinType.pszFile)
info->WinType.pszFile = info->stringsW.pszFile = strdupW(info->pCHMInfo->defTopic ? info->pCHMInfo->defTopic : empty); info->WinType.pszFile = info->stringsW.pszFile = wcsdup(info->pCHMInfo->defTopic ? info->pCHMInfo->defTopic : empty);
if (!info->WinType.pszToc) if (!info->WinType.pszToc)
info->WinType.pszToc = info->stringsW.pszToc = FindHTMLHelpSetting(info, toc_extW); info->WinType.pszToc = info->stringsW.pszToc = FindHTMLHelpSetting(info, toc_extW);
if (!info->WinType.pszIndex) if (!info->WinType.pszIndex)
...@@ -524,14 +519,14 @@ void SetChmPath(ChmPath *file, LPCWSTR base_file, LPCWSTR path) ...@@ -524,14 +519,14 @@ void SetChmPath(ChmPath *file, LPCWSTR base_file, LPCWSTR path)
PathCombineW(chm_file, base_path, rel_path); PathCombineW(chm_file, base_path, rel_path);
file->chm_file = strdupW(chm_file); file->chm_file = wcsdup(chm_file);
ptr += 2; ptr += 2;
}else { }else {
file->chm_file = strdupW(base_file); file->chm_file = wcsdup(base_file);
ptr = path; ptr = path;
} }
file->chm_index = strdupW(ptr); file->chm_index = wcsdup(ptr);
TRACE("ChmFile = {%s %s}\n", debugstr_w(file->chm_file), debugstr_w(file->chm_index)); TRACE("ChmFile = {%s %s}\n", debugstr_w(file->chm_file), debugstr_w(file->chm_index));
} }
...@@ -630,12 +625,12 @@ CHMInfo *OpenCHM(LPCWSTR szFile) ...@@ -630,12 +625,12 @@ CHMInfo *OpenCHM(LPCWSTR szFile)
static const WCHAR wszSTRINGS[] = {'#','S','T','R','I','N','G','S',0}; static const WCHAR wszSTRINGS[] = {'#','S','T','R','I','N','G','S',0};
if (!(ret = heap_alloc_zero(sizeof(CHMInfo)))) if (!(ret = calloc(1, sizeof(CHMInfo))))
return NULL; return NULL;
ret->codePage = CP_ACP; ret->codePage = CP_ACP;
if (!(ret->szFile = strdupW(szFile))) { if (!(ret->szFile = wcsdup(szFile))) {
heap_free(ret); free(ret);
return NULL; return NULL;
} }
...@@ -682,17 +677,17 @@ CHMInfo *CloseCHM(CHMInfo *chm) ...@@ -682,17 +677,17 @@ CHMInfo *CloseCHM(CHMInfo *chm)
DWORD i; DWORD i;
for(i=0; i<chm->strings_size; i++) for(i=0; i<chm->strings_size; i++)
heap_free(chm->strings[i]); free(chm->strings[i]);
} }
heap_free(chm->strings); free(chm->strings);
heap_free(chm->defWindow); free(chm->defWindow);
heap_free(chm->defTitle); free(chm->defTitle);
heap_free(chm->defTopic); free(chm->defTopic);
heap_free(chm->defToc); free(chm->defToc);
heap_free(chm->szFile); free(chm->szFile);
heap_free(chm->compiledFile); free(chm->compiledFile);
heap_free(chm); free(chm);
return NULL; return NULL;
} }
...@@ -41,10 +41,10 @@ static void free_content_item(ContentItem *item) ...@@ -41,10 +41,10 @@ static void free_content_item(ContentItem *item)
free_content_item(item->child); free_content_item(item->child);
heap_free(item->name); free(item->name);
heap_free(item->local); free(item->local);
heap_free(item->merge.chm_file); free(item->merge.chm_file);
heap_free(item->merge.chm_index); free(item->merge.chm_index);
item = next; item = next;
} }
...@@ -97,7 +97,7 @@ static void parse_obj_node_param(ContentItem *item, ContentItem *hhc_root, const ...@@ -97,7 +97,7 @@ static void parse_obj_node_param(ContentItem *item, ContentItem *hhc_root, const
if(param == &merge) { if(param == &merge) {
SetChmPath(&item->merge, hhc_root->merge.chm_file, merge); SetChmPath(&item->merge, hhc_root->merge.chm_file, merge);
heap_free(merge); free(merge);
} }
} }
...@@ -141,7 +141,7 @@ static ContentItem *parse_sitemap_object(HHInfo *info, stream_t *stream, Content ...@@ -141,7 +141,7 @@ static ContentItem *parse_sitemap_object(HHInfo *info, stream_t *stream, Content
strbuf_init(&node); strbuf_init(&node);
strbuf_init(&node_name); strbuf_init(&node_name);
item = heap_alloc_zero(sizeof(ContentItem)); item = calloc(1, sizeof(ContentItem));
while(next_node(stream, &node)) { while(next_node(stream, &node)) {
get_node_name(&node, &node_name); get_node_name(&node, &node_name);
...@@ -306,7 +306,7 @@ void InitContent(HHInfo *info) ...@@ -306,7 +306,7 @@ void InitContent(HHInfo *info)
IStream *stream; IStream *stream;
insert_type_t insert_type; insert_type_t insert_type;
info->content = heap_alloc_zero(sizeof(ContentItem)); info->content = calloc(1, sizeof(ContentItem));
SetChmPath(&info->content->merge, info->pCHMInfo->szFile, info->WinType.pszToc); SetChmPath(&info->content->merge, info->pCHMInfo->szFile, info->WinType.pszToc);
stream = GetChmStream(info->pCHMInfo, info->pCHMInfo->szFile, &info->content->merge); stream = GetChmStream(info->pCHMInfo, info->pCHMInfo->szFile, &info->content->merge);
......
...@@ -179,7 +179,7 @@ static LPWSTR HH_LoadString(DWORD dwID) ...@@ -179,7 +179,7 @@ static LPWSTR HH_LoadString(DWORD dwID)
iSize = LoadStringW(hhctrl_hinstance, dwID, (LPWSTR)&stringresource, 0); iSize = LoadStringW(hhctrl_hinstance, dwID, (LPWSTR)&stringresource, 0);
string = heap_alloc((iSize + 2) * sizeof(WCHAR)); /* some strings (tab text) needs double-null termination */ string = malloc((iSize + 2) * sizeof(WCHAR)); /* some strings (tab text) needs double-null termination */
memcpy(string, stringresource, iSize*sizeof(WCHAR)); memcpy(string, stringresource, iSize*sizeof(WCHAR));
string[iSize] = 0; string[iSize] = 0;
...@@ -225,8 +225,8 @@ BOOL NavigateToUrl(HHInfo *info, LPCWSTR surl) ...@@ -225,8 +225,8 @@ BOOL NavigateToUrl(HHInfo *info, LPCWSTR surl)
SetChmPath(&chm_path, info->pCHMInfo->szFile, surl); SetChmPath(&chm_path, info->pCHMInfo->szFile, surl);
ret = NavigateToChm(info, chm_path.chm_file, chm_path.chm_index); ret = NavigateToChm(info, chm_path.chm_file, chm_path.chm_index);
heap_free(chm_path.chm_file); free(chm_path.chm_file);
heap_free(chm_path.chm_index); free(chm_path.chm_index);
return ret; return ret;
} }
...@@ -844,7 +844,7 @@ static void DisplayPopupMenu(HHInfo *info) ...@@ -844,7 +844,7 @@ static void DisplayPopupMenu(HHInfo *info)
item.dwTypeData = HH_LoadString(IDS_HIDETABS); item.dwTypeData = HH_LoadString(IDS_HIDETABS);
SetMenuItemInfoW(submenu, IDTB_EXPAND, FALSE, &item); SetMenuItemInfoW(submenu, IDTB_EXPAND, FALSE, &item);
heap_free(item.dwTypeData); free(item.dwTypeData);
/* Find the index toolbar button */ /* Find the index toolbar button */
button.cbSize = sizeof(TBBUTTONINFOW); button.cbSize = sizeof(TBBUTTONINFOW);
...@@ -1029,7 +1029,7 @@ static BOOL HH_AddToolbar(HHInfo *pHHInfo) ...@@ -1029,7 +1029,7 @@ static BOOL HH_AddToolbar(HHInfo *pHHInfo)
szBuf[dwLen + 1] = 0; /* Double-null terminate */ szBuf[dwLen + 1] = 0; /* Double-null terminate */
buttons[dwIndex].iString = (DWORD)SendMessageW(hToolbar, TB_ADDSTRINGW, 0, (LPARAM)szBuf); buttons[dwIndex].iString = (DWORD)SendMessageW(hToolbar, TB_ADDSTRINGW, 0, (LPARAM)szBuf);
heap_free(szBuf); free(szBuf);
} }
SendMessageW(hToolbar, TB_ADDBUTTONSW, dwNumButtons, (LPARAM)buttons); SendMessageW(hToolbar, TB_ADDBUTTONSW, dwNumButtons, (LPARAM)buttons);
...@@ -1075,7 +1075,7 @@ static DWORD NP_CreateTab(HINSTANCE hInstance, HWND hwndTabCtrl, DWORD index) ...@@ -1075,7 +1075,7 @@ static DWORD NP_CreateTab(HINSTANCE hInstance, HWND hwndTabCtrl, DWORD index)
ret = SendMessageW( hwndTabCtrl, TCM_INSERTITEMW, index, (LPARAM)&tie ); ret = SendMessageW( hwndTabCtrl, TCM_INSERTITEMW, index, (LPARAM)&tie );
heap_free(tabText); free(tabText);
return ret; return ret;
} }
...@@ -1760,31 +1760,31 @@ static BOOL CreateViewer(HHInfo *pHHInfo) ...@@ -1760,31 +1760,31 @@ static BOOL CreateViewer(HHInfo *pHHInfo)
void wintype_stringsW_free(struct wintype_stringsW *stringsW) void wintype_stringsW_free(struct wintype_stringsW *stringsW)
{ {
heap_free(stringsW->pszType); free(stringsW->pszType);
heap_free(stringsW->pszCaption); free(stringsW->pszCaption);
heap_free(stringsW->pszToc); free(stringsW->pszToc);
heap_free(stringsW->pszIndex); free(stringsW->pszIndex);
heap_free(stringsW->pszFile); free(stringsW->pszFile);
heap_free(stringsW->pszHome); free(stringsW->pszHome);
heap_free(stringsW->pszJump1); free(stringsW->pszJump1);
heap_free(stringsW->pszJump2); free(stringsW->pszJump2);
heap_free(stringsW->pszUrlJump1); free(stringsW->pszUrlJump1);
heap_free(stringsW->pszUrlJump2); free(stringsW->pszUrlJump2);
} }
void wintype_stringsA_free(struct wintype_stringsA *stringsA) void wintype_stringsA_free(struct wintype_stringsA *stringsA)
{ {
heap_free(stringsA->pszType); free(stringsA->pszType);
heap_free(stringsA->pszCaption); free(stringsA->pszCaption);
heap_free(stringsA->pszToc); free(stringsA->pszToc);
heap_free(stringsA->pszIndex); free(stringsA->pszIndex);
heap_free(stringsA->pszFile); free(stringsA->pszFile);
heap_free(stringsA->pszHome); free(stringsA->pszHome);
heap_free(stringsA->pszJump1); free(stringsA->pszJump1);
heap_free(stringsA->pszJump2); free(stringsA->pszJump2);
heap_free(stringsA->pszUrlJump1); free(stringsA->pszUrlJump1);
heap_free(stringsA->pszUrlJump2); free(stringsA->pszUrlJump2);
heap_free(stringsA->pszCustomTabs); free(stringsA->pszCustomTabs);
} }
void ReleaseHelpViewer(HHInfo *info) void ReleaseHelpViewer(HHInfo *info)
...@@ -1812,7 +1812,7 @@ void ReleaseHelpViewer(HHInfo *info) ...@@ -1812,7 +1812,7 @@ void ReleaseHelpViewer(HHInfo *info)
if(info->WinType.hwndHelp) if(info->WinType.hwndHelp)
DestroyWindow(info->WinType.hwndHelp); DestroyWindow(info->WinType.hwndHelp);
heap_free(info); free(info);
OleUninitialize(); OleUninitialize();
} }
...@@ -1823,7 +1823,7 @@ HHInfo *CreateHelpViewer(HHInfo *info, LPCWSTR filename, HWND caller) ...@@ -1823,7 +1823,7 @@ HHInfo *CreateHelpViewer(HHInfo *info, LPCWSTR filename, HWND caller)
if(!info) if(!info)
{ {
info = heap_alloc_zero(sizeof(HHInfo)); info = calloc(1, sizeof(HHInfo));
list_add_tail(&window_list, &info->entry); list_add_tail(&window_list, &info->entry);
} }
...@@ -1894,7 +1894,7 @@ WCHAR *decode_html(const char *html_fragment, int html_fragment_len, UINT code_p ...@@ -1894,7 +1894,7 @@ WCHAR *decode_html(const char *html_fragment, int html_fragment_len, UINT code_p
int len, tmp_len = 0; int len, tmp_len = 0;
WCHAR *unicode_text; WCHAR *unicode_text;
tmp = heap_alloc(html_fragment_len+1); tmp = malloc(html_fragment_len + 1);
while(1) while(1)
{ {
symbol = 0; symbol = 0;
...@@ -1945,9 +1945,9 @@ WCHAR *decode_html(const char *html_fragment, int html_fragment_len, UINT code_p ...@@ -1945,9 +1945,9 @@ WCHAR *decode_html(const char *html_fragment, int html_fragment_len, UINT code_p
tmp[tmp_len++] = 0; /* NULL-terminate the string */ tmp[tmp_len++] = 0; /* NULL-terminate the string */
len = MultiByteToWideChar(code_page, 0, tmp, tmp_len, NULL, 0); len = MultiByteToWideChar(code_page, 0, tmp, tmp_len, NULL, 0);
unicode_text = heap_alloc(len*sizeof(WCHAR)); unicode_text = malloc(len * sizeof(WCHAR));
MultiByteToWideChar(code_page, 0, tmp, tmp_len, unicode_text, len); MultiByteToWideChar(code_page, 0, tmp, tmp_len, unicode_text, len);
heap_free(tmp); free(tmp);
return unicode_text; return unicode_text;
} }
......
...@@ -116,7 +116,7 @@ static BOOL resolve_filename(const WCHAR *env_filename, WCHAR *fullname, DWORD b ...@@ -116,7 +116,7 @@ static BOOL resolve_filename(const WCHAR *env_filename, WCHAR *fullname, DWORD b
if (!env_len) if (!env_len)
return 0; return 0;
filename = heap_alloc(env_len * sizeof(WCHAR)); filename = malloc(env_len * sizeof(WCHAR));
if (filename == NULL) if (filename == NULL)
return 0; return 0;
...@@ -127,7 +127,7 @@ static BOOL resolve_filename(const WCHAR *env_filename, WCHAR *fullname, DWORD b ...@@ -127,7 +127,7 @@ static BOOL resolve_filename(const WCHAR *env_filename, WCHAR *fullname, DWORD b
{ {
*extra = 0; *extra = 0;
if (window) if (window)
*window = strdupW(extra+1); *window = wcsdup(extra + 1);
} }
extra = wcsstr(filename, delimW); extra = wcsstr(filename, delimW);
...@@ -135,7 +135,7 @@ static BOOL resolve_filename(const WCHAR *env_filename, WCHAR *fullname, DWORD b ...@@ -135,7 +135,7 @@ static BOOL resolve_filename(const WCHAR *env_filename, WCHAR *fullname, DWORD b
{ {
*extra = 0; *extra = 0;
if (index) if (index)
*index = strdupW(extra+2); *index = wcsdup(extra + 2);
} }
GetFullPathNameW(filename, buflen, fullname, NULL); GetFullPathNameW(filename, buflen, fullname, NULL);
...@@ -146,7 +146,7 @@ static BOOL resolve_filename(const WCHAR *env_filename, WCHAR *fullname, DWORD b ...@@ -146,7 +146,7 @@ static BOOL resolve_filename(const WCHAR *env_filename, WCHAR *fullname, DWORD b
lstrcatW(fullname, filename); lstrcatW(fullname, filename);
} }
heap_free(filename); free(filename);
return (GetFileAttributesW(fullname) != INVALID_FILE_ATTRIBUTES); return (GetFileAttributesW(fullname) != INVALID_FILE_ATTRIBUTES);
} }
...@@ -192,8 +192,8 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat ...@@ -192,8 +192,8 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
info = CreateHelpViewer(info, fullname, caller); info = CreateHelpViewer(info, fullname, caller);
if(!info) if(!info)
{ {
heap_free(default_index); free(default_index);
heap_free(window); free(window);
return NULL; return NULL;
} }
...@@ -202,7 +202,7 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat ...@@ -202,7 +202,7 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
if(!info->WinType.pszType) if(!info->WinType.pszType)
info->WinType.pszType = info->stringsW.pszType = window; info->WinType.pszType = info->stringsW.pszType = window;
else else
heap_free(window); free(window);
/* called to load a specified topic */ /* called to load a specified topic */
switch(command) switch(command)
...@@ -228,7 +228,7 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat ...@@ -228,7 +228,7 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
} }
res = NavigateToChm(info, info->pCHMInfo->szFile, index); res = NavigateToChm(info, info->pCHMInfo->szFile, index);
heap_free(default_index); free(default_index);
if(!res) if(!res)
{ {
...@@ -281,14 +281,14 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat ...@@ -281,14 +281,14 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
info = CreateHelpViewer(info, fullname, caller); info = CreateHelpViewer(info, fullname, caller);
if(!info) if(!info)
{ {
heap_free(window); free(window);
return NULL; return NULL;
} }
if(!info->WinType.pszType) if(!info->WinType.pszType)
info->WinType.pszType = info->stringsW.pszType = window; info->WinType.pszType = info->stringsW.pszType = window;
else else
heap_free(window); free(window);
url = FindContextAlias(info->pCHMInfo, data); url = FindContextAlias(info->pCHMInfo, data);
if(!url) if(!url)
...@@ -300,7 +300,7 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat ...@@ -300,7 +300,7 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
} }
NavigateToUrl(info, url); NavigateToUrl(info, url);
heap_free(url); free(url);
return info->WinType.hwndHelp; return info->WinType.hwndHelp;
} }
case HH_PRETRANSLATEMESSAGE: { case HH_PRETRANSLATEMESSAGE: {
...@@ -329,7 +329,7 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat ...@@ -329,7 +329,7 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
HHInfo *info = NULL; HHInfo *info = NULL;
if (!filename && wintype->pszType) if (!filename && wintype->pszType)
window = strdupW(wintype->pszType); window = wcsdup(wintype->pszType);
else if (!filename || !resolve_filename(filename, fullname, MAX_PATH, NULL, &window) || !window) else if (!filename || !resolve_filename(filename, fullname, MAX_PATH, NULL, &window) || !window)
{ {
WARN("can't find window name: %s\n", debugstr_w(filename)); WARN("can't find window name: %s\n", debugstr_w(filename));
...@@ -338,12 +338,12 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat ...@@ -338,12 +338,12 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
info = find_window(window); info = find_window(window);
if (!info) if (!info)
{ {
info = heap_alloc_zero(sizeof(HHInfo)); info = calloc(1, sizeof(HHInfo));
info->WinType.pszType = info->stringsW.pszType = window; info->WinType.pszType = info->stringsW.pszType = window;
list_add_tail(&window_list, &info->entry); list_add_tail(&window_list, &info->entry);
} }
else else
heap_free(window); free(window);
TRACE("Changing WINTYPE, fsValidMembers=0x%lx\n", wintype->fsValidMembers); TRACE("Changing WINTYPE, fsValidMembers=0x%lx\n", wintype->fsValidMembers);
...@@ -365,13 +365,13 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat ...@@ -365,13 +365,13 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
if (!info) if (!info)
{ {
WARN("Could not find window named %s.\n", debugstr_w(window)); WARN("Could not find window named %s.\n", debugstr_w(window));
heap_free(window); free(window);
return (HWND)~0; return (HWND)~0;
} }
TRACE("Retrieving WINTYPE for %s.\n", debugstr_w(window)); TRACE("Retrieving WINTYPE for %s.\n", debugstr_w(window));
*wintype = info->WinType; *wintype = info->WinType;
heap_free(window); free(window);
return 0; return 0;
} }
default: default:
...@@ -468,7 +468,7 @@ HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD_PTR data ...@@ -468,7 +468,7 @@ HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD_PTR data
{ {
WCHAR *wdata = strdupAtoW( (const char *)data ); WCHAR *wdata = strdupAtoW( (const char *)data );
result = HtmlHelpW( caller, wfile, command, (DWORD_PTR)wdata ); result = HtmlHelpW( caller, wfile, command, (DWORD_PTR)wdata );
heap_free(wdata); free(wdata);
goto done; goto done;
} }
...@@ -490,7 +490,7 @@ HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD_PTR data ...@@ -490,7 +490,7 @@ HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD_PTR data
result = HtmlHelpW( caller, wfile, command, data ); result = HtmlHelpW( caller, wfile, command, data );
done: done:
heap_free(wfile); free(wfile);
return result; return result;
} }
...@@ -553,7 +553,7 @@ int WINAPI doWinMain(HINSTANCE hInstance, LPSTR szCmdLine) ...@@ -553,7 +553,7 @@ int WINAPI doWinMain(HINSTANCE hInstance, LPSTR szCmdLine)
return 0; return 0;
buflen = MultiByteToWideChar(CP_ACP, 0, szCmdLine, len, NULL, 0) + 1; buflen = MultiByteToWideChar(CP_ACP, 0, szCmdLine, len, NULL, 0) + 1;
filename = heap_alloc(buflen * sizeof(WCHAR)); filename = malloc(buflen * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, szCmdLine, len, filename, buflen); MultiByteToWideChar(CP_ACP, 0, szCmdLine, len, filename, buflen);
filename[buflen-1] = 0; filename[buflen-1] = 0;
...@@ -563,7 +563,7 @@ int WINAPI doWinMain(HINSTANCE hInstance, LPSTR szCmdLine) ...@@ -563,7 +563,7 @@ int WINAPI doWinMain(HINSTANCE hInstance, LPSTR szCmdLine)
else else
hwnd = HtmlHelpW(GetDesktopWindow(), filename, HH_DISPLAY_TOPIC, 0); hwnd = HtmlHelpW(GetDesktopWindow(), filename, HH_DISPLAY_TOPIC, 0);
heap_free(filename); free(filename);
if (!hwnd) if (!hwnd)
{ {
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
#endif #endif
#include "wine/itss.h" #include "wine/itss.h"
#include "wine/heap.h"
#include "wine/list.h" #include "wine/list.h"
#define WB_GOBACK 0 #define WB_GOBACK 0
...@@ -245,26 +244,6 @@ HHInfo *find_window(const WCHAR *window) DECLSPEC_HIDDEN; ...@@ -245,26 +244,6 @@ HHInfo *find_window(const WCHAR *window) DECLSPEC_HIDDEN;
/* memory allocation functions */ /* memory allocation functions */
static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
{
return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
}
static inline LPWSTR strdupW(LPCWSTR str)
{
LPWSTR ret;
int size;
if(!str)
return NULL;
size = (lstrlenW(str)+1)*sizeof(WCHAR);
ret = heap_alloc(size);
memcpy(ret, str, size);
return ret;
}
static inline LPWSTR strdupnAtoW(LPCSTR str, LONG lenA) static inline LPWSTR strdupnAtoW(LPCSTR str, LONG lenA)
{ {
LPWSTR ret; LPWSTR ret;
...@@ -281,7 +260,7 @@ static inline LPWSTR strdupnAtoW(LPCSTR str, LONG lenA) ...@@ -281,7 +260,7 @@ static inline LPWSTR strdupnAtoW(LPCSTR str, LONG lenA)
} }
len = MultiByteToWideChar(CP_ACP, 0, str, lenA, NULL, 0)+1; /* +1 for null pad */ len = MultiByteToWideChar(CP_ACP, 0, str, lenA, NULL, 0)+1; /* +1 for null pad */
ret = heap_alloc(len*sizeof(WCHAR)); ret = malloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, str, lenA, ret, len); MultiByteToWideChar(CP_ACP, 0, str, lenA, ret, len);
ret[len-1] = 0; ret[len-1] = 0;
...@@ -302,7 +281,7 @@ static inline LPSTR strdupWtoA(LPCWSTR str) ...@@ -302,7 +281,7 @@ static inline LPSTR strdupWtoA(LPCWSTR str)
return NULL; return NULL;
len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL); len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
ret = heap_alloc(len); ret = malloc(len);
WideCharToMultiByte(CP_ACP, 0, str, -1, ret, len, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, str, -1, ret, len, NULL, NULL);
return ret; return ret;
} }
......
...@@ -54,7 +54,7 @@ static void fill_index_tree(HWND hwnd, IndexItem *item) ...@@ -54,7 +54,7 @@ static void fill_index_tree(HWND hwnd, IndexItem *item)
static void item_realloc(IndexItem *item, int num_items) static void item_realloc(IndexItem *item, int num_items)
{ {
item->nItems = num_items; item->nItems = num_items;
item->items = heap_realloc(item->items, sizeof(IndexSubItem)*item->nItems); item->items = realloc(item->items, sizeof(IndexSubItem) * item->nItems);
item->items[item->nItems-1].name = NULL; item->items[item->nItems-1].name = NULL;
item->items[item->nItems-1].local = NULL; item->items[item->nItems-1].local = NULL;
item->itemFlags = 0x00; item->itemFlags = 0x00;
...@@ -127,9 +127,9 @@ static IndexItem *parse_index_sitemap_object(HHInfo *info, stream_t *stream) ...@@ -127,9 +127,9 @@ static IndexItem *parse_index_sitemap_object(HHInfo *info, stream_t *stream)
strbuf_init(&node); strbuf_init(&node);
strbuf_init(&node_name); strbuf_init(&node_name);
item = heap_alloc_zero(sizeof(IndexItem)); item = calloc(1, sizeof(IndexItem));
item->nItems = 0; item->nItems = 0;
item->items = heap_alloc_zero(0); item->items = calloc(2, sizeof(void *));
item->itemFlags = 0x11; item->itemFlags = 0x11;
while(next_node(stream, &node)) { while(next_node(stream, &node)) {
...@@ -237,9 +237,9 @@ static void parse_hhindex(HHInfo *info, IStream *str, IndexItem *item) ...@@ -237,9 +237,9 @@ static void parse_hhindex(HHInfo *info, IStream *str, IndexItem *item)
item_realloc(item, num_items+1); item_realloc(item, num_items+1);
memcpy(&item->items[num_items], &new_item->items[0], sizeof(IndexSubItem)); memcpy(&item->items[num_items], &new_item->items[0], sizeof(IndexSubItem));
heap_free(new_item->keyword); free(new_item->keyword);
heap_free(new_item->items); free(new_item->items);
heap_free(new_item); free(new_item);
} else if(new_item) { } else if(new_item) {
item->next = new_item; item->next = new_item;
item->next->merge = item->merge; item->next->merge = item->merge;
...@@ -266,7 +266,7 @@ void InitIndex(HHInfo *info) ...@@ -266,7 +266,7 @@ void InitIndex(HHInfo *info)
{ {
IStream *stream; IStream *stream;
info->index = heap_alloc_zero(sizeof(IndexItem)); info->index = calloc(1, sizeof(IndexItem));
info->index->nItems = 0; info->index->nItems = 0;
SetChmPath(&info->index->merge, info->pCHMInfo->szFile, info->WinType.pszIndex); SetChmPath(&info->index->merge, info->pCHMInfo->szFile, info->WinType.pszIndex);
...@@ -292,17 +292,17 @@ void ReleaseIndex(HHInfo *info) ...@@ -292,17 +292,17 @@ void ReleaseIndex(HHInfo *info)
if(!item) return; if(!item) return;
/* Note: item->merge is identical for all items, only free once */ /* Note: item->merge is identical for all items, only free once */
heap_free(item->merge.chm_file); free(item->merge.chm_file);
heap_free(item->merge.chm_index); free(item->merge.chm_index);
while(item) { while(item) {
next = item->next; next = item->next;
heap_free(item->keyword); free(item->keyword);
for(i=0;i<item->nItems;i++) { for(i=0;i<item->nItems;i++) {
heap_free(item->items[i].name); free(item->items[i].name);
heap_free(item->items[i].local); free(item->items[i].local);
} }
heap_free(item->items); free(item->items);
item = next; item = next;
} }
......
...@@ -32,10 +32,10 @@ static SearchItem *alloc_search_item(WCHAR *title, const WCHAR *filename) ...@@ -32,10 +32,10 @@ static SearchItem *alloc_search_item(WCHAR *title, const WCHAR *filename)
int filename_len = filename ? (lstrlenW(filename)+1)*sizeof(WCHAR) : 0; int filename_len = filename ? (lstrlenW(filename)+1)*sizeof(WCHAR) : 0;
SearchItem *item; SearchItem *item;
item = heap_alloc_zero(sizeof(SearchItem)); item = calloc(1, sizeof(SearchItem));
if(filename) if(filename)
{ {
item->filename = heap_alloc(filename_len); item->filename = malloc(filename_len);
memcpy(item->filename, filename, filename_len); memcpy(item->filename, filename, filename_len);
} }
item->title = title; /* Already allocated */ item->title = title; /* Already allocated */
...@@ -72,7 +72,7 @@ static void fill_search_tree(HWND hwndList, SearchItem *item) ...@@ -72,7 +72,7 @@ static void fill_search_tree(HWND hwndList, SearchItem *item)
*/ */
static WCHAR *SearchCHM_File(IStorage *pStorage, const WCHAR *file, const char *needle) static WCHAR *SearchCHM_File(IStorage *pStorage, const WCHAR *file, const char *needle)
{ {
char *buffer = heap_alloc(BLOCK_SIZE); char *buffer = malloc(BLOCK_SIZE);
strbuf_t content, node, node_name; strbuf_t content, node, node_name;
IStream *temp_stream = NULL; IStream *temp_stream = NULL;
DWORD i, buffer_size = 0; DWORD i, buffer_size = 0;
...@@ -105,12 +105,12 @@ static WCHAR *SearchCHM_File(IStorage *pStorage, const WCHAR *file, const char * ...@@ -105,12 +105,12 @@ static WCHAR *SearchCHM_File(IStorage *pStorage, const WCHAR *file, const char *
if(!stricmp(node_name.buf, "title")) if(!stricmp(node_name.buf, "title"))
{ {
int wlen = MultiByteToWideChar(CP_ACP, 0, text, textlen, NULL, 0); int wlen = MultiByteToWideChar(CP_ACP, 0, text, textlen, NULL, 0);
title = heap_alloc((wlen+1)*sizeof(WCHAR)); title = malloc((wlen + 1) * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, text, textlen, title, wlen); MultiByteToWideChar(CP_ACP, 0, text, textlen, title, wlen);
title[wlen] = 0; title[wlen] = 0;
} }
buffer = heap_realloc(buffer, buffer_size + textlen + 1); buffer = realloc(buffer, buffer_size + textlen + 1);
memcpy(&buffer[buffer_size], text, textlen); memcpy(&buffer[buffer_size], text, textlen);
buffer[buffer_size + textlen] = '\0'; buffer[buffer_size + textlen] = '\0';
buffer_size += textlen; buffer_size += textlen;
...@@ -135,12 +135,12 @@ static WCHAR *SearchCHM_File(IStorage *pStorage, const WCHAR *file, const char * ...@@ -135,12 +135,12 @@ static WCHAR *SearchCHM_File(IStorage *pStorage, const WCHAR *file, const char *
strbuf_free(&node_name); strbuf_free(&node_name);
cleanup: cleanup:
heap_free(buffer); free(buffer);
if(temp_stream) if(temp_stream)
IStream_Release(temp_stream); IStream_Release(temp_stream);
if(!found) if(!found)
{ {
heap_free(title); free(title);
return NULL; return NULL;
} }
return title; return title;
...@@ -238,7 +238,7 @@ void ReleaseSearch(HHInfo *info) ...@@ -238,7 +238,7 @@ void ReleaseSearch(HHInfo *info)
info->search.root = NULL; info->search.root = NULL;
while(item) { while(item) {
heap_free(item->filename); free(item->filename);
item = item->next; item = item->next;
} }
} }
...@@ -27,7 +27,7 @@ void strbuf_init(strbuf_t *buf) ...@@ -27,7 +27,7 @@ void strbuf_init(strbuf_t *buf)
{ {
buf->size = 8; buf->size = 8;
buf->len = 0; buf->len = 0;
buf->buf = heap_alloc(buf->size); buf->buf = malloc(buf->size);
} }
void strbuf_zero(strbuf_t *buf) void strbuf_zero(strbuf_t *buf)
...@@ -37,14 +37,14 @@ void strbuf_zero(strbuf_t *buf) ...@@ -37,14 +37,14 @@ void strbuf_zero(strbuf_t *buf)
void strbuf_free(strbuf_t *buf) void strbuf_free(strbuf_t *buf)
{ {
heap_free(buf->buf); free(buf->buf);
} }
static void strbuf_append(strbuf_t *buf, const char *data, int len) static void strbuf_append(strbuf_t *buf, const char *data, int len)
{ {
if(buf->len+len > buf->size) { if(buf->len+len > buf->size) {
buf->size = buf->len+len; buf->size = buf->len+len;
buf->buf = heap_realloc(buf->buf, buf->size); buf->buf = realloc(buf->buf, buf->size);
} }
memcpy(buf->buf+buf->len, data, len); memcpy(buf->buf+buf->len, data, len);
...@@ -169,7 +169,7 @@ const char *get_attr(const char *node, const char *name, int *len) ...@@ -169,7 +169,7 @@ const char *get_attr(const char *node, const char *name, int *len)
/* Create a lower case copy of the node */ /* Create a lower case copy of the node */
node_len = strlen(node)+1; node_len = strlen(node)+1;
node_buf = heap_alloc(node_len*sizeof(char)); node_buf = malloc(node_len * sizeof(char));
if(!node_buf) if(!node_buf)
return NULL; return NULL;
memcpy(node_buf, node, node_len); memcpy(node_buf, node, node_len);
...@@ -187,7 +187,7 @@ const char *get_attr(const char *node, const char *name, int *len) ...@@ -187,7 +187,7 @@ const char *get_attr(const char *node, const char *name, int *len)
ptr = strstr(node_buf, name_buf); ptr = strstr(node_buf, name_buf);
if(!ptr) { if(!ptr) {
WARN("name not found\n"); WARN("name not found\n");
heap_free(node_buf); free(node_buf);
return NULL; return NULL;
} }
...@@ -195,7 +195,7 @@ const char *get_attr(const char *node, const char *name, int *len) ...@@ -195,7 +195,7 @@ const char *get_attr(const char *node, const char *name, int *len)
ptr2 = strchr(ptr, '\"'); ptr2 = strchr(ptr, '\"');
if(!ptr2) if(!ptr2)
{ {
heap_free(node_buf); free(node_buf);
return NULL; return NULL;
} }
...@@ -203,6 +203,6 @@ const char *get_attr(const char *node, const char *name, int *len) ...@@ -203,6 +203,6 @@ const char *get_attr(const char *node, const char *name, int *len)
/* Return the pointer offset within the original string */ /* Return the pointer offset within the original string */
ptr = node+(ptr-node_buf); ptr = node+(ptr-node_buf);
heap_free(node_buf); free(node_buf);
return ptr; return ptr;
} }
...@@ -81,7 +81,7 @@ static ULONG STDMETHODCALLTYPE Site_Release(IOleClientSite *iface) ...@@ -81,7 +81,7 @@ static ULONG STDMETHODCALLTYPE Site_Release(IOleClientSite *iface)
IOleObject_Release(This->ole_obj); IOleObject_Release(This->ole_obj);
if(This->web_browser) if(This->web_browser)
IWebBrowser2_Release(This->web_browser); IWebBrowser2_Release(This->web_browser);
heap_free(This); free(This);
} }
return ref; return ref;
...@@ -674,7 +674,7 @@ BOOL InitWebBrowser(HHInfo *info, HWND hwndParent) ...@@ -674,7 +674,7 @@ BOOL InitWebBrowser(HHInfo *info, HWND hwndParent)
HRESULT hr; HRESULT hr;
RECT rc; RECT rc;
container = heap_alloc_zero(sizeof(*container)); container = calloc(1, sizeof(*container));
if (!container) if (!container)
return FALSE; return FALSE;
......
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