Hans Leidekker : qmgr: Job error codes are HRESULT values.
Alexandre Julliard
julliard at winehq.org
Wed Sep 14 10:28:52 CDT 2016
Module: wine
Branch: master
Commit: ec6a17fa9c4dd816bbfe0a21a68d4fbdb734d9ef
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ec6a17fa9c4dd816bbfe0a21a68d4fbdb734d9ef
Author: Hans Leidekker <hans at codeweavers.com>
Date: Wed Sep 14 10:06:11 2016 +0200
qmgr: Job error codes are HRESULT values.
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/qmgr/file.c | 12 ++++++------
dlls/qmgr/job.c | 5 +++--
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/dlls/qmgr/file.c b/dlls/qmgr/file.c
index cdea329..3673ede 100644
--- a/dlls/qmgr/file.c
+++ b/dlls/qmgr/file.c
@@ -201,7 +201,7 @@ HRESULT BackgroundCopyFileConstructor(BackgroundCopyJobImpl *owner,
return S_OK;
}
-static HRESULT error_from_http_response(DWORD code)
+static HRESULT hresult_from_http_response(DWORD code)
{
switch (code)
{
@@ -239,7 +239,7 @@ static void CALLBACK progress_callback_http(HINTERNET handle, DWORD_PTR context,
if (WinHttpQueryHeaders(handle, WINHTTP_QUERY_STATUS_CODE|WINHTTP_QUERY_FLAG_NUMBER,
NULL, &code, &size, NULL))
{
- if ((job->error.code = error_from_http_response(code)))
+ if ((job->error.code = hresult_from_http_response(code)))
{
EnterCriticalSection(&job->cs);
@@ -281,7 +281,7 @@ static void CALLBACK progress_callback_http(HINTERNET handle, DWORD_PTR context,
case WINHTTP_CALLBACK_STATUS_REQUEST_ERROR:
{
WINHTTP_ASYNC_RESULT *result = (WINHTTP_ASYNC_RESULT *)buf;
- job->error.code = result->dwError;
+ job->error.code = HRESULT_FROM_WIN32(result->dwError);
transitionJobState(job, BG_JOB_STATE_TRANSFERRING, BG_JOB_STATE_ERROR);
break;
}
@@ -386,10 +386,10 @@ static BOOL transfer_file_http(BackgroundCopyFileImpl *file, URL_COMPONENTSW *uc
if (!set_request_credentials(req, job)) goto done;
if (!(WinHttpSendRequest(req, job->http_options.headers, ~0u, NULL, 0, 0, (DWORD_PTR)file))) goto done;
- if (wait_for_completion(job) || job->error.code) goto done;
+ if (wait_for_completion(job) || FAILED(job->error.code)) goto done;
if (!(WinHttpReceiveResponse(req, NULL))) goto done;
- if (wait_for_completion(job) || job->error.code) goto done;
+ if (wait_for_completion(job) || FAILED(job->error.code)) goto done;
transitionJobState(job, BG_JOB_STATE_CONNECTING, BG_JOB_STATE_TRANSFERRING);
@@ -400,7 +400,7 @@ static BOOL transfer_file_http(BackgroundCopyFileImpl *file, URL_COMPONENTSW *uc
{
file->read_size = 0;
if (!(ret = WinHttpReadData(req, buf, sizeof(buf), NULL))) break;
- if (wait_for_completion(job) || job->error.code)
+ if (wait_for_completion(job) || FAILED(job->error.code))
{
ret = FALSE;
break;
diff --git a/dlls/qmgr/job.c b/dlls/qmgr/job.c
index 33e3bd2..a12e511 100644
--- a/dlls/qmgr/job.c
+++ b/dlls/qmgr/job.c
@@ -371,7 +371,8 @@ static HRESULT WINAPI BackgroundCopyJob_Resume(
&& This->state != BG_JOB_STATE_TRANSFERRING)
{
This->state = BG_JOB_STATE_QUEUED;
- This->error.context = This->error.code = 0;
+ This->error.context = 0;
+ This->error.code = S_OK;
if (This->error.file)
{
IBackgroundCopyFile2_Release(This->error.file);
@@ -1245,7 +1246,7 @@ HRESULT BackgroundCopyJobConstructor(LPCWSTR displayName, BG_JOB_TYPE type, GUID
This->callback2 = FALSE;
This->error.context = 0;
- This->error.code = 0;
+ This->error.code = S_OK;
This->error.file = NULL;
memset(&This->http_options, 0, sizeof(This->http_options));
More information about the wine-cvs
mailing list