mshtml: Optimize more nsAString handling.

This commit is contained in:
Jacek Caban 2010-01-28 23:56:31 +01:00 committed by Alexandre Julliard
parent 248db8d806
commit 4b5dcc9e6b
12 changed files with 19 additions and 20 deletions

View File

@ -283,10 +283,10 @@ static HRESULT WINAPI HTMLFrameBase_put_scrolling(IHTMLFrameBase *iface, BSTR v)
return E_INVALIDARG;
if(This->nsframe) {
nsAString_Init(&nsstr, v);
nsAString_InitDepend(&nsstr, v);
nsres = nsIDOMHTMLFrameElement_SetScrolling(This->nsframe, &nsstr);
}else if(This->nsiframe) {
nsAString_Init(&nsstr, v);
nsAString_InitDepend(&nsstr, v);
nsres = nsIDOMHTMLIFrameElement_SetScrolling(This->nsiframe, &nsstr);
}else {
ERR("No attached ns frame object\n");

View File

@ -228,7 +228,7 @@ static HRESULT WINAPI HTMLImgElement_put_alt(IHTMLImgElement *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
nsAString_Init(&alt_str, v);
nsAString_InitDepend(&alt_str, v);
nsres = nsIDOMHTMLImageElement_SetAlt(This->nsimg, &alt_str);
nsAString_Finish(&alt_str);
if(NS_FAILED(nsres))
@ -268,7 +268,7 @@ static HRESULT WINAPI HTMLImgElement_put_src(IHTMLImgElement *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
nsAString_Init(&src_str, v);
nsAString_InitDepend(&src_str, v);
nsres = nsIDOMHTMLImageElement_SetSrc(This->nsimg, &src_str);
nsAString_Finish(&src_str);
if(NS_FAILED(nsres))

View File

@ -143,7 +143,7 @@ static HRESULT WINAPI HTMLInputElement_put_value(IHTMLInputElement *iface, BSTR
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
nsAString_Init(&val_str, v);
nsAString_InitDepend(&val_str, v);
nsres = nsIDOMHTMLInputElement_SetValue(This->nsinput, &val_str);
nsAString_Finish(&val_str);
if(NS_FAILED(nsres))
@ -512,7 +512,7 @@ static HRESULT WINAPI HTMLInputElement_put_src(IHTMLInputElement *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
nsAString_Init(&nsstr, v);
nsAString_InitDepend(&nsstr, v);
nsres = nsIDOMHTMLInputElement_SetSrc(This->nsinput, &nsstr);
nsAString_Finish(&nsstr);
if(NS_FAILED(nsres))

View File

@ -645,7 +645,7 @@ static HRESULT WINAPI HTMLDOMNode_put_nodeValue(IHTMLDOMNode *iface, VARIANT v)
TRACE("bstr %s\n", debugstr_w(V_BSTR(&v)));
nsAString_Init(&val_str, V_BSTR(&v));
nsAString_InitDepend(&val_str, V_BSTR(&v));
nsIDOMNode_SetNodeValue(This->nsnode, &val_str);
nsAString_Finish(&val_str);

View File

@ -117,7 +117,7 @@ static HRESULT WINAPI HTMLOptionElement_put_value(IHTMLOptionElement *iface, BST
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
nsAString_Init(&value_str, v);
nsAString_InitDepend(&value_str, v);
nsres = nsIDOMHTMLOptionElement_SetValue(This->nsoption, &value_str);
nsAString_Finish(&value_str);
if(NS_FAILED(nsres))
@ -209,7 +209,7 @@ static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR
}
}
nsAString_Init(&text_str, v);
nsAString_InitDepend(&text_str, v);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->element.node.doc->nsdoc, &text_str, &text_node);
nsAString_Finish(&text_str);
if(NS_FAILED(nsres)) {

View File

@ -253,7 +253,7 @@ static HRESULT WINAPI HTMLSelectElement_put_value(IHTMLSelectElement *iface, BST
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
nsAString_Init(&value_str, v);
nsAString_InitDepend(&value_str, v);
nsres = nsIDOMHTMLSelectElement_SetValue(This->nsselect, &value_str);
nsAString_Finish(&value_str);
if(NS_FAILED(nsres))

View File

@ -694,7 +694,7 @@ static HRESULT WINAPI HTMLWindow2_put_name(IHTMLWindow2 *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
nsAString_Init(&name_str, v);
nsAString_InitDepend(&name_str, v);
nsres = nsIDOMWindow_SetName(This->nswindow, &name_str);
nsAString_Finish(&name_str);
if(NS_FAILED(nsres))

View File

@ -168,12 +168,12 @@ static BOOL handle_insert_comment(HTMLDocumentNode *doc, const PRUnichar *commen
memcpy(buf, ptr, (end-ptr)*sizeof(WCHAR));
buf[end-ptr] = 0;
nsAString_Init(&nsstr, buf);
heap_free(buf);
nsAString_InitDepend(&nsstr, buf);
/* FIXME: Find better way to insert HTML to document. */
nsres = nsIDOMHTMLDocument_Write(doc->nsdoc, &nsstr);
nsAString_Finish(&nsstr);
heap_free(buf);
if(NS_FAILED(nsres)) {
ERR("Write failed: %08x\n", nsres);
return FALSE;
@ -396,7 +396,7 @@ static nsresult NSAPI nsRunnable_Run(nsIRunnable *iface)
static const PRUnichar remove_comment_magicW[] =
{'#','!','w','i','n','e', 'r','e','m','o','v','e','!','#',0};
nsAString_Init(&magic_str, remove_comment_magicW);
nsAString_InitDepend(&magic_str, remove_comment_magicW);
nsres = nsIDOMComment_SetData(nscomment, &magic_str);
nsAString_Finish(&magic_str);
if(NS_FAILED(nsres))

View File

@ -426,7 +426,7 @@ static BOOL init_xpcom(const PRUnichar *gre_path)
nsAString path;
nsIFile *gre_dir;
nsAString_Init(&path, gre_path);
nsAString_InitDepend(&path, gre_path);
nsres = NS_NewLocalFile(&path, FALSE, &gre_dir);
nsAString_Finish(&path);
if(NS_FAILED(nsres)) {

View File

@ -316,7 +316,7 @@ static void init_event(nsIDOMEventTarget *target, const PRUnichar *type,
nsAString type_str;
nsresult nsres;
nsAString_Init(&type_str, type);
nsAString_InitDepend(&type_str, type);
nsres = nsIDOMEventTarget_AddEventListener(target, &type_str, listener, capture);
nsAString_Finish(&type_str);
if(NS_FAILED(nsres))

View File

@ -758,9 +758,9 @@ static BOOL get_script_guid(nsIDOMHTMLScriptElement *nsscript, GUID *guid)
ERR("GetType failed: %08x\n", nsres);
}
nsAString_Init(&attr_str, languageW);
nsAString_InitDepend(&attr_str, languageW);
nsres = nsIDOMHTMLScriptElement_GetAttribute(nsscript, &attr_str, &val_str);
nsAString_Finish(&attr_str);
if(NS_SUCCEEDED(nsres)) {
const PRUnichar *language;
@ -776,7 +776,6 @@ static BOOL get_script_guid(nsIDOMHTMLScriptElement *nsscript, GUID *guid)
ERR("GetAttribute(language) failed: %08x\n", nsres);
}
nsAString_Finish(&attr_str);
nsAString_Finish(&val_str);
return ret;

View File

@ -1141,7 +1141,7 @@ static HRESULT WINAPI HTMLTxtRange_put_text(IHTMLTxtRange *iface, BSTR v)
if(!This->doc)
return MSHTML_E_NODOC;
nsAString_Init(&text_str, v);
nsAString_InitDepend(&text_str, v);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc->nsdoc, &text_str, &text_node);
nsAString_Finish(&text_str);
if(NS_FAILED(nsres)) {