Erich Hoover : hhctrl.ocx: Create a special structure for holding non-const unicode strings.
Alexandre Julliard
julliard at winehq.org
Thu Aug 30 14:34:34 CDT 2012
Module: wine
Branch: master
Commit: d39801bef35232e37f61f6d59e9aa046c42c3efc
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d39801bef35232e37f61f6d59e9aa046c42c3efc
Author: Erich Hoover <ehoover at mines.edu>
Date: Wed Aug 29 19:45:27 2012 -0600
hhctrl.ocx: Create a special structure for holding non-const unicode strings.
---
dlls/hhctrl.ocx/chm.c | 26 +++++++++++++-------------
dlls/hhctrl.ocx/help.c | 28 ++++++++++++++++------------
dlls/hhctrl.ocx/hhctrl.c | 4 ++--
dlls/hhctrl.ocx/hhctrl.h | 28 ++++++++++++++++------------
4 files changed, 47 insertions(+), 39 deletions(-)
diff --git a/dlls/hhctrl.ocx/chm.c b/dlls/hhctrl.ocx/chm.c
index 6c2904d..4b2f36e 100644
--- a/dlls/hhctrl.ocx/chm.c
+++ b/dlls/hhctrl.ocx/chm.c
@@ -283,16 +283,16 @@ void MergeChmProperties(HH_WINTYPEW *src, HHInfo *info)
* modified by the user. rcHTML and rcMinSize are not currently supported, so don't bother to copy them.
*/
- dst->pszType = MergeChmString(src->pszType, &info->pszType);
- dst->pszFile = MergeChmString(src->pszFile, &info->pszFile);
- dst->pszToc = MergeChmString(src->pszToc, &info->pszToc);
- dst->pszIndex = MergeChmString(src->pszIndex, &info->pszIndex);
- dst->pszCaption = MergeChmString(src->pszCaption, &info->pszCaption);
- dst->pszHome = MergeChmString(src->pszHome, &info->pszHome);
- dst->pszJump1 = MergeChmString(src->pszJump1, &info->pszJump1);
- dst->pszJump2 = MergeChmString(src->pszJump2, &info->pszJump2);
- dst->pszUrlJump1 = MergeChmString(src->pszUrlJump1, &info->pszUrlJump1);
- dst->pszUrlJump2 = MergeChmString(src->pszUrlJump2, &info->pszUrlJump2);
+ dst->pszType = MergeChmString(src->pszType, &info->stringsW.pszType);
+ dst->pszFile = MergeChmString(src->pszFile, &info->stringsW.pszFile);
+ dst->pszToc = MergeChmString(src->pszToc, &info->stringsW.pszToc);
+ dst->pszIndex = MergeChmString(src->pszIndex, &info->stringsW.pszIndex);
+ dst->pszCaption = MergeChmString(src->pszCaption, &info->stringsW.pszCaption);
+ dst->pszHome = MergeChmString(src->pszHome, &info->stringsW.pszHome);
+ dst->pszJump1 = MergeChmString(src->pszJump1, &info->stringsW.pszJump1);
+ dst->pszJump2 = MergeChmString(src->pszJump2, &info->stringsW.pszJump2);
+ dst->pszUrlJump1 = MergeChmString(src->pszUrlJump1, &info->stringsW.pszUrlJump1);
+ dst->pszUrlJump2 = MergeChmString(src->pszUrlJump2, &info->stringsW.pszUrlJump2);
/* FIXME: pszCustomTabs is a list of multiple zero-terminated strings so ReadString won't
* work in this case
@@ -381,11 +381,11 @@ BOOL LoadWinTypeFromCHM(HHInfo *info)
/* merge the new data with any pre-existing HH_WINTYPE structure */
MergeChmProperties(&wintype, info);
if (!info->WinType.pszFile)
- info->WinType.pszFile = info->pszFile = strdupW(info->pCHMInfo->defTopic ? info->pCHMInfo->defTopic : null);
+ info->WinType.pszFile = info->stringsW.pszFile = strdupW(info->pCHMInfo->defTopic ? info->pCHMInfo->defTopic : null);
if (!info->WinType.pszToc)
- info->WinType.pszToc = info->pszToc = FindHTMLHelpSetting(info, toc_extW);
+ info->WinType.pszToc = info->stringsW.pszToc = FindHTMLHelpSetting(info, toc_extW);
if (!info->WinType.pszIndex)
- info->WinType.pszIndex = info->pszIndex = FindHTMLHelpSetting(info, index_extW);
+ info->WinType.pszIndex = info->stringsW.pszIndex = FindHTMLHelpSetting(info, index_extW);
heap_free(pszType);
heap_free(pszFile);
diff --git a/dlls/hhctrl.ocx/help.c b/dlls/hhctrl.ocx/help.c
index ed5528c..29751ea 100644
--- a/dlls/hhctrl.ocx/help.c
+++ b/dlls/hhctrl.ocx/help.c
@@ -278,7 +278,7 @@ static void DoSync(HHInfo *info)
}
/* If we're not currently viewing a page in the active .chm file, abort */
- if ((!AppendFullPathURL(info->pszFile, buf, NULL)) || (len = lstrlenW(buf) > lstrlenW(url)))
+ if ((!AppendFullPathURL(info->WinType.pszFile, buf, NULL)) || (len = lstrlenW(buf) > lstrlenW(url)))
{
SysFreeString(url);
return;
@@ -1742,6 +1742,20 @@ static BOOL CreateViewer(HHInfo *pHHInfo)
return TRUE;
}
+void wintype_stringsW_free(struct wintype_stringsW *stringsW)
+{
+ heap_free(stringsW->pszType);
+ heap_free(stringsW->pszCaption);
+ heap_free(stringsW->pszToc);
+ heap_free(stringsW->pszIndex);
+ heap_free(stringsW->pszFile);
+ heap_free(stringsW->pszHome);
+ heap_free(stringsW->pszJump1);
+ heap_free(stringsW->pszJump2);
+ heap_free(stringsW->pszUrlJump1);
+ heap_free(stringsW->pszUrlJump2);
+}
+
void ReleaseHelpViewer(HHInfo *info)
{
TRACE("(%p)\n", info);
@@ -1751,17 +1765,7 @@ void ReleaseHelpViewer(HHInfo *info)
list_remove(&info->entry);
- /* Free allocated strings */
- heap_free(info->pszType);
- heap_free(info->pszCaption);
- heap_free(info->pszToc);
- heap_free(info->pszIndex);
- heap_free(info->pszFile);
- heap_free(info->pszHome);
- heap_free(info->pszJump1);
- heap_free(info->pszJump2);
- heap_free(info->pszUrlJump1);
- heap_free(info->pszUrlJump2);
+ wintype_stringsW_free(&info->stringsW);
if (info->pCHMInfo)
CloseCHM(info->pCHMInfo);
diff --git a/dlls/hhctrl.ocx/hhctrl.c b/dlls/hhctrl.ocx/hhctrl.c
index bda435a..5244e10 100644
--- a/dlls/hhctrl.ocx/hhctrl.c
+++ b/dlls/hhctrl.ocx/hhctrl.c
@@ -191,8 +191,8 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
if(!index)
index = info->WinType.pszFile;
- if(!info->pszType)
- info->WinType.pszType = info->pszType = window;
+ if(!info->WinType.pszType)
+ info->WinType.pszType = info->stringsW.pszType = window;
else
heap_free(window);
diff --git a/dlls/hhctrl.ocx/hhctrl.h b/dlls/hhctrl.ocx/hhctrl.h
index 4009f8f..4cacbb3 100644
--- a/dlls/hhctrl.ocx/hhctrl.h
+++ b/dlls/hhctrl.ocx/hhctrl.h
@@ -140,6 +140,20 @@ typedef struct {
HIMAGELIST hImageList;
} ContentsTab;
+struct wintype_stringsW {
+ WCHAR *pszType;
+ WCHAR *pszCaption;
+ WCHAR *pszToc;
+ WCHAR *pszIndex;
+ WCHAR *pszFile;
+ WCHAR *pszHome;
+ WCHAR *pszJump1;
+ WCHAR *pszJump2;
+ WCHAR *pszUrlJump1;
+ WCHAR *pszUrlJump2;
+ WCHAR *pszCustomTabs;
+};
+
typedef struct {
IOleClientSite *client_site;
IWebBrowser2 *web_browser;
@@ -147,17 +161,7 @@ typedef struct {
HH_WINTYPEW WinType;
- LPWSTR pszType;
- LPWSTR pszCaption;
- LPWSTR pszToc;
- LPWSTR pszIndex;
- LPWSTR pszFile;
- LPWSTR pszHome;
- LPWSTR pszJump1;
- LPWSTR pszJump2;
- LPWSTR pszUrlJump1;
- LPWSTR pszUrlJump2;
- LPWSTR pszCustomTabs;
+ struct wintype_stringsW stringsW;
struct list entry;
CHMInfo *pCHMInfo;
@@ -204,7 +208,7 @@ void InitSearch(HHInfo *info, const char *needle) DECLSPEC_HIDDEN;
void ReleaseSearch(HHInfo *info) DECLSPEC_HIDDEN;
LPCWSTR skip_schema(LPCWSTR url) DECLSPEC_HIDDEN;
-
+void wintype_stringsW_free(struct wintype_stringsW *stringsW) DECLSPEC_HIDDEN;
WCHAR *decode_html(const char *html_fragment, int html_fragment_len, UINT code_page);
/* memory allocation functions */
More information about the wine-cvs
mailing list