Jacek Caban : mshtml: Fixed nsAString handling in navigate_anchor.

Alexandre Julliard julliard at winehq.org
Fri Aug 5 10:20:49 CDT 2011


Module: wine
Branch: master
Commit: 88f9fcf1f42c2c03dbf3e5ea9c71ed9ed3f7ea5d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=88f9fcf1f42c2c03dbf3e5ea9c71ed9ed3f7ea5d

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Aug  5 10:20:08 2011 +0200

mshtml: Fixed nsAString handling in navigate_anchor.

---

 dlls/mshtml/htmlanchor.c |   43 ++++++++++++++++++++++---------------------
 1 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c
index 9bf74b2..c369ed5 100644
--- a/dlls/mshtml/htmlanchor.c
+++ b/dlls/mshtml/htmlanchor.c
@@ -44,36 +44,37 @@ typedef struct {
 static HRESULT navigate_anchor(HTMLAnchorElement *This)
 {
     nsAString href_str, target_str;
-    const PRUnichar *href, *target;
     nsresult nsres;
     HRESULT hres;
 
+    nsAString_Init(&target_str, NULL);
     nsres = nsIDOMHTMLAnchorElement_GetTarget(This->nsanchor, &target_str);
-    if(NS_FAILED(nsres))
-        return E_FAIL;
-
-    nsAString_GetData(&target_str, &target);
-    if(*target) {
-        FIXME("Navigating to target %s is not implemented\n", debugstr_w(target));
-        nsAString_Finish(&target_str);
-        return S_OK;
+    if(NS_SUCCEEDED(nsres)) {
+        const PRUnichar *target;
+
+        nsAString_GetData(&target_str, &target);
+        if(*target) {
+            FIXME("Navigating to target %s is not implemented\n", debugstr_w(target));
+            nsAString_Finish(&target_str);
+            return S_OK;
+        }
     }
-
     nsAString_Finish(&target_str);
 
+    nsAString_Init(&href_str, NULL);
     nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str);
-    if(NS_FAILED(nsres))
-        return E_FAIL;
+    if(NS_SUCCEEDED(nsres)) {
+        const PRUnichar *href;
 
-    nsAString_GetData(&href_str, &href);
-    if(*href) {
-        HTMLWindow *window = This->element.node.doc->basedoc.window;
-        hres = navigate_url(window, href, window->url);
-    }else {
-        TRACE("empty href\n");
-        hres = S_OK;
+        nsAString_GetData(&href_str, &href);
+        if(*href) {
+            HTMLWindow *window = This->element.node.doc->basedoc.window;
+            hres = navigate_url(window, href, window->url);
+        }else {
+            TRACE("empty href\n");
+            hres = S_OK;
+        }
     }
-
     nsAString_Finish(&href_str);
     return hres;
 }




More information about the wine-cvs mailing list