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
bbd925dd
Commit
bbd925dd
authored
Dec 27, 2009
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 28, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Added better error handling to nscolor_to_str.
parent
2e1aa43a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
15 deletions
+22
-15
htmlbody.c
dlls/mshtml/htmlbody.c
+22
-15
No files found.
dlls/mshtml/htmlbody.c
View file @
bbd925dd
...
...
@@ -83,20 +83,25 @@ static const struct {
{
yellowW
,
{
'#'
,
'f'
,
'f'
,
'f'
,
'f'
,
'0'
,
'0'
,
0
}}
};
static
BSTR
nscolor_to_str
(
LPCWSTR
color
)
static
HRESULT
nscolor_to_str
(
LPCWSTR
color
,
BSTR
*
ret
)
{
int
i
;
if
(
!
color
||
*
color
==
'#'
)
return
SysAllocString
(
color
);
if
(
!
color
||
*
color
==
'#'
)
{
*
ret
=
SysAllocString
(
color
);
return
*
ret
?
S_OK
:
E_OUTOFMEMORY
;
}
for
(
i
=
0
;
i
<
sizeof
(
keyword_table
)
/
sizeof
(
keyword_table
[
0
]);
i
++
)
{
if
(
!
strcmpiW
(
color
,
keyword_table
[
i
].
keyword
))
return
SysAllocString
(
keyword_table
[
i
].
hexstr
);
if
(
!
strcmpiW
(
color
,
keyword_table
[
i
].
keyword
))
{
*
ret
=
SysAllocString
(
keyword_table
[
i
].
hexstr
);
return
*
ret
?
S_OK
:
E_OUTOFMEMORY
;
}
}
WARN
(
"unknown color %s
\n
"
,
debugstr_w
(
color
));
return
SysAllocString
(
color
);
*
ret
=
SysAllocString
(
color
);
return
*
ret
?
S_OK
:
E_OUTOFMEMORY
;
}
static
BOOL
variant_to_nscolor
(
const
VARIANT
*
v
,
nsAString
*
nsstr
)
...
...
@@ -348,23 +353,25 @@ static HRESULT WINAPI HTMLBodyElement_get_bgColor(IHTMLBodyElement *iface, VARIA
HTMLBodyElement
*
This
=
HTMLBODY_THIS
(
iface
);
nsAString
strColor
;
nsresult
nsres
;
const
PRUnichar
*
color
;
HRESULT
hres
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
p
);
nsAString_Init
(
&
strColor
,
NULL
);
nsres
=
nsIDOMHTMLBodyElement_GetBgColor
(
This
->
nsbody
,
&
strColor
);
if
(
NS_FAILED
(
nsres
))
ERR
(
"SetBgColor failed: %08x
\n
"
,
nsres
);
nsAString_GetData
(
&
strColor
,
&
color
);
if
(
NS_SUCCEEDED
(
nsres
))
{
const
PRUnichar
*
color
;
V_VT
(
p
)
=
VT_BSTR
;
V_BSTR
(
p
)
=
nscolor_to_str
(
color
);
nsAString_GetData
(
&
strColor
,
&
color
);
V_VT
(
p
)
=
VT_BSTR
;
hres
=
nscolor_to_str
(
color
,
&
V_BSTR
(
p
));
}
else
{
ERR
(
"SetBgColor failed: %08x
\n
"
,
nsres
);
hres
=
E_FAIL
;
}
nsAString_Finish
(
&
strColor
);
return
S_OK
;
return
hres
;
}
static
HRESULT
WINAPI
HTMLBodyElement_put_text
(
IHTMLBodyElement
*
iface
,
VARIANT
v
)
...
...
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