Nikolay Sivov : qmgr: Implement AddFile() with AddFileSet().
Alexandre Julliard
julliard at winehq.org
Wed Dec 4 14:43:34 CST 2013
Module: wine
Branch: master
Commit: 5cbd28aa5128a1b35e21a94825b0659542b186f6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5cbd28aa5128a1b35e21a94825b0659542b186f6
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue Dec 3 23:30:32 2013 +0400
qmgr: Implement AddFile() with AddFileSet().
---
dlls/qmgr/job.c | 46 ++++++++++++++++++++++++----------------------
1 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/dlls/qmgr/job.c b/dlls/qmgr/job.c
index fdbf234..419ec09 100644
--- a/dlls/qmgr/job.c
+++ b/dlls/qmgr/job.c
@@ -95,18 +95,33 @@ static HRESULT WINAPI BackgroundCopyJob_AddFileSet(
BG_FILE_INFO *pFileSet)
{
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
+ HRESULT hr = S_OK;
ULONG i;
TRACE("(%p)->(%d %p)\n", This, cFileCount, pFileSet);
+ EnterCriticalSection(&This->cs);
+
for (i = 0; i < cFileCount; ++i)
{
- HRESULT hr = IBackgroundCopyJob2_AddFile(iface, pFileSet[i].RemoteName,
- pFileSet[i].LocalName);
- if (FAILED(hr))
- return hr;
+ BackgroundCopyFileImpl *file;
+
+ /* We should return E_INVALIDARG in these cases. */
+ FIXME("Check for valid filenames and supported protocols\n");
+
+ hr = BackgroundCopyFileConstructor(This, pFileSet[i].RemoteName, pFileSet[i].LocalName, &file);
+ if (hr != S_OK) break;
+
+ /* Add a reference to the file to file list */
+ IBackgroundCopyFile_AddRef(&file->IBackgroundCopyFile_iface);
+ list_add_head(&This->files, &file->entryFromJob);
+ This->jobProgress.BytesTotal = BG_SIZE_UNKNOWN;
+ ++This->jobProgress.FilesTotal;
}
- return S_OK;
+
+ LeaveCriticalSection(&This->cs);
+
+ return hr;
}
static HRESULT WINAPI BackgroundCopyJob_AddFile(
@@ -115,26 +130,13 @@ static HRESULT WINAPI BackgroundCopyJob_AddFile(
LPCWSTR LocalName)
{
BackgroundCopyJobImpl *This = impl_from_IBackgroundCopyJob2(iface);
- BackgroundCopyFileImpl *file;
- HRESULT res;
+ BG_FILE_INFO file;
TRACE("(%p)->(%s %s)\n", This, debugstr_w(RemoteUrl), debugstr_w(LocalName));
- /* We should return E_INVALIDARG in these cases. */
- FIXME("Check for valid filenames and supported protocols\n");
-
- res = BackgroundCopyFileConstructor(This, RemoteUrl, LocalName, &file);
- if (res != S_OK)
- return res;
- /* Add a reference to the file to file list */
- IBackgroundCopyFile_AddRef(&file->IBackgroundCopyFile_iface);
- EnterCriticalSection(&This->cs);
- list_add_head(&This->files, &file->entryFromJob);
- This->jobProgress.BytesTotal = BG_SIZE_UNKNOWN;
- ++This->jobProgress.FilesTotal;
- LeaveCriticalSection(&This->cs);
-
- return S_OK;
+ file.RemoteName = (LPWSTR)RemoteUrl;
+ file.LocalName = (LPWSTR)LocalName;
+ return IBackgroundCopyJob2_AddFileSet(iface, 1, &file);
}
static HRESULT WINAPI BackgroundCopyJob_EnumFiles(
More information about the wine-cvs
mailing list