Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
3681a59c
Commit
3681a59c
authored
Jun 07, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 08, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Improve error handling in SetFont (Coverity).
parent
26883637
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
33 deletions
+34
-33
richole.c
dlls/riched20/richole.c
+34
-33
No files found.
dlls/riched20/richole.c
View file @
3681a59c
...
@@ -523,12 +523,13 @@ static inline const IRichEditOleImpl *get_range_reole(ITextRange *range)
...
@@ -523,12 +523,13 @@ static inline const IRichEditOleImpl *get_range_reole(ITextRange *range)
static
void
textrange_set_font
(
ITextRange
*
range
,
ITextFont
*
font
)
static
void
textrange_set_font
(
ITextRange
*
range
,
ITextFont
*
font
)
{
{
CHARFORMAT2W
fmt
;
CHARFORMAT2W
fmt
;
HRESULT
hr
;
LONG
value
;
LONG
value
;
BSTR
str
;
BSTR
str
;
FLOAT
f
;
FLOAT
f
;
#define CHARFORMAT_SET_B_FIELD(mask, value) \
#define CHARFORMAT_SET_B_FIELD(mask, value) \
if (value != tomUndefined) { \
if (
hr == S_OK &&
value != tomUndefined) { \
fmt.dwMask |= CFM_##mask; \
fmt.dwMask |= CFM_##mask; \
if (value == tomTrue) fmt.dwEffects |= CFE_##mask; \
if (value == tomTrue) fmt.dwEffects |= CFE_##mask; \
} \
} \
...
@@ -538,73 +539,73 @@ static void textrange_set_font(ITextRange *range, ITextFont *font)
...
@@ -538,73 +539,73 @@ static void textrange_set_font(ITextRange *range, ITextFont *font)
fmt
.
cbSize
=
sizeof
(
fmt
);
fmt
.
cbSize
=
sizeof
(
fmt
);
value
=
tomUndefined
;
value
=
tomUndefined
;
ITextFont_GetAllCaps
(
font
,
&
value
);
hr
=
ITextFont_GetAllCaps
(
font
,
&
value
);
CHARFORMAT_SET_B_FIELD
(
ALLCAPS
,
value
);
CHARFORMAT_SET_B_FIELD
(
ALLCAPS
,
value
);
value
=
tomUndefined
;
value
=
tomUndefined
;
ITextFont_GetBold
(
font
,
&
value
);
hr
=
ITextFont_GetBold
(
font
,
&
value
);
CHARFORMAT_SET_B_FIELD
(
BOLD
,
value
);
CHARFORMAT_SET_B_FIELD
(
BOLD
,
value
);
value
=
tomUndefined
;
value
=
tomUndefined
;
ITextFont_GetEmboss
(
font
,
&
value
);
hr
=
ITextFont_GetEmboss
(
font
,
&
value
);
CHARFORMAT_SET_B_FIELD
(
EMBOSS
,
value
);
CHARFORMAT_SET_B_FIELD
(
EMBOSS
,
value
);
value
=
tomUndefined
;
value
=
tomUndefined
;
ITextFont_GetHidden
(
font
,
&
value
);
hr
=
ITextFont_GetHidden
(
font
,
&
value
);
CHARFORMAT_SET_B_FIELD
(
HIDDEN
,
value
);
CHARFORMAT_SET_B_FIELD
(
HIDDEN
,
value
);
value
=
tomUndefined
;
value
=
tomUndefined
;
ITextFont_GetEngrave
(
font
,
&
value
);
hr
=
ITextFont_GetEngrave
(
font
,
&
value
);
CHARFORMAT_SET_B_FIELD
(
IMPRINT
,
value
);
CHARFORMAT_SET_B_FIELD
(
IMPRINT
,
value
);
value
=
tomUndefined
;
value
=
tomUndefined
;
ITextFont_GetItalic
(
font
,
&
value
);
hr
=
ITextFont_GetItalic
(
font
,
&
value
);
CHARFORMAT_SET_B_FIELD
(
ITALIC
,
value
);
CHARFORMAT_SET_B_FIELD
(
ITALIC
,
value
);
value
=
tomUndefined
;
value
=
tomUndefined
;
ITextFont_GetOutline
(
font
,
&
value
);
hr
=
ITextFont_GetOutline
(
font
,
&
value
);
CHARFORMAT_SET_B_FIELD
(
OUTLINE
,
value
);
CHARFORMAT_SET_B_FIELD
(
OUTLINE
,
value
);
value
=
tomUndefined
;
value
=
tomUndefined
;
ITextFont_GetProtected
(
font
,
&
value
);
hr
=
ITextFont_GetProtected
(
font
,
&
value
);
CHARFORMAT_SET_B_FIELD
(
PROTECTED
,
value
);
CHARFORMAT_SET_B_FIELD
(
PROTECTED
,
value
);
value
=
tomUndefined
;
value
=
tomUndefined
;
ITextFont_GetShadow
(
font
,
&
value
);
hr
=
ITextFont_GetShadow
(
font
,
&
value
);
CHARFORMAT_SET_B_FIELD
(
SHADOW
,
value
);
CHARFORMAT_SET_B_FIELD
(
SHADOW
,
value
);
value
=
tomUndefined
;
value
=
tomUndefined
;
ITextFont_GetSmallCaps
(
font
,
&
value
);
hr
=
ITextFont_GetSmallCaps
(
font
,
&
value
);
CHARFORMAT_SET_B_FIELD
(
SMALLCAPS
,
value
);
CHARFORMAT_SET_B_FIELD
(
SMALLCAPS
,
value
);
value
=
tomUndefined
;
value
=
tomUndefined
;
ITextFont_GetStrikeThrough
(
font
,
&
value
);
hr
=
ITextFont_GetStrikeThrough
(
font
,
&
value
);
CHARFORMAT_SET_B_FIELD
(
STRIKEOUT
,
value
);
CHARFORMAT_SET_B_FIELD
(
STRIKEOUT
,
value
);
value
=
tomUndefined
;
value
=
tomUndefined
;
ITextFont_GetSubscript
(
font
,
&
value
);
hr
=
ITextFont_GetSubscript
(
font
,
&
value
);
CHARFORMAT_SET_B_FIELD
(
SUBSCRIPT
,
value
);
CHARFORMAT_SET_B_FIELD
(
SUBSCRIPT
,
value
);
value
=
tomUndefined
;
value
=
tomUndefined
;
ITextFont_GetSuperscript
(
font
,
&
value
);
hr
=
ITextFont_GetSuperscript
(
font
,
&
value
);
CHARFORMAT_SET_B_FIELD
(
SUPERSCRIPT
,
value
);
CHARFORMAT_SET_B_FIELD
(
SUPERSCRIPT
,
value
);
value
=
tomUndefined
;
value
=
tomUndefined
;
ITextFont_GetUnderline
(
font
,
&
value
);
hr
=
ITextFont_GetUnderline
(
font
,
&
value
);
CHARFORMAT_SET_B_FIELD
(
UNDERLINE
,
value
);
CHARFORMAT_SET_B_FIELD
(
UNDERLINE
,
value
);
#undef CHARFORMAT_SET_B_FIELD
#undef CHARFORMAT_SET_B_FIELD
value
=
tomUndefined
;
value
=
tomUndefined
;
ITextFont_GetAnimation
(
font
,
&
value
);
hr
=
ITextFont_GetAnimation
(
font
,
&
value
);
if
(
value
!=
tomUndefined
)
{
if
(
hr
==
S_OK
&&
value
!=
tomUndefined
)
{
fmt
.
dwMask
|=
CFM_ANIMATION
;
fmt
.
dwMask
|=
CFM_ANIMATION
;
fmt
.
bAnimation
=
value
;
fmt
.
bAnimation
=
value
;
}
}
value
=
tomUndefined
;
value
=
tomUndefined
;
ITextFont_GetBackColor
(
font
,
&
value
);
hr
=
ITextFont_GetBackColor
(
font
,
&
value
);
if
(
value
!=
tomUndefined
)
{
if
(
hr
==
S_OK
&&
value
!=
tomUndefined
)
{
fmt
.
dwMask
|=
CFM_BACKCOLOR
;
fmt
.
dwMask
|=
CFM_BACKCOLOR
;
if
(
value
==
tomAutoColor
)
if
(
value
==
tomAutoColor
)
fmt
.
dwEffects
|=
CFE_AUTOBACKCOLOR
;
fmt
.
dwEffects
|=
CFE_AUTOBACKCOLOR
;
...
@@ -613,8 +614,8 @@ static void textrange_set_font(ITextRange *range, ITextFont *font)
...
@@ -613,8 +614,8 @@ static void textrange_set_font(ITextRange *range, ITextFont *font)
}
}
value
=
tomUndefined
;
value
=
tomUndefined
;
ITextFont_GetForeColor
(
font
,
&
value
);
hr
=
ITextFont_GetForeColor
(
font
,
&
value
);
if
(
value
!=
tomUndefined
)
{
if
(
hr
==
S_OK
&&
value
!=
tomUndefined
)
{
fmt
.
dwMask
|=
CFM_COLOR
;
fmt
.
dwMask
|=
CFM_COLOR
;
if
(
value
==
tomAutoColor
)
if
(
value
==
tomAutoColor
)
fmt
.
dwEffects
|=
CFE_AUTOCOLOR
;
fmt
.
dwEffects
|=
CFE_AUTOCOLOR
;
...
@@ -623,15 +624,15 @@ static void textrange_set_font(ITextRange *range, ITextFont *font)
...
@@ -623,15 +624,15 @@ static void textrange_set_font(ITextRange *range, ITextFont *font)
}
}
value
=
tomUndefined
;
value
=
tomUndefined
;
ITextFont_GetKerning
(
font
,
&
f
);
hr
=
ITextFont_GetKerning
(
font
,
&
f
);
if
(
f
!=
tomUndefined
)
{
if
(
hr
==
S_OK
&&
f
!=
tomUndefined
)
{
fmt
.
dwMask
|=
CFM_KERNING
;
fmt
.
dwMask
|=
CFM_KERNING
;
fmt
.
wKerning
=
points_to_twips
(
f
);
fmt
.
wKerning
=
points_to_twips
(
f
);
}
}
value
=
tomUndefined
;
value
=
tomUndefined
;
ITextFont_GetLanguageID
(
font
,
&
value
);
hr
=
ITextFont_GetLanguageID
(
font
,
&
value
);
if
(
value
!=
tomUndefined
)
{
if
(
hr
==
S_OK
&&
value
!=
tomUndefined
)
{
fmt
.
dwMask
|=
CFM_LCID
;
fmt
.
dwMask
|=
CFM_LCID
;
fmt
.
lcid
=
value
;
fmt
.
lcid
=
value
;
}
}
...
@@ -642,26 +643,26 @@ static void textrange_set_font(ITextRange *range, ITextFont *font)
...
@@ -642,26 +643,26 @@ static void textrange_set_font(ITextRange *range, ITextFont *font)
SysFreeString
(
str
);
SysFreeString
(
str
);
}
}
ITextFont_GetPosition
(
font
,
&
f
);
hr
=
ITextFont_GetPosition
(
font
,
&
f
);
if
(
f
!=
tomUndefined
)
{
if
(
hr
==
S_OK
&&
f
!=
tomUndefined
)
{
fmt
.
dwMask
|=
CFM_OFFSET
;
fmt
.
dwMask
|=
CFM_OFFSET
;
fmt
.
yOffset
=
points_to_twips
(
f
);
fmt
.
yOffset
=
points_to_twips
(
f
);
}
}
ITextFont_GetSize
(
font
,
&
f
);
hr
=
ITextFont_GetSize
(
font
,
&
f
);
if
(
f
!=
tomUndefined
)
{
if
(
hr
==
S_OK
&&
f
!=
tomUndefined
)
{
fmt
.
dwMask
|=
CFM_SIZE
;
fmt
.
dwMask
|=
CFM_SIZE
;
fmt
.
yHeight
=
points_to_twips
(
f
);
fmt
.
yHeight
=
points_to_twips
(
f
);
}
}
ITextFont_GetSpacing
(
font
,
&
f
);
hr
=
ITextFont_GetSpacing
(
font
,
&
f
);
if
(
f
!=
tomUndefined
)
{
if
(
hr
==
S_OK
&&
f
!=
tomUndefined
)
{
fmt
.
dwMask
|=
CFM_SPACING
;
fmt
.
dwMask
|=
CFM_SPACING
;
fmt
.
sSpacing
=
f
;
fmt
.
sSpacing
=
f
;
}
}
ITextFont_GetWeight
(
font
,
&
value
);
hr
=
ITextFont_GetWeight
(
font
,
&
value
);
if
(
value
!=
tomUndefined
)
{
if
(
hr
==
S_OK
&&
value
!=
tomUndefined
)
{
fmt
.
dwMask
|=
CFM_WEIGHT
;
fmt
.
dwMask
|=
CFM_WEIGHT
;
fmt
.
wWeight
=
value
;
fmt
.
wWeight
=
value
;
}
}
...
...
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