Nikolay Sivov : qmgr: Implement IBackgroundCopyJob::GetDescription().

Alexandre Julliard julliard at winehq.org
Mon Nov 25 13:33:15 CST 2013


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Nov 25 10:42:50 2013 +0400

qmgr: Implement IBackgroundCopyJob::GetDescription().

---

 dlls/qmgr/job.c |   35 ++++++++++++++++++++++++-----------
 1 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/dlls/qmgr/job.c b/dlls/qmgr/job.c
index a395ec6..d66ccc7 100644
--- a/dlls/qmgr/job.c
+++ b/dlls/qmgr/job.c
@@ -34,6 +34,23 @@ static inline BOOL is_job_done(const BackgroundCopyJobImpl *job)
     return job->state == BG_JOB_STATE_CANCELLED || job->state == BG_JOB_STATE_ACKNOWLEDGED;
 }
 
+static HRESULT return_strval(const WCHAR *str, WCHAR **ret)
+{
+    int len;
+
+    if (!ret) return E_INVALIDARG;
+
+    len = strlenW(str);
+    *ret = CoTaskMemAlloc((len+1)*sizeof(WCHAR));
+    if (!*ret) return E_OUTOFMEMORY;
+
+    if (len)
+        strcpyW(*ret, str);
+    else
+        **ret = 0;
+    return S_OK;
+}
+
 static inline BackgroundCopyJobImpl *impl_from_IBackgroundCopyJob2(IBackgroundCopyJob2 *iface)
 {
     return CONTAINING_RECORD(iface, BackgroundCopyJobImpl, IBackgroundCopyJob2_iface);
@@ -313,17 +330,10 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetDisplayName(
     LPWSTR *pVal)
 {
     BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
-    int n;
 
-    if (!pVal)
-        return E_INVALIDARG;
+    TRACE("(%p)->(%p)\n", This, pVal);
 
-    n = (strlenW(This->displayName) + 1) * sizeof **pVal;
-    *pVal = CoTaskMemAlloc(n);
-    if (*pVal == NULL)
-        return E_OUTOFMEMORY;
-    memcpy(*pVal, This->displayName, n);
-    return S_OK;
+    return return_strval(This->displayName, pVal);
 }
 
 static HRESULT WINAPI BITS_IBackgroundCopyJob_SetDescription(
@@ -366,8 +376,11 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetDescription(
     IBackgroundCopyJob2 *iface,
     LPWSTR *pVal)
 {
-    FIXME("Not implemented\n");
-    return E_NOTIMPL;
+    BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
+
+    TRACE("(%p)->(%p)\n", This, pVal);
+
+    return return_strval(This->description, pVal);
 }
 
 static HRESULT WINAPI BITS_IBackgroundCopyJob_SetPriority(




More information about the wine-cvs mailing list