Jacek Caban : mshtml: Code clean up.

Alexandre Julliard julliard at winehq.org
Fri Aug 21 09:33:01 CDT 2009


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Aug 21 13:27:20 2009 +0200

mshtml: Code clean up.

---

 dlls/mshtml/nsembed.c |   70 +++++++++++++++++++++++--------------------------
 1 files changed, 33 insertions(+), 37 deletions(-)

diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c
index eadbfc7..41f762f 100644
--- a/dlls/mshtml/nsembed.c
+++ b/dlls/mshtml/nsembed.c
@@ -296,12 +296,38 @@ static BOOL load_wine_gecko(PRUnichar *gre_path)
     return ret;
 }
 
+static void set_bool_pref(nsIPrefBranch *pref, const char *pref_name, BOOL val)
+{
+    nsresult nsres;
+
+    nsres = nsIPrefBranch_SetBoolPref(pref, pref_name, val);
+    if(NS_FAILED(nsres))
+        ERR("Could not set pref %s\n", debugstr_a(pref_name));
+}
+
+static void set_int_pref(nsIPrefBranch *pref, const char *pref_name, int val)
+{
+    nsresult nsres;
+
+    nsres = nsIPrefBranch_SetIntPref(pref, pref_name, val);
+    if(NS_FAILED(nsres))
+        ERR("Could not set pref %s\n", debugstr_a(pref_name));
+}
+
+static void set_string_pref(nsIPrefBranch *pref, const char *pref_name, const char *val)
+{
+    nsresult nsres;
+
+    nsres = nsIPrefBranch_SetCharPref(pref, pref_name, val);
+    if(NS_FAILED(nsres))
+        ERR("Could not set pref %s\n", debugstr_a(pref_name));
+}
+
 static void set_lang(nsIPrefBranch *pref)
 {
     char langs[100];
     DWORD res, size, type;
     HKEY hkey;
-    nsresult nsres;
 
     static const WCHAR international_keyW[] =
         {'S','o','f','t','w','a','r','e',
@@ -321,9 +347,7 @@ static void set_lang(nsIPrefBranch *pref)
 
     TRACE("Setting lang %s\n", debugstr_a(langs));
 
-    nsres = nsIPrefBranch_SetCharPref(pref, "intl.accept_languages", langs);
-    if(NS_FAILED(nsres))
-        ERR("SetCharPref failed: %08x\n", nsres);
+    set_string_pref(pref, "intl.accept_languages", langs);
 }
 
 static void set_proxy(nsIPrefBranch *pref)
@@ -333,7 +357,6 @@ static void set_proxy(nsIPrefBranch *pref)
     int proxy_port_num;
     DWORD enabled = 0, res, size, type;
     HKEY hkey;
-    nsresult nsres;
 
     static const WCHAR proxy_keyW[] =
         {'S','o','f','t','w','a','r','e',
@@ -368,39 +391,12 @@ static void set_proxy(nsIPrefBranch *pref)
     proxy_port_num = atoi(proxy_port + 1);
     TRACE("Setting proxy to %s, port %d\n", debugstr_a(proxy), proxy_port_num);
 
-    nsres = nsIPrefBranch_SetIntPref(pref, "network.proxy.type", 1);
-    if(NS_FAILED(nsres))
-        ERR("SetIntPref network.proxy.type failed: %08x\n", nsres);
-    nsres = nsIPrefBranch_SetCharPref(pref, "network.proxy.http", proxy);
-    if(NS_FAILED(nsres))
-        ERR("SetCharPref network.proxy.http failed: %08x\n", nsres);
-    nsres = nsIPrefBranch_SetIntPref(pref, "network.proxy.http_port", proxy_port_num);
-    if(NS_FAILED(nsres))
-        ERR("SetIntPref network.proxy.http_port failed: %08x\n", nsres);
-    nsres = nsIPrefBranch_SetCharPref(pref, "network.proxy.ssl", proxy);
-    if(NS_FAILED(nsres))
-        ERR("SetCharPref network.proxy.ssl failed: %08x\n", nsres);
-    nsres = nsIPrefBranch_SetIntPref(pref, "network.proxy.ssl_port", proxy_port_num);
-    if(NS_FAILED(nsres))
-        ERR("SetIntPref network.proxy.ssl_port failed: %08x\n", nsres);
-}
-
-static void set_bool_pref(nsIPrefBranch *pref, const char *pref_name, BOOL val)
-{
-    nsresult nsres;
+    set_string_pref(pref, "network.proxy.http", proxy);
+    set_string_pref(pref, "network.proxy.ssl", proxy);
 
-    nsres = nsIPrefBranch_SetBoolPref(pref, pref_name, val);
-    if(NS_FAILED(nsres))
-        ERR("Could not set pref %s\n", debugstr_a(pref_name));
-}
-
-static void set_int_pref(nsIPrefBranch *pref, const char *pref_name, int val)
-{
-    nsresult nsres;
-
-    nsres = nsIPrefBranch_SetIntPref(pref, pref_name, val);
-    if(NS_FAILED(nsres))
-        ERR("Could not set pref %s\n", debugstr_a(pref_name));
+    set_int_pref(pref, "network.proxy.type", 1);
+    set_int_pref(pref, "network.proxy.http_port", proxy_port_num);
+    set_int_pref(pref, "network.proxy.ssl_port", proxy_port_num);
 }
 
 static void set_preferences(void)




More information about the wine-cvs mailing list