Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
38f72da6
Commit
38f72da6
authored
Jan 19, 2018
by
Huw Davies
Committed by
Alexandre Julliard
Jan 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hhctrl: Use a helper to free the wintype structure.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
afb9de28
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
31 deletions
+36
-31
chm.c
dlls/hhctrl.ocx/chm.c
+36
-31
No files found.
dlls/hhctrl.ocx/chm.c
View file @
38f72da6
...
...
@@ -308,15 +308,31 @@ void MergeChmProperties(HH_WINTYPEW *src, HHInfo *info, BOOL override)
#endif
}
static
inline
WCHAR
*
ConvertChmString
(
HHInfo
*
info
,
const
WCHAR
**
str
)
static
inline
WCHAR
*
ConvertChmString
(
HHInfo
*
info
,
DWORD
id
)
{
WCHAR
*
ret
=
NULL
;
if
(
*
str
)
*
str
=
ret
=
strdupAtoW
(
GetChmString
(
info
->
pCHMInfo
,
(
DWORD_PTR
)
*
str
));
if
(
id
)
ret
=
strdupAtoW
(
GetChmString
(
info
->
pCHMInfo
,
id
));
return
ret
;
}
static
inline
void
wintype_free
(
HH_WINTYPEW
*
wintype
)
{
heap_free
((
void
*
)
wintype
->
pszType
);
heap_free
((
void
*
)
wintype
->
pszCaption
);
heap_free
(
wintype
->
paInfoTypes
);
heap_free
((
void
*
)
wintype
->
pszToc
);
heap_free
((
void
*
)
wintype
->
pszIndex
);
heap_free
((
void
*
)
wintype
->
pszFile
);
heap_free
((
void
*
)
wintype
->
pszHome
);
heap_free
((
void
*
)
wintype
->
pszJump1
);
heap_free
((
void
*
)
wintype
->
pszJump2
);
heap_free
((
void
*
)
wintype
->
pszUrlJump1
);
heap_free
((
void
*
)
wintype
->
pszUrlJump2
);
heap_free
((
void
*
)
wintype
->
pszCustomTabs
);
}
/* Loads the HH_WINTYPE data from the CHM file
*
* FIXME: There may be more than one window type in the file, so
...
...
@@ -325,8 +341,6 @@ static inline WCHAR *ConvertChmString(HHInfo *info, const WCHAR **str)
BOOL
LoadWinTypeFromCHM
(
HHInfo
*
info
)
{
LARGE_INTEGER
liOffset
;
WCHAR
*
pszType
=
NULL
,
*
pszFile
=
NULL
,
*
pszToc
=
NULL
,
*
pszIndex
=
NULL
,
*
pszCaption
=
NULL
;
WCHAR
*
pszHome
=
NULL
,
*
pszJump1
=
NULL
,
*
pszJump2
=
NULL
,
*
pszUrlJump1
=
NULL
,
*
pszUrlJump2
=
NULL
;
IStorage
*
pStorage
=
info
->
pCHMInfo
->
pStorage
;
IStream
*
pStream
=
NULL
;
HH_WINTYPEW
wintype
;
...
...
@@ -334,7 +348,7 @@ BOOL LoadWinTypeFromCHM(HHInfo *info)
DWORD
cbRead
;
BOOL
ret
=
FALSE
;
static
const
WCHAR
null
[]
=
{
0
};
static
const
WCHAR
empty
[]
=
{
0
};
static
const
WCHAR
toc_extW
[]
=
{
'h'
,
'h'
,
'c'
,
0
};
static
const
WCHAR
index_extW
[]
=
{
'h'
,
'h'
,
'k'
,
0
};
static
const
WCHAR
windowsW
[]
=
{
'#'
,
'W'
,
'I'
,
'N'
,
'D'
,
'O'
,
'W'
,
'S'
,
0
};
...
...
@@ -353,16 +367,16 @@ BOOL LoadWinTypeFromCHM(HHInfo *info)
if
(
FAILED
(
hr
))
goto
done
;
/* convert the #STRINGS offsets to actual strings */
pszType
=
ConvertChmString
(
info
,
&
wintype
.
pszType
);
pszFile
=
ConvertChmString
(
info
,
&
wintype
.
pszFile
);
pszToc
=
ConvertChmString
(
info
,
&
wintype
.
pszToc
);
pszIndex
=
ConvertChmString
(
info
,
&
wintype
.
pszIndex
);
pszCaption
=
ConvertChmString
(
info
,
&
wintype
.
pszCaption
);
pszHome
=
ConvertChmString
(
info
,
&
wintype
.
pszHome
);
pszJump1
=
ConvertChmString
(
info
,
&
wintype
.
pszJump1
);
pszJump2
=
ConvertChmString
(
info
,
&
wintype
.
pszJump2
);
pszUrlJump1
=
ConvertChmString
(
info
,
&
wintype
.
pszUrlJump1
);
pszUrlJump2
=
ConvertChmString
(
info
,
&
wintype
.
pszUrlJump2
);
wintype
.
pszType
=
ConvertChmString
(
info
,
(
DWORD
)
wintype
.
pszType
);
wintype
.
pszFile
=
ConvertChmString
(
info
,
(
DWORD
)
wintype
.
pszFile
);
wintype
.
pszToc
=
ConvertChmString
(
info
,
(
DWORD
)
wintype
.
pszToc
);
wintype
.
pszIndex
=
ConvertChmString
(
info
,
(
DWORD
)
wintype
.
pszIndex
);
wintype
.
pszCaption
=
ConvertChmString
(
info
,
(
DWORD
)
wintype
.
pszCaption
);
wintype
.
pszHome
=
ConvertChmString
(
info
,
(
DWORD
)
wintype
.
pszHome
);
wintype
.
pszJump1
=
ConvertChmString
(
info
,
(
DWORD
)
wintype
.
pszJump1
);
wintype
.
pszJump2
=
ConvertChmString
(
info
,
(
DWORD
)
wintype
.
pszJump2
);
wintype
.
pszUrlJump1
=
ConvertChmString
(
info
,
(
DWORD
)
wintype
.
pszUrlJump1
);
wintype
.
pszUrlJump2
=
ConvertChmString
(
info
,
(
DWORD
)
wintype
.
pszUrlJump2
);
}
else
{
...
...
@@ -371,9 +385,9 @@ BOOL LoadWinTypeFromCHM(HHInfo *info)
memset
(
&
wintype
,
0
,
sizeof
(
wintype
));
wintype
.
cbStruct
=
sizeof
(
wintype
);
wintype
.
fUniCodeStrings
=
TRUE
;
wintype
.
pszType
=
pszType
=
strdupW
(
info
->
pCHMInfo
->
defWindow
?
info
->
pCHMInfo
->
defWindow
:
defaultwinW
);
wintype
.
pszToc
=
pszToc
=
strdupW
(
info
->
pCHMInfo
->
defToc
?
info
->
pCHMInfo
->
defToc
:
null
);
wintype
.
pszIndex
=
pszIndex
=
strdupW
(
null
);
wintype
.
pszType
=
strdupW
(
info
->
pCHMInfo
->
defWindow
?
info
->
pCHMInfo
->
defWindow
:
defaultwinW
);
wintype
.
pszToc
=
strdupW
(
info
->
pCHMInfo
->
defToc
?
info
->
pCHMInfo
->
defToc
:
empty
);
wintype
.
pszIndex
=
strdupW
(
empty
);
wintype
.
fsValidMembers
=
0
;
wintype
.
fsWinProperties
=
HHWIN_PROP_TRI_PANE
;
wintype
.
dwStyles
=
WS_POPUP
;
...
...
@@ -385,24 +399,15 @@ BOOL LoadWinTypeFromCHM(HHInfo *info)
/* merge the new data with any pre-existing HH_WINTYPE structure */
MergeChmProperties
(
&
wintype
,
info
,
FALSE
);
if
(
!
info
->
WinType
.
pszCaption
)
info
->
WinType
.
pszCaption
=
info
->
stringsW
.
pszCaption
=
strdupW
(
info
->
pCHMInfo
->
defTitle
?
info
->
pCHMInfo
->
defTitle
:
null
);
info
->
WinType
.
pszCaption
=
info
->
stringsW
.
pszCaption
=
strdupW
(
info
->
pCHMInfo
->
defTitle
?
info
->
pCHMInfo
->
defTitle
:
empty
);
if
(
!
info
->
WinType
.
pszFile
)
info
->
WinType
.
pszFile
=
info
->
stringsW
.
pszFile
=
strdupW
(
info
->
pCHMInfo
->
defTopic
?
info
->
pCHMInfo
->
defTopic
:
null
);
info
->
WinType
.
pszFile
=
info
->
stringsW
.
pszFile
=
strdupW
(
info
->
pCHMInfo
->
defTopic
?
info
->
pCHMInfo
->
defTopic
:
empty
);
if
(
!
info
->
WinType
.
pszToc
)
info
->
WinType
.
pszToc
=
info
->
stringsW
.
pszToc
=
FindHTMLHelpSetting
(
info
,
toc_extW
);
if
(
!
info
->
WinType
.
pszIndex
)
info
->
WinType
.
pszIndex
=
info
->
stringsW
.
pszIndex
=
FindHTMLHelpSetting
(
info
,
index_extW
);
heap_free
(
pszType
);
heap_free
(
pszFile
);
heap_free
(
pszToc
);
heap_free
(
pszIndex
);
heap_free
(
pszCaption
);
heap_free
(
pszHome
);
heap_free
(
pszJump1
);
heap_free
(
pszJump2
);
heap_free
(
pszUrlJump1
);
heap_free
(
pszUrlJump2
);
wintype_free
(
&
wintype
);
ret
=
TRUE
;
done:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment