Commit 2952c637 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

wininet: Get rid of no longer needed get_avail_data from data stream implementations.

parent 295291b4
...@@ -381,7 +381,6 @@ static WCHAR *get_host_header( http_request_t *req ) ...@@ -381,7 +381,6 @@ static WCHAR *get_host_header( http_request_t *req )
} }
struct data_stream_vtbl_t { struct data_stream_vtbl_t {
DWORD (*get_avail_data)(data_stream_t*,http_request_t*);
BOOL (*end_of_data)(data_stream_t*,http_request_t*); BOOL (*end_of_data)(data_stream_t*,http_request_t*);
DWORD (*read)(data_stream_t*,http_request_t*,BYTE*,DWORD,DWORD*,BOOL); DWORD (*read)(data_stream_t*,http_request_t*,BYTE*,DWORD,DWORD*,BOOL);
BOOL (*drain_content)(data_stream_t*,http_request_t*); BOOL (*drain_content)(data_stream_t*,http_request_t*);
...@@ -440,12 +439,6 @@ typedef struct { ...@@ -440,12 +439,6 @@ typedef struct {
BOOL end_of_data; BOOL end_of_data;
} gzip_stream_t; } gzip_stream_t;
static DWORD gzip_get_avail_data(data_stream_t *stream, http_request_t *req)
{
/* Allow reading only from read buffer */
return 0;
}
static BOOL gzip_end_of_data(data_stream_t *stream, http_request_t *req) static BOOL gzip_end_of_data(data_stream_t *stream, http_request_t *req)
{ {
gzip_stream_t *gzip_stream = (gzip_stream_t*)stream; gzip_stream_t *gzip_stream = (gzip_stream_t*)stream;
...@@ -534,7 +527,6 @@ static void gzip_destroy(data_stream_t *stream) ...@@ -534,7 +527,6 @@ static void gzip_destroy(data_stream_t *stream)
} }
static const data_stream_vtbl_t gzip_stream_vtbl = { static const data_stream_vtbl_t gzip_stream_vtbl = {
gzip_get_avail_data,
gzip_end_of_data, gzip_end_of_data,
gzip_read, gzip_read,
gzip_drain_content, gzip_drain_content,
...@@ -2614,18 +2606,6 @@ static DWORD refill_read_buffer(http_request_t *req, BOOL allow_blocking, DWORD ...@@ -2614,18 +2606,6 @@ static DWORD refill_read_buffer(http_request_t *req, BOOL allow_blocking, DWORD
return res; return res;
} }
static DWORD netconn_get_avail_data(data_stream_t *stream, http_request_t *req)
{
netconn_stream_t *netconn_stream = (netconn_stream_t*)stream;
DWORD avail = 0;
if(is_valid_netconn(req->netconn))
NETCON_query_data_available(req->netconn, &avail);
return netconn_stream->content_length == ~0u
? avail
: min(avail, netconn_stream->content_length-netconn_stream->content_read);
}
static BOOL netconn_end_of_data(data_stream_t *stream, http_request_t *req) static BOOL netconn_end_of_data(data_stream_t *stream, http_request_t *req)
{ {
netconn_stream_t *netconn_stream = (netconn_stream_t*)stream; netconn_stream_t *netconn_stream = (netconn_stream_t*)stream;
...@@ -2682,7 +2662,6 @@ static void netconn_destroy(data_stream_t *stream) ...@@ -2682,7 +2662,6 @@ static void netconn_destroy(data_stream_t *stream)
} }
static const data_stream_vtbl_t netconn_stream_vtbl = { static const data_stream_vtbl_t netconn_stream_vtbl = {
netconn_get_avail_data,
netconn_end_of_data, netconn_end_of_data,
netconn_read, netconn_read,
netconn_drain_content, netconn_drain_content,
...@@ -2839,26 +2818,6 @@ static DWORD chunked_read(data_stream_t *stream, http_request_t *req, BYTE *buf, ...@@ -2839,26 +2818,6 @@ static DWORD chunked_read(data_stream_t *stream, http_request_t *req, BYTE *buf,
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static DWORD chunked_get_avail_data(data_stream_t *stream, http_request_t *req)
{
chunked_stream_t *chunked_stream = (chunked_stream_t*)stream;
DWORD avail = 0;
if(chunked_stream->state != CHUNKED_STREAM_STATE_READING_CHUNK) {
DWORD res, read;
/* try to process to the next chunk */
res = chunked_read(stream, req, NULL, 0, &read, FALSE);
if(res != ERROR_SUCCESS || chunked_stream->state != CHUNKED_STREAM_STATE_READING_CHUNK)
return 0;
}
if(is_valid_netconn(req->netconn) && chunked_stream->buf_size < chunked_stream->chunk_size)
NETCON_query_data_available(req->netconn, &avail);
return min(avail + chunked_stream->buf_size, chunked_stream->chunk_size);
}
static BOOL chunked_drain_content(data_stream_t *stream, http_request_t *req) static BOOL chunked_drain_content(data_stream_t *stream, http_request_t *req)
{ {
chunked_stream_t *chunked_stream = (chunked_stream_t*)stream; chunked_stream_t *chunked_stream = (chunked_stream_t*)stream;
...@@ -2872,7 +2831,6 @@ static void chunked_destroy(data_stream_t *stream) ...@@ -2872,7 +2831,6 @@ static void chunked_destroy(data_stream_t *stream)
} }
static const data_stream_vtbl_t chunked_stream_vtbl = { static const data_stream_vtbl_t chunked_stream_vtbl = {
chunked_get_avail_data,
chunked_end_of_data, chunked_end_of_data,
chunked_read, chunked_read,
chunked_drain_content, chunked_drain_content,
......
...@@ -454,7 +454,6 @@ DWORD NETCON_secure_connect(netconn_t*,server_t*) DECLSPEC_HIDDEN; ...@@ -454,7 +454,6 @@ DWORD NETCON_secure_connect(netconn_t*,server_t*) DECLSPEC_HIDDEN;
DWORD NETCON_send(netconn_t *connection, const void *msg, size_t len, int flags, DWORD NETCON_send(netconn_t *connection, const void *msg, size_t len, int flags,
int *sent /* out */) DECLSPEC_HIDDEN; int *sent /* out */) DECLSPEC_HIDDEN;
DWORD NETCON_recv(netconn_t*,void*,size_t,BOOL,int*) DECLSPEC_HIDDEN; DWORD NETCON_recv(netconn_t*,void*,size_t,BOOL,int*) DECLSPEC_HIDDEN;
BOOL NETCON_query_data_available(netconn_t *connection, DWORD *available) DECLSPEC_HIDDEN;
BOOL NETCON_is_alive(netconn_t*) DECLSPEC_HIDDEN; BOOL NETCON_is_alive(netconn_t*) DECLSPEC_HIDDEN;
LPCVOID NETCON_GetCert(netconn_t *connection) DECLSPEC_HIDDEN; LPCVOID NETCON_GetCert(netconn_t *connection) DECLSPEC_HIDDEN;
int NETCON_GetCipherStrength(netconn_t*) DECLSPEC_HIDDEN; int NETCON_GetCipherStrength(netconn_t*) DECLSPEC_HIDDEN;
......
...@@ -869,32 +869,6 @@ DWORD NETCON_recv(netconn_t *connection, void *buf, size_t len, BOOL blocking, i ...@@ -869,32 +869,6 @@ DWORD NETCON_recv(netconn_t *connection, void *buf, size_t len, BOOL blocking, i
} }
} }
/******************************************************************************
* NETCON_query_data_available
* Returns the number of bytes of peeked data plus the number of bytes of
* queued, but unread data.
*/
BOOL NETCON_query_data_available(netconn_t *connection, DWORD *available)
{
*available = 0;
if(!connection->secure)
{
ULONG unread;
int retval = ioctlsocket(connection->socket, FIONREAD, &unread);
if (!retval)
{
TRACE("%d bytes of queued, but unread data\n", unread);
*available += unread;
}
}
else
{
*available = connection->peek_len;
}
return TRUE;
}
BOOL NETCON_is_alive(netconn_t *netconn) BOOL NETCON_is_alive(netconn_t *netconn)
{ {
int len; int len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment