Andrew Eikum : hlink: Set hlink' s location to NULL if the empty string is given.

Alexandre Julliard julliard at winehq.org
Wed Mar 17 12:19:05 CDT 2010


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

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Tue Mar 16 14:52:01 2010 -0500

hlink: Set hlink's location to NULL if the empty string is given.

---

 dlls/hlink/link.c        |    4 +++-
 dlls/hlink/tests/hlink.c |    6 +++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/dlls/hlink/link.c b/dlls/hlink/link.c
index 52197cc..ffd3cda 100644
--- a/dlls/hlink/link.c
+++ b/dlls/hlink/link.c
@@ -291,7 +291,9 @@ static HRESULT WINAPI IHlink_fnSetStringReference(IHlink* iface,
     if (grfHLSETF & HLINKSETF_LOCATION)
     {
         heap_free(This->Location);
-        This->Location = hlink_strdupW( pwzLocation );
+        This->Location = NULL;
+        if (pwzLocation && *pwzLocation)
+            This->Location = hlink_strdupW( pwzLocation );
     }
 
     return S_OK;
diff --git a/dlls/hlink/tests/hlink.c b/dlls/hlink/tests/hlink.c
index 30b06f0..28c0c9a 100644
--- a/dlls/hlink/tests/hlink.c
+++ b/dlls/hlink/tests/hlink.c
@@ -1272,12 +1272,12 @@ static void r_getStringRef(unsigned line, IHlink *hlink, const WCHAR *exp_tgt, c
     if(exp_tgt)
         ok_(__FILE__,line) (!lstrcmpW(fnd_tgt, exp_tgt), "Found string target should have been %s, was: %s\n", wine_dbgstr_w(exp_tgt), wine_dbgstr_w(fnd_tgt));
     else
-        ok_(__FILE__,line) (exp_tgt == NULL, "Found string target should have been NULL, was: %s\n", wine_dbgstr_w(fnd_tgt));
+        ok_(__FILE__,line) (fnd_tgt == NULL, "Found string target should have been NULL, was: %s\n", wine_dbgstr_w(fnd_tgt));
 
     if(exp_loc)
         ok_(__FILE__,line) (!lstrcmpW(fnd_loc, exp_loc), "Found string location should have been %s, was: %s\n", wine_dbgstr_w(exp_loc), wine_dbgstr_w(fnd_loc));
     else
-        ok_(__FILE__,line) (exp_loc == NULL, "Found string location should have been NULL, was: %s\n", wine_dbgstr_w(fnd_loc));
+        ok_(__FILE__,line) (fnd_loc == NULL, "Found string location should have been NULL, was: %s\n", wine_dbgstr_w(fnd_loc));
 
     CoTaskMemFree(fnd_tgt);
     CoTaskMemFree(fnd_loc);
@@ -1305,7 +1305,7 @@ static IMoniker *r_getMonikerRef(unsigned line, IHlink *hlink, IMoniker *exp_tgt
     if(exp_loc)
         ok_(__FILE__,line) (!lstrcmpW(fnd_loc, exp_loc), "Found string location should have been %s, was: %s\n", wine_dbgstr_w(exp_loc), wine_dbgstr_w(fnd_loc));
     else
-        ok_(__FILE__,line) (exp_loc == NULL, "Found string location should have been NULL, was: %s\n", wine_dbgstr_w(fnd_loc));
+        ok_(__FILE__,line) (fnd_loc == NULL, "Found string location should have been NULL, was: %s\n", wine_dbgstr_w(fnd_loc));
 
     CoTaskMemFree(fnd_loc);
 




More information about the wine-cvs mailing list