Jacek Caban : mshtml: Properly handle NULL value in set_nsstyle_attr.
Alexandre Julliard
julliard at winehq.org
Thu Dec 6 16:25:10 CST 2012
Module: wine
Branch: master
Commit: 10a832cc042075b828322ea94a58af14720954f0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=10a832cc042075b828322ea94a58af14720954f0
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Dec 6 14:24:14 2012 +0100
mshtml: Properly handle NULL value in set_nsstyle_attr.
---
dlls/mshtml/htmlstyle.c | 12 +++++++-----
dlls/mshtml/tests/style.c | 13 +++++++++++++
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 6427bee..95d7a88 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -351,16 +351,18 @@ static LPWSTR fix_url_value(LPCWSTR val)
return ret;
}
-HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, LPCWSTR value, DWORD flags)
+HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, const WCHAR *value, DWORD flags)
{
nsAString str_name, str_value, str_empty;
LPWSTR val = NULL;
nsresult nsres;
- if(flags & ATTR_FIX_PX)
- val = fix_px_value(value);
- if(flags & ATTR_FIX_URL)
- val = fix_url_value(value);
+ if(value) {
+ if(flags & ATTR_FIX_PX)
+ val = fix_px_value(value);
+ if(flags & ATTR_FIX_URL)
+ val = fix_url_value(value);
+ }
nsAString_InitDepend(&str_name, style_tbl[sid].name);
nsAString_InitDepend(&str_value, val ? val : value);
diff --git a/dlls/mshtml/tests/style.c b/dlls/mshtml/tests/style.c
index fd0f78e..08b3a3c 100644
--- a/dlls/mshtml/tests/style.c
+++ b/dlls/mshtml/tests/style.c
@@ -1052,6 +1052,19 @@ static void test_body_style(IHTMLStyle *style)
ok(!strcmp_wa(V_BSTR(&v), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
VariantClear(&v);
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = NULL;
+ hres = IHTMLStyle_put_height(style, v);
+ ok(hres == S_OK, "put_height failed: %08x\n", hres);
+ VariantClear(&v);
+
+ V_VT(&v) = VT_EMPTY;
+ hres = IHTMLStyle_get_height(style, &v);
+ ok(hres == S_OK, "get_height failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+ ok(!V_BSTR(&v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v)));
+ VariantClear(&v);
+
V_VT(&v) = VT_I4;
V_I4(&v) = 64;
hres = IHTMLStyle_put_height(style, v);
More information about the wine-cvs
mailing list