qmgr: Use helper to return string value for File.
This commit is contained in:
parent
05396f18e4
commit
c132ed8d5b
|
@ -94,14 +94,10 @@ static HRESULT WINAPI BITS_IBackgroundCopyFile_GetRemoteName(
|
||||||
LPWSTR *pVal)
|
LPWSTR *pVal)
|
||||||
{
|
{
|
||||||
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
|
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
|
||||||
int n = (lstrlenW(This->info.RemoteName) + 1) * sizeof(WCHAR);
|
|
||||||
|
|
||||||
*pVal = CoTaskMemAlloc(n);
|
TRACE("(%p)->(%p)\n", This, pVal);
|
||||||
if (!*pVal)
|
|
||||||
return E_OUTOFMEMORY;
|
|
||||||
|
|
||||||
memcpy(*pVal, This->info.RemoteName, n);
|
return return_strval(This->info.RemoteName, pVal);
|
||||||
return S_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI BITS_IBackgroundCopyFile_GetLocalName(
|
static HRESULT WINAPI BITS_IBackgroundCopyFile_GetLocalName(
|
||||||
|
@ -109,14 +105,10 @@ static HRESULT WINAPI BITS_IBackgroundCopyFile_GetLocalName(
|
||||||
LPWSTR *pVal)
|
LPWSTR *pVal)
|
||||||
{
|
{
|
||||||
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
|
BackgroundCopyFileImpl *This = impl_from_IBackgroundCopyFile(iface);
|
||||||
int n = (lstrlenW(This->info.LocalName) + 1) * sizeof(WCHAR);
|
|
||||||
|
|
||||||
*pVal = CoTaskMemAlloc(n);
|
TRACE("(%p)->(%p)\n", This, pVal);
|
||||||
if (!*pVal)
|
|
||||||
return E_OUTOFMEMORY;
|
|
||||||
|
|
||||||
memcpy(*pVal, This->info.LocalName, n);
|
return return_strval(This->info.LocalName, pVal);
|
||||||
return S_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI BITS_IBackgroundCopyFile_GetProgress(
|
static HRESULT WINAPI BITS_IBackgroundCopyFile_GetProgress(
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
|
|
||||||
#include "qmgr.h"
|
#include "qmgr.h"
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#include "wine/unicode.h"
|
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
|
WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
|
||||||
|
|
||||||
|
@ -34,23 +33,6 @@ static inline BOOL is_job_done(const BackgroundCopyJobImpl *job)
|
||||||
return job->state == BG_JOB_STATE_CANCELLED || job->state == BG_JOB_STATE_ACKNOWLEDGED;
|
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)
|
static inline BackgroundCopyJobImpl *impl_from_IBackgroundCopyJob2(IBackgroundCopyJob2 *iface)
|
||||||
{
|
{
|
||||||
return CONTAINING_RECORD(iface, BackgroundCopyJobImpl, IBackgroundCopyJob2_iface);
|
return CONTAINING_RECORD(iface, BackgroundCopyJobImpl, IBackgroundCopyJob2_iface);
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "wine/list.h"
|
#include "wine/list.h"
|
||||||
|
#include "wine/unicode.h"
|
||||||
|
|
||||||
/* Background copy job vtbl and related data */
|
/* Background copy job vtbl and related data */
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -100,6 +101,19 @@ qmgr_strdup(const char *s)
|
||||||
return d ? memcpy(d, s, n) : NULL;
|
return d ? memcpy(d, s, n) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline 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;
|
||||||
|
strcpyW(*ret, str);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static inline BOOL
|
static inline BOOL
|
||||||
transitionJobState(BackgroundCopyJobImpl *job, BG_JOB_STATE fromState,
|
transitionJobState(BackgroundCopyJobImpl *job, BG_JOB_STATE fromState,
|
||||||
BG_JOB_STATE toState)
|
BG_JOB_STATE toState)
|
||||||
|
|
Loading…
Reference in New Issue