qmgr: Job error codes are HRESULT values.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2016-09-14 10:06:11 +02:00 committed by Alexandre Julliard
parent 13af267e75
commit ec6a17fa9c
2 changed files with 9 additions and 8 deletions

View file

@ -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;

View file

@ -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));