Sebastian Lackner : combase: Simplify NULL pointer check in WindowsCreateString[Reference].

Alexandre Julliard julliard at wine.codeweavers.com
Mon Oct 26 09:58:34 CDT 2015


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

Author: Sebastian Lackner <sebastian at fds-team.de>
Date:   Sun Oct 25 15:32:26 2015 +0100

combase: Simplify NULL pointer check in WindowsCreateString[Reference].

Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/combase/string.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/combase/string.c b/dlls/combase/string.c
index 53a32c9..2146d61 100644
--- a/dlls/combase/string.c
+++ b/dlls/combase/string.c
@@ -79,13 +79,13 @@ HRESULT WINAPI WindowsCreateString(LPCWSTR ptr, UINT32 len,
 
     if (out == NULL)
         return E_INVALIDARG;
-    if (ptr == NULL && len > 0)
-        return E_POINTER;
     if (len == 0)
     {
         *out = NULL;
         return S_OK;
     }
+    if (ptr == NULL)
+        return E_POINTER;
     if (!alloc_string(len, out))
         return E_OUTOFMEMORY;
     priv = impl_from_HSTRING(*out);
@@ -105,13 +105,13 @@ HRESULT WINAPI WindowsCreateStringReference(LPCWSTR ptr, UINT32 len,
 
     if (out == NULL || header == NULL)
         return E_INVALIDARG;
-    if (ptr == NULL && len > 0)
-        return E_POINTER;
     if (len == 0)
     {
         *out = NULL;
         return S_OK;
     }
+    if (ptr == NULL)
+        return E_POINTER;
     if (ptr[len] != '\0')
         return E_INVALIDARG;
     priv->buffer = (LPWSTR)ptr;




More information about the wine-cvs mailing list