wininet: Moved WORKREQ_HTTPREADFILEEX out of WORKREQUEST.

This commit is contained in:
Jacek Caban 2013-01-28 11:23:58 +01:00 committed by Alexandre Julliard
parent df74951257
commit 023abdacdb
2 changed files with 17 additions and 19 deletions

View File

@ -2877,16 +2877,22 @@ static DWORD HTTPREQ_ReadFile(object_header_t *hdr, void *buffer, DWORD size, DW
return res; return res;
} }
static void AsyncReadFileExProc(WORKREQUEST *workRequest) typedef struct {
task_header_t hdr;
void *buf;
DWORD size;
DWORD *ret_read;
} read_file_ex_task_t;
static void AsyncReadFileExProc(task_header_t *hdr)
{ {
struct WORKREQ_HTTPREADFILEEX const *data = &workRequest->u.HttpReadFileEx; read_file_ex_task_t *task = (read_file_ex_task_t*)hdr;
http_request_t *req = (http_request_t*)workRequest->hdr; http_request_t *req = (http_request_t*)task->hdr.hdr;
DWORD res; DWORD res;
TRACE("INTERNETREADFILEEXW %p\n", workRequest->hdr); TRACE("INTERNETREADFILEEXW %p\n", task->hdr.hdr);
res = HTTPREQ_Read(req, data->buf, data->size, data->ret_read, TRUE);
res = HTTPREQ_Read(req, task->buf, task->size, task->ret_read, TRUE);
send_request_complete(req, res == ERROR_SUCCESS, res); send_request_complete(req, res == ERROR_SUCCESS, res);
} }
@ -2904,7 +2910,7 @@ static DWORD HTTPREQ_ReadFileEx(object_header_t *hdr, void *buf, DWORD size, DWO
if (hdr->dwFlags & INTERNET_FLAG_ASYNC) if (hdr->dwFlags & INTERNET_FLAG_ASYNC)
{ {
WORKREQUEST *task; read_file_ex_task_t *task;
if (TryEnterCriticalSection( &req->read_section )) if (TryEnterCriticalSection( &req->read_section ))
{ {
@ -2918,11 +2924,11 @@ static DWORD HTTPREQ_ReadFileEx(object_header_t *hdr, void *buf, DWORD size, DWO
} }
task = alloc_async_task(&req->hdr, AsyncReadFileExProc, sizeof(*task)); task = alloc_async_task(&req->hdr, AsyncReadFileExProc, sizeof(*task));
task->u.HttpReadFileEx.buf = buf; task->buf = buf;
task->u.HttpReadFileEx.size = size; task->size = size;
task->u.HttpReadFileEx.ret_read = ret_read; task->ret_read = ret_read;
INTERNET_AsyncCall(task); INTERNET_AsyncCall(&task->hdr);
return ERROR_IO_PENDING; return ERROR_IO_PENDING;
} }

View File

@ -441,13 +441,6 @@ struct WORKREQ_SENDCALLBACK
DWORD dwStatusInfoLength; DWORD dwStatusInfoLength;
}; };
struct WORKREQ_HTTPREADFILEEX
{
void *buf;
DWORD size;
DWORD *ret_read;
};
typedef struct WORKREQ task_header_t; typedef struct WORKREQ task_header_t;
typedef void (*async_task_proc_t)(task_header_t*); typedef void (*async_task_proc_t)(task_header_t*);
@ -470,7 +463,6 @@ typedef struct WORKREQ
struct WORKREQ_FTPFINDNEXTW FtpFindNextW; struct WORKREQ_FTPFINDNEXTW FtpFindNextW;
struct WORKREQ_HTTPENDREQUESTW HttpEndRequestW; struct WORKREQ_HTTPENDREQUESTW HttpEndRequestW;
struct WORKREQ_SENDCALLBACK SendCallback; struct WORKREQ_SENDCALLBACK SendCallback;
struct WORKREQ_HTTPREADFILEEX HttpReadFileEx;
} u; } u;
} WORKREQUEST, *LPWORKREQUEST; } WORKREQUEST, *LPWORKREQUEST;