Commit 09789846 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

mshtml: Use wide-char string literals in html*.c.

parent 59b97476
......@@ -65,27 +65,23 @@ HTMLOuterWindow *get_target_window(HTMLOuterWindow *window, nsAString *target_st
const PRUnichar *target;
HRESULT hres;
static const WCHAR _parentW[] = {'_','p','a','r','e','n','t',0};
static const WCHAR _selfW[] = {'_','s','e','l','f',0};
static const WCHAR _topW[] = {'_','t','o','p',0};
*use_new_window = FALSE;
nsAString_GetData(target_str, &target);
TRACE("%s\n", debugstr_w(target));
if(!*target || !wcsicmp(target, _selfW)) {
if(!*target || !wcsicmp(target, L"_self")) {
IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface);
return window;
}
if(!wcsicmp(target, _topW)) {
if(!wcsicmp(target, L"_top")) {
get_top_window(window, &top_window);
IHTMLWindow2_AddRef(&top_window->base.IHTMLWindow2_iface);
return top_window;
}
if(!wcsicmp(target, _parentW)) {
if(!wcsicmp(target, L"_parent")) {
if(!window->parent) {
WARN("Window has no parent, treat as self\n");
IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface);
......
......@@ -115,8 +115,6 @@ HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret)
unsigned int i;
int rgb = -1;
static const WCHAR formatW[] = {'#','%','0','2','x','%','0','2','x','%','0','2','x',0};
if(!color || !*color) {
*ret = NULL;
return S_OK;
......@@ -135,7 +133,7 @@ HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret)
if(!*ret)
return E_OUTOFMEMORY;
swprintf(*ret, 8, formatW, rgb>>16, (rgb>>8)&0xff, rgb&0xff);
swprintf(*ret, 8, L"#%02x%02x%02x", rgb>>16, (rgb>>8)&0xff, rgb&0xff);
TRACE("%s -> %s\n", debugstr_w(color), debugstr_w(*ret));
return S_OK;
......@@ -150,9 +148,8 @@ BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr)
case VT_I4: {
PRUnichar buf[10];
static const WCHAR formatW[] = {'#','%','x',0};
wsprintfW(buf, formatW, V_I4(v));
wsprintfW(buf, L"#%x", V_I4(v));
nsAString_Init(nsstr, buf);
return TRUE;
}
......@@ -576,13 +573,6 @@ static HRESULT WINAPI HTMLBodyElement_get_onunload(IHTMLBodyElement *iface, VARI
return E_NOTIMPL;
}
static const WCHAR autoW[] = {'a','u','t','o',0};
static const WCHAR hiddenW[] = {'h','i','d','d','e','n',0};
static const WCHAR scrollW[] = {'s','c','r','o','l','l',0};
static const WCHAR visibleW[] = {'v','i','s','i','b','l','e',0};
static const WCHAR yesW[] = {'y','e','s',0};
static const WCHAR noW[] = {'n','o',0};
static HRESULT WINAPI HTMLBodyElement_put_scroll(IHTMLBodyElement *iface, BSTR v)
{
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
......@@ -591,12 +581,12 @@ static HRESULT WINAPI HTMLBodyElement_put_scroll(IHTMLBodyElement *iface, BSTR v
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
/* Emulate with CSS visibility attribute */
if(!wcscmp(v, yesW)) {
val = scrollW;
}else if(!wcscmp(v, autoW)) {
val = visibleW;
}else if(!wcscmp(v, noW)) {
val = hiddenW;
if(!wcscmp(v, L"yes")) {
val = L"scroll";
}else if(!wcscmp(v, L"auto")) {
val = L"visible";
}else if(!wcscmp(v, L"no")) {
val = L"hidden";
}else {
WARN("Invalid argument %s\n", debugstr_w(v));
return E_INVALIDARG;
......@@ -622,12 +612,12 @@ static HRESULT WINAPI HTMLBodyElement_get_scroll(IHTMLBodyElement *iface, BSTR *
if(!overflow || !*overflow) {
*p = NULL;
hres = S_OK;
}else if(!wcscmp(overflow, visibleW) || !wcscmp(overflow, autoW)) {
ret = autoW;
}else if(!wcscmp(overflow, scrollW)) {
ret = yesW;
}else if(!wcscmp(overflow, hiddenW)) {
ret = noW;
}else if(!wcscmp(overflow, L"visible") || !wcscmp(overflow, L"auto")) {
ret = L"auto";
}else if(!wcscmp(overflow, L"scroll")) {
ret = L"yes";
}else if(!wcscmp(overflow, L"hidden")) {
ret = L"no";
}else {
TRACE("Defaulting %s to NULL\n", debugstr_w(overflow));
*p = NULL;
......
......@@ -577,11 +577,9 @@ static HRESULT WINAPI HTMLDocument_put_designMode(IHTMLDocument2 *iface, BSTR v)
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
HRESULT hres;
static const WCHAR onW[] = {'o','n',0};
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
if(wcsicmp(v, onW)) {
if(wcsicmp(v, L"on")) {
FIXME("Unsupported arg %s\n", debugstr_w(v));
return E_NOTIMPL;
}
......@@ -597,13 +595,12 @@ static HRESULT WINAPI HTMLDocument_put_designMode(IHTMLDocument2 *iface, BSTR v)
static HRESULT WINAPI HTMLDocument_get_designMode(IHTMLDocument2 *iface, BSTR *p)
{
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
static const WCHAR szOff[] = {'O','f','f',0};
FIXME("(%p)->(%p) always returning Off\n", This, p);
if(!p)
return E_INVALIDARG;
*p = SysAllocString(szOff);
*p = SysAllocString(L"Off");
return S_OK;
}
......@@ -824,12 +821,9 @@ static HRESULT WINAPI HTMLDocument_get_URL(IHTMLDocument2 *iface, BSTR *p)
{
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
static const WCHAR about_blank_url[] =
{'a','b','o','u','t',':','b','l','a','n','k',0};
TRACE("(%p)->(%p)\n", iface, p);
*p = SysAllocString(This->window->url ? This->window->url : about_blank_url);
*p = SysAllocString(This->window->url ? This->window->url : L"about:blank");
return *p ? S_OK : E_OUTOFMEMORY;
}
......@@ -1119,8 +1113,6 @@ static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT
nsISupports *tmp;
nsresult nsres;
static const WCHAR text_htmlW[] = {'t','e','x','t','/','h','t','m','l',0};
TRACE("(%p)->(%s %s %s %s %p)\n", This, debugstr_w(url), debugstr_variant(&name),
debugstr_variant(&features), debugstr_variant(&replace), pomWindowResult);
......@@ -1129,7 +1121,7 @@ static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT
return E_NOTIMPL;
}
if(!url || wcscmp(url, text_htmlW) || V_VT(&name) != VT_ERROR
if(!url || wcscmp(url, L"text/html") || V_VT(&name) != VT_ERROR
|| V_VT(&features) != VT_ERROR || V_VT(&replace) != VT_ERROR)
FIXME("unsupported args\n");
......@@ -1709,14 +1701,12 @@ static HRESULT WINAPI HTMLDocument_toString(IHTMLDocument2 *iface, BSTR *String)
{
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
static const WCHAR objectW[] = {'[','o','b','j','e','c','t',']',0};
TRACE("(%p)->(%p)\n", This, String);
if(!String)
return E_INVALIDARG;
*String = SysAllocString(objectW);
*String = SysAllocString(L"[object]");
return *String ? S_OK : E_OUTOFMEMORY;
}
......@@ -1731,8 +1721,6 @@ static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR
nsresult nsres;
HRESULT hres;
static const WCHAR styleW[] = {'s','t','y','l','e',0};
TRACE("(%p)->(%s %d %p)\n", This, debugstr_w(bstrHref), lIndex, ppnewStyleSheet);
if(!This->doc_node->nsdoc) {
......@@ -1749,7 +1737,7 @@ static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR
return S_OK;
}
hres = create_element(This->doc_node, styleW, &elem);
hres = create_element(This->doc_node, L"style", &elem);
if(FAILED(hres))
return hres;
......@@ -2362,8 +2350,7 @@ static HRESULT WINAPI HTMLDocument3_getElementsByName(IHTMLDocument3 *iface, BST
nsAString selector_str;
WCHAR *selector;
nsresult nsres;
static const WCHAR formatW[] = {'*','[','i','d','=','%','s',']',',','*','[','n','a','m','e','=','%','s',']',0};
static const WCHAR formatW[] = L"*[id=%s],*[name=%s]";
TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), ppelColl);
......@@ -3006,12 +2993,9 @@ static HRESULT WINAPI HTMLDocument5_get_compatMode(IHTMLDocument5 *iface, BSTR *
{
HTMLDocument *This = impl_from_IHTMLDocument5(iface);
static const WCHAR BackCompatW[] = {'B','a','c','k','C','o','m','p','a','t',0};
static const WCHAR CSS1CompatW[] = {'C','S','S','1','C','o','m','p','a','t',0};
TRACE("(%p)->(%p)\n", This, p);
*p = SysAllocString(This->doc_node->document_mode <= COMPAT_MODE_IE5 ? BackCompatW : CSS1CompatW);
*p = SysAllocString(This->doc_node->document_mode <= COMPAT_MODE_IE5 ? L"BackCompat" : L"CSS1Compat");
return *p ? S_OK : E_OUTOFMEMORY;
}
......
......@@ -860,13 +860,11 @@ HRESULT attr_value_to_string(VARIANT *v)
{
HRESULT hres;
static const WCHAR nullW[] = {'n','u','l','l',0};
switch(V_VT(v)) {
case VT_BSTR:
break;
case VT_NULL:
V_BSTR(v) = SysAllocString(nullW);
V_BSTR(v) = SysAllocString(L"null");
if(!V_BSTR(v))
return E_OUTOFMEMORY;
V_VT(v) = VT_BSTR;
......@@ -1043,10 +1041,8 @@ static HRESULT WINAPI HTMLElement_get_tagName(IHTMLElement *iface, BSTR *p)
TRACE("(%p)->(%p)\n", This, p);
if(!This->dom_element) {
static const WCHAR comment_tagW[] = {'!',0};
TRACE("comment element\n");
*p = SysAllocString(comment_tagW);
*p = SysAllocString(L"!");
return *p ? S_OK : E_OUTOFMEMORY;
}
......@@ -1314,8 +1310,6 @@ static HRESULT WINAPI HTMLElement_get_document(IHTMLElement *iface, IDispatch **
return S_OK;
}
static const WCHAR titleW[] = {'t','i','t','l','e',0};
static HRESULT WINAPI HTMLElement_put_title(IHTMLElement *iface, BSTR v)
{
HTMLElement *This = impl_from_IHTMLElement(iface);
......@@ -1328,7 +1322,7 @@ static HRESULT WINAPI HTMLElement_put_title(IHTMLElement *iface, BSTR v)
VARIANT *var;
HRESULT hres;
hres = dispex_get_dprop_ref(&This->node.event_target.dispex, titleW, TRUE, &var);
hres = dispex_get_dprop_ref(&This->node.event_target.dispex, L"title", TRUE, &var);
if(FAILED(hres))
return hres;
......@@ -1359,7 +1353,7 @@ static HRESULT WINAPI HTMLElement_get_title(IHTMLElement *iface, BSTR *p)
VARIANT *var;
HRESULT hres;
hres = dispex_get_dprop_ref(&This->node.event_target.dispex, titleW, FALSE, &var);
hres = dispex_get_dprop_ref(&This->node.event_target.dispex, L"title", FALSE, &var);
if(hres == DISP_E_UNKNOWNNAME) {
*p = NULL;
}else if(V_VT(var) != VT_BSTR) {
......@@ -1377,15 +1371,13 @@ static HRESULT WINAPI HTMLElement_get_title(IHTMLElement *iface, BSTR *p)
return return_nsstr(nsres, &title_str, p);
}
static const WCHAR languageW[] = {'l','a','n','g','u','a','g','e',0};
static HRESULT WINAPI HTMLElement_put_language(IHTMLElement *iface, BSTR v)
{
HTMLElement *This = impl_from_IHTMLElement(iface);
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
return elem_string_attr_setter(This, languageW, v);
return elem_string_attr_setter(This, L"language", v);
}
static HRESULT WINAPI HTMLElement_get_language(IHTMLElement *iface, BSTR *p)
......@@ -1394,7 +1386,7 @@ static HRESULT WINAPI HTMLElement_get_language(IHTMLElement *iface, BSTR *p)
TRACE("(%p)->(%p)\n", This, p);
return elem_string_attr_getter(This, languageW, TRUE, p);
return elem_string_attr_getter(This, L"language", TRUE, p);
}
static HRESULT WINAPI HTMLElement_put_onselectstart(IHTMLElement *iface, VARIANT v)
......@@ -1845,12 +1837,7 @@ static HRESULT insert_adjacent_node(HTMLElement *This, const WCHAR *where, nsIDO
nsresult nsres;
HRESULT hres = S_OK;
static const WCHAR beforebeginW[] = {'b','e','f','o','r','e','b','e','g','i','n',0};
static const WCHAR afterbeginW[] = {'a','f','t','e','r','b','e','g','i','n',0};
static const WCHAR beforeendW[] = {'b','e','f','o','r','e','e','n','d',0};
static const WCHAR afterendW[] = {'a','f','t','e','r','e','n','d',0};
if (!wcsicmp(where, beforebeginW)) {
if (!wcsicmp(where, L"beforebegin")) {
nsIDOMNode *parent;
nsres = nsIDOMNode_GetParentNode(This->node.nsnode, &parent);
......@@ -1862,7 +1849,7 @@ static HRESULT insert_adjacent_node(HTMLElement *This, const WCHAR *where, nsIDO
nsres = nsIDOMNode_InsertBefore(parent, nsnode, This->node.nsnode, &ret_nsnode);
nsIDOMNode_Release(parent);
}else if(!wcsicmp(where, afterbeginW)) {
}else if(!wcsicmp(where, L"afterbegin")) {
nsIDOMNode *first_child;
nsres = nsIDOMNode_GetFirstChild(This->node.nsnode, &first_child);
......@@ -1875,9 +1862,9 @@ static HRESULT insert_adjacent_node(HTMLElement *This, const WCHAR *where, nsIDO
if (first_child)
nsIDOMNode_Release(first_child);
}else if (!wcsicmp(where, beforeendW)) {
}else if (!wcsicmp(where, L"beforeend")) {
nsres = nsIDOMNode_AppendChild(This->node.nsnode, nsnode, &ret_nsnode);
}else if (!wcsicmp(where, afterendW)) {
}else if (!wcsicmp(where, L"afterend")) {
nsIDOMNode *next_sibling, *parent;
nsres = nsIDOMNode_GetParentNode(This->node.nsnode, &parent);
......@@ -2806,7 +2793,7 @@ static HRESULT WINAPI HTMLElement2_put_accessKey(IHTMLElement2 *iface, BSTR v)
HTMLElement *This = impl_from_IHTMLElement2(iface);
VARIANT var;
static WCHAR accessKeyW[] = {'a','c','c','e','s','s','K','e','y',0};
static WCHAR accessKeyW[] = L"accessKey";
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
......@@ -3016,9 +3003,7 @@ static HRESULT WINAPI HTMLElement2_get_readyState(IHTMLElement2 *iface, VARIANT
if(FAILED(hres))
return hres;
}else {
static const WCHAR completeW[] = {'c','o','m','p','l','e','t','e',0};
str = SysAllocString(completeW);
str = SysAllocString(L"complete");
if(!str)
return E_OUTOFMEMORY;
}
......@@ -3750,8 +3735,6 @@ static HRESULT WINAPI HTMLElement3_get_hideFocus(IHTMLElement3 *iface, VARIANT_B
return E_NOTIMPL;
}
static const WCHAR disabledW[] = {'d','i','s','a','b','l','e','d',0};
static HRESULT WINAPI HTMLElement3_put_disabled(IHTMLElement3 *iface, VARIANT_BOOL v)
{
HTMLElement *This = impl_from_IHTMLElement3(iface);
......@@ -3763,7 +3746,7 @@ static HRESULT WINAPI HTMLElement3_put_disabled(IHTMLElement3 *iface, VARIANT_BO
if(This->node.vtbl->put_disabled)
return This->node.vtbl->put_disabled(&This->node, v);
hres = dispex_get_dprop_ref(&This->node.event_target.dispex, disabledW, TRUE, &var);
hres = dispex_get_dprop_ref(&This->node.event_target.dispex, L"disabled", TRUE, &var);
if(FAILED(hres))
return hres;
......@@ -3784,7 +3767,7 @@ static HRESULT WINAPI HTMLElement3_get_disabled(IHTMLElement3 *iface, VARIANT_BO
if(This->node.vtbl->get_disabled)
return This->node.vtbl->get_disabled(&This->node, p);
hres = dispex_get_dprop_ref(&This->node.event_target.dispex, disabledW, FALSE, &var);
hres = dispex_get_dprop_ref(&This->node.event_target.dispex, L"disabled", FALSE, &var);
if(hres == DISP_E_UNKNOWNNAME) {
*p = VARIANT_FALSE;
return S_OK;
......@@ -5095,9 +5078,7 @@ HRESULT elem_unique_id(unsigned id, BSTR *p)
{
WCHAR buf[32];
static const WCHAR formatW[] = {'m','s','_','_','i','d','%','u',0};
swprintf(buf, ARRAY_SIZE(buf), formatW, id);
swprintf(buf, ARRAY_SIZE(buf), L"ms__id%u", id);
*p = SysAllocString(buf);
return *p ? S_OK : E_OUTOFMEMORY;
}
......
......@@ -227,19 +227,14 @@ static HRESULT WINAPI HTMLFormElement_get_dir(IHTMLFormElement *iface, BSTR *p)
static HRESULT WINAPI HTMLFormElement_put_encoding(IHTMLFormElement *iface, BSTR v)
{
static const WCHAR urlencodedW[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
'x','-','w','w','w','-','f','o','r','m','-','u','r','l','e','n','c','o','d','e','d',0};
static const WCHAR dataW[] = {'m','u','l','t','i','p','a','r','t','/',
'f','o','r','m','-','d','a','t','a',0};
static const WCHAR plainW[] = {'t','e','x','t','/','p','l','a','i','n',0};
HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
nsAString encoding_str;
nsresult nsres;
TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
if(lstrcmpiW(v, urlencodedW) && lstrcmpiW(v, dataW) && lstrcmpiW(v, plainW)) {
if(lstrcmpiW(v, L"application/x-www-form-urlencoded") && lstrcmpiW(v, L"multipart/form-data")
&& lstrcmpiW(v, L"text/plain")) {
WARN("incorrect enctype\n");
return E_INVALIDARG;
}
......@@ -268,16 +263,13 @@ static HRESULT WINAPI HTMLFormElement_get_encoding(IHTMLFormElement *iface, BSTR
static HRESULT WINAPI HTMLFormElement_put_method(IHTMLFormElement *iface, BSTR v)
{
static const WCHAR postW[] = {'P','O','S','T',0};
static const WCHAR getW[] = {'G','E','T',0};
HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
nsAString method_str;
nsresult nsres;
TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
if(lstrcmpiW(v, postW) && lstrcmpiW(v, getW)) {
if(lstrcmpiW(v, L"POST") && lstrcmpiW(v, L"GET")) {
WARN("unrecognized method\n");
return E_INVALIDARG;
}
......
......@@ -34,11 +34,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
static const WCHAR autoW[] = {'a','u','t','o',0};
static const WCHAR yesW[] = {'y','e','s',0};
static const WCHAR noW[] = {'n','o',0};
static const WCHAR pxW[] = {'p','x',0};
static HRESULT set_frame_doc(HTMLFrameBase *frame, nsIDOMDocument *nsdoc)
{
mozIDOMWindowProxy *mozwindow;
......@@ -343,7 +338,7 @@ static HRESULT WINAPI HTMLFrameBase_get_marginWidth(IHTMLFrameBase *iface, VARIA
if(*str) {
BSTR ret;
end = wcsstr(str, pxW);
end = wcsstr(str, L"px");
if(!end)
end = str+lstrlenW(str);
ret = SysAllocStringLen(str, end-str);
......@@ -410,7 +405,7 @@ static HRESULT WINAPI HTMLFrameBase_get_marginHeight(IHTMLFrameBase *iface, VARI
if(*str) {
BSTR ret;
end = wcsstr(str, pxW);
end = wcsstr(str, L"px");
if(!end)
end = str+lstrlenW(str);
ret = SysAllocStringLen(str, end-str);
......@@ -455,7 +450,7 @@ static HRESULT WINAPI HTMLFrameBase_put_scrolling(IHTMLFrameBase *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
if(!(!wcsicmp(v, yesW) || !wcsicmp(v, noW) || !wcsicmp(v, autoW)))
if(!(!wcsicmp(v, L"yes") || !wcsicmp(v, L"no") || !wcsicmp(v, L"auto")))
return E_INVALIDARG;
if(This->nsframe) {
......@@ -509,7 +504,7 @@ static HRESULT WINAPI HTMLFrameBase_get_scrolling(IHTMLFrameBase *iface, BSTR *p
if(*strdata)
*p = SysAllocString(strdata);
else
*p = SysAllocString(autoW);
*p = SysAllocString(L"auto");
nsAString_Finish(&nsstr);
......
......@@ -503,15 +503,13 @@ static HRESULT WINAPI HTMLMetaElement_get_url(IHTMLMetaElement *iface, BSTR *p)
return E_NOTIMPL;
}
static const WCHAR charsetW[] = {'c','h','a','r','s','e','t',0};
static HRESULT WINAPI HTMLMetaElement_put_charset(IHTMLMetaElement *iface, BSTR v)
{
HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
return elem_string_attr_setter(&This->element, charsetW, v);
return elem_string_attr_setter(&This->element, L"charset", v);
}
static HRESULT WINAPI HTMLMetaElement_get_charset(IHTMLMetaElement *iface, BSTR *p)
......@@ -520,7 +518,7 @@ static HRESULT WINAPI HTMLMetaElement_get_charset(IHTMLMetaElement *iface, BSTR
TRACE("(%p)->(%p)\n", This, p);
return elem_string_attr_getter(&This->element, charsetW, TRUE, p);
return elem_string_attr_getter(&This->element, L"charset", TRUE, p);
}
static const IHTMLMetaElementVtbl HTMLMetaElementVtbl = {
......
......@@ -303,8 +303,6 @@ static HRESULT WINAPI HTMLImgElement_get_src(IHTMLImgElement *iface, BSTR *p)
nsresult nsres;
HRESULT hres = S_OK;
static const WCHAR blockedW[] = {'B','L','O','C','K','E','D',':',':',0};
TRACE("(%p)->(%p)\n", This, p);
nsAString_Init(&src_str, NULL);
......@@ -312,9 +310,9 @@ static HRESULT WINAPI HTMLImgElement_get_src(IHTMLImgElement *iface, BSTR *p)
if(NS_SUCCEEDED(nsres)) {
nsAString_GetData(&src_str, &src);
if(!wcsnicmp(src, blockedW, ARRAY_SIZE(blockedW)-1)) {
if(!wcsnicmp(src, L"BLOCKED::", ARRAY_SIZE(L"BLOCKED::")-1)) {
TRACE("returning BLOCKED::\n");
*p = SysAllocString(blockedW);
*p = SysAllocString(L"BLOCKED::");
if(!*p)
hres = E_OUTOFMEMORY;
}else {
......
......@@ -44,8 +44,6 @@ struct HTMLInputElement {
nsIDOMHTMLInputElement *nsinput;
};
static const WCHAR forW[] = {'f','o','r',0};
static inline HTMLInputElement *impl_from_IHTMLInputElement(IHTMLInputElement *iface)
{
return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputElement_iface);
......@@ -1302,11 +1300,9 @@ static HRESULT WINAPI HTMLInputTextElement2_setSelectionRange(IHTMLInputTextElem
nsAString none_str;
nsresult nsres;
static const WCHAR noneW[] = {'n','o','n','e',0};
TRACE("(%p)->(%d %d)\n", This, start, end);
nsAString_InitDepend(&none_str, noneW);
nsAString_InitDepend(&none_str, L"none");
nsres = nsIDOMHTMLInputElement_SetSelectionRange(This->nsinput, start, end, &none_str);
nsAString_Finish(&none_str);
if(NS_FAILED(nsres)) {
......@@ -1387,19 +1383,12 @@ static BOOL HTMLInputElement_is_text_edit(HTMLDOMNode *iface)
nsresult nsres;
BOOL ret = FALSE;
static const WCHAR buttonW[] = {'b','u','t','t','o','n',0};
static const WCHAR hiddenW[] = {'h','i','d','d','e','n',0};
static const WCHAR passwordW[] = {'p','a','s','s','w','o','r','d',0};
static const WCHAR resetW[] = {'r','e','s','e','t',0};
static const WCHAR submitW[] = {'s','u','b','m','i','t',0};
static const WCHAR textW[] = {'t','e','x','t',0};
nsAString_Init(&nsstr, NULL);
nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &nsstr);
if(NS_SUCCEEDED(nsres)) {
nsAString_GetData(&nsstr, &type);
ret = !wcscmp(type, buttonW) || !wcscmp(type, hiddenW) || !wcscmp(type, passwordW)
|| !wcscmp(type, resetW) || !wcscmp(type, submitW) || !wcscmp(type, textW);
ret = !wcscmp(type, L"button") || !wcscmp(type, L"hidden") || !wcscmp(type, L"password")
|| !wcscmp(type, L"reset") || !wcscmp(type, L"submit") || !wcscmp(type, L"text");
}
nsAString_Finish(&nsstr);
return ret;
......@@ -1557,7 +1546,7 @@ static HRESULT WINAPI HTMLLabelElement_put_htmlFor(IHTMLLabelElement *iface, BST
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
nsAString_InitDepend(&for_str, forW);
nsAString_InitDepend(&for_str, L"for");
nsAString_InitDepend(&val_str, v);
nsres = nsIDOMElement_SetAttribute(This->element.dom_element, &for_str, &val_str);
nsAString_Finish(&for_str);
......@@ -1576,7 +1565,7 @@ static HRESULT WINAPI HTMLLabelElement_get_htmlFor(IHTMLLabelElement *iface, BST
TRACE("(%p)->(%p)\n", This, p);
return elem_string_attr_getter(&This->element, forW, FALSE, p);
return elem_string_attr_getter(&This->element, L"for", FALSE, p);
}
static HRESULT WINAPI HTMLLabelElement_put_accessKey(IHTMLLabelElement *iface, BSTR v)
......
......@@ -350,12 +350,11 @@ static HRESULT WINAPI HTMLLocation_get_host(IHTMLLocation *iface, BSTR *p)
if(url.nPort) {
/* <hostname>:<port> */
static const WCHAR format[] = {'%','u',0};
DWORD len, port_len;
WCHAR portW[6];
WCHAR *buf;
port_len = swprintf(portW, ARRAY_SIZE(portW), format, url.nPort);
port_len = swprintf(portW, ARRAY_SIZE(portW), L"%u", url.nPort);
len = url.dwHostNameLength + 1 /* ':' */ + port_len;
buf = *p = SysAllocStringLen(NULL, len);
memcpy(buf, url.lpszHostName, url.dwHostNameLength * sizeof(WCHAR));
......@@ -435,10 +434,9 @@ static HRESULT WINAPI HTMLLocation_get_port(IHTMLLocation *iface, BSTR *p)
return hres;
if(hres == S_OK) {
static const WCHAR formatW[] = {'%','u',0};
WCHAR buf[12];
swprintf(buf, ARRAY_SIZE(buf), formatW, port);
swprintf(buf, ARRAY_SIZE(buf), L"%u", port);
*p = SysAllocString(buf);
}else {
*p = SysAllocStringLen(NULL, 0);
......
......@@ -267,8 +267,7 @@ static HRESULT WINAPI HTMLObjectElement_put_width(IHTMLObjectElement *iface, VAR
switch(V_VT(&v)) {
case VT_I4: {
static const WCHAR formatW[] = {'%','d',0};
swprintf(buf, ARRAY_SIZE(buf), formatW, V_I4(&v));
swprintf(buf, ARRAY_SIZE(buf), L"%d", V_I4(&v));
break;
}
default:
......@@ -326,8 +325,7 @@ static HRESULT WINAPI HTMLObjectElement_put_height(IHTMLObjectElement *iface, VA
switch(V_VT(&v)) {
case VT_I4: {
static const WCHAR formatW[] = {'%','d',0};
swprintf(buf, ARRAY_SIZE(buf), formatW, V_I4(&v));
swprintf(buf, ARRAY_SIZE(buf), L"%d", V_I4(&v));
break;
}
default:
......@@ -577,11 +575,9 @@ static HRESULT WINAPI HTMLObjectElement2_put_classid(IHTMLObjectElement2 *iface,
HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
HRESULT hres;
static const WCHAR classidW[] = {'c','l','a','s','s','i','d',0};
FIXME("(%p)->(%s) semi-stub\n", This, debugstr_w(v));
hres = elem_string_attr_setter(&This->plugin_container.element, classidW, v);
hres = elem_string_attr_setter(&This->plugin_container.element, L"classid", v);
if(FAILED(hres))
return hres;
......
......@@ -1191,8 +1191,7 @@ static HRESULT WINAPI HTMLTable_put_cellSpacing(IHTMLTable *iface, VARIANT v)
nsAString_InitDepend(&nsstr, V_BSTR(&v));
break;
case VT_I4: {
static const WCHAR formatW[] = {'%','d',0};
swprintf(buf, ARRAY_SIZE(buf), formatW, V_I4(&v));
swprintf(buf, ARRAY_SIZE(buf), L"%d", V_I4(&v));
nsAString_InitDepend(&nsstr, buf);
break;
}
......
......@@ -101,13 +101,11 @@ static HRESULT WINAPI HTMLTextAreaElement_Invoke(IHTMLTextAreaElement *iface, DI
static HRESULT WINAPI HTMLTextAreaElement_get_type(IHTMLTextAreaElement *iface, BSTR *p)
{
static const WCHAR textareaW[] = {'t','e','x','t','a','r','e','a',0};
HTMLTextAreaElement *This = impl_from_IHTMLTextAreaElement(iface);
TRACE("(%p)->(%p)\n", This, p);
*p = SysAllocString(textareaW);
*p = SysAllocString(L"textarea");
if(!*p)
return E_OUTOFMEMORY;
return S_OK;
......
......@@ -978,8 +978,6 @@ static HRESULT WINAPI HTMLWindow2_open(IHTMLWindow2 *iface, BSTR url, BSTR name,
IUri *uri;
HRESULT hres;
static const WCHAR _selfW[] = {'_','s','e','l','f',0};
TRACE("(%p)->(%s %s %s %x %p)\n", This, debugstr_w(url), debugstr_w(name),
debugstr_w(features), replace, pomWindowResult);
if(features)
......@@ -991,7 +989,7 @@ static HRESULT WINAPI HTMLWindow2_open(IHTMLWindow2 *iface, BSTR url, BSTR name,
return E_UNEXPECTED;
if(name && *name == '_') {
if(!wcscmp(name, _selfW)) {
if(!wcscmp(name, L"_self")) {
if((features && *features) || replace)
FIXME("Unsupported arguments for _self target\n");
......@@ -1440,14 +1438,12 @@ static HRESULT WINAPI HTMLWindow2_toString(IHTMLWindow2 *iface, BSTR *String)
{
HTMLWindow *This = impl_from_IHTMLWindow2(iface);
static const WCHAR objectW[] = {'[','o','b','j','e','c','t',']',0};
TRACE("(%p)->(%p)\n", This, String);
if(!String)
return E_INVALIDARG;
*String = SysAllocString(objectW);
*String = SysAllocString(L"[object]");
return *String ? S_OK : E_OUTOFMEMORY;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment