Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
a124d74c
Commit
a124d74c
authored
Feb 15, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 15, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
urlmon: Get rid of no longer needed buffering in stgmed_buf_t.
parent
8bee20d8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
53 deletions
+8
-53
binding.c
dlls/urlmon/binding.c
+8
-53
No files found.
dlls/urlmon/binding.c
View file @
a124d74c
...
...
@@ -34,8 +34,6 @@ typedef struct {
IInternetProtocolEx
*
protocol
;
BYTE
buf
[
1024
*
8
];
DWORD
size
;
HANDLE
file
;
HRESULT
hres
;
...
...
@@ -103,28 +101,12 @@ typedef struct {
CRITICAL_SECTION
section
;
}
Binding
;
static
void
fill_stgmed_buffer
(
stgmed_buf_t
*
buf
)
{
DWORD
read
=
0
;
if
(
sizeof
(
buf
->
buf
)
==
buf
->
size
)
return
;
buf
->
hres
=
IInternetProtocol_Read
(
buf
->
protocol
,
buf
->
buf
+
buf
->
size
,
sizeof
(
buf
->
buf
)
-
buf
->
size
,
&
read
);
buf
->
size
+=
read
;
}
static
void
read_protocol_data
(
stgmed_buf_t
*
stgmed_buf
)
{
BYTE
buf
[
8192
];
DWORD
read
;
HRESULT
hres
;
fill_stgmed_buffer
(
stgmed_buf
);
if
(
stgmed_buf
->
size
<
sizeof
(
stgmed_buf
->
buf
))
return
;
do
hres
=
IInternetProtocol_Read
(
stgmed_buf
->
protocol
,
buf
,
sizeof
(
buf
),
&
read
);
while
(
hres
==
S_OK
);
}
...
...
@@ -412,7 +394,6 @@ static stgmed_buf_t *create_stgmed_buf(IInternetProtocolEx *protocol)
ret
->
IUnknown_iface
.
lpVtbl
=
&
StgMedUnkVtbl
;
ret
->
ref
=
1
;
ret
->
size
=
0
;
ret
->
file
=
INVALID_HANDLE_VALUE
;
ret
->
hres
=
S_OK
;
ret
->
cache_file
=
NULL
;
...
...
@@ -497,49 +478,26 @@ static HRESULT WINAPI ProtocolStream_Read(IStream *iface, void *pv,
ULONG
cb
,
ULONG
*
pcbRead
)
{
ProtocolStream
*
This
=
impl_from_IStream
(
iface
);
DWORD
read
=
0
,
pread
=
0
;
DWORD
read
=
0
;
HRESULT
hres
;
TRACE
(
"(%p)->(%p %d %p)
\n
"
,
This
,
pv
,
cb
,
pcbRead
);
if
(
This
->
buf
->
file
!=
INVALID_HANDLE_VALUE
)
{
if
(
!
ReadFile
(
This
->
buf
->
file
,
pv
,
cb
,
&
read
,
NULL
))
return
INET_E_DOWNLOAD_FAILURE
;
if
(
pcbRead
)
*
pcbRead
=
read
;
return
read
?
S_OK
:
S_FALSE
;
}
if
(
This
->
buf
->
size
)
{
read
=
cb
;
if
(
read
>
This
->
buf
->
size
)
read
=
This
->
buf
->
size
;
memcpy
(
pv
,
This
->
buf
->
buf
,
read
);
if
(
read
<
This
->
buf
->
size
)
memmove
(
This
->
buf
->
buf
,
This
->
buf
->
buf
+
read
,
This
->
buf
->
size
-
read
);
This
->
buf
->
size
-=
read
;
}
if
(
read
==
cb
)
{
if
(
pcbRead
)
*
pcbRead
=
read
;
return
S_OK
;
if
(
This
->
buf
->
file
==
INVALID_HANDLE_VALUE
)
{
hres
=
This
->
buf
->
hres
=
IInternetProtocol_Read
(
This
->
buf
->
protocol
,
(
PBYTE
)
pv
,
cb
,
&
read
);
}
else
{
hres
=
ReadFile
(
This
->
buf
->
file
,
pv
,
cb
,
&
read
,
NULL
)
?
S_OK
:
INET_E_DOWNLOAD_FAILURE
;
}
hres
=
This
->
buf
->
hres
=
IInternetProtocol_Read
(
This
->
buf
->
protocol
,
(
PBYTE
)
pv
+
read
,
cb
-
read
,
&
pread
);
if
(
pcbRead
)
*
pcbRead
=
read
+
pread
;
*
pcbRead
=
read
;
if
(
hres
==
E_PENDING
)
return
E_PENDING
;
else
if
(
FAILED
(
hres
))
FIXME
(
"Read failed: %08x
\n
"
,
hres
);
return
read
||
pread
?
S_OK
:
S_FALSE
;
return
read
?
S_OK
:
S_FALSE
;
}
static
HRESULT
WINAPI
ProtocolStream_Write
(
IStream
*
iface
,
const
void
*
pv
,
...
...
@@ -685,7 +643,7 @@ static HRESULT stgmed_stream_get_result(stgmed_obj_t *obj, DWORD bindf, void **r
ProtocolStream
*
stream
=
(
ProtocolStream
*
)
obj
;
if
(
!
(
bindf
&
BINDF_ASYNCHRONOUS
)
&&
stream
->
buf
->
file
==
INVALID_HANDLE_VALUE
&&
(
stream
->
buf
->
hres
!=
S_FALSE
||
stream
->
buf
->
size
)
)
&&
stream
->
buf
->
hres
!=
S_FALSE
)
return
INET_E_DATA_NOT_AVAILABLE
;
IStream_AddRef
(
&
stream
->
IStream_iface
);
...
...
@@ -1028,7 +986,6 @@ static HRESULT WINAPI InternetProtocolSink_ReportProgress(IInternetProtocolSink
on_progress
(
This
,
0
,
0
,
BINDSTATUS_REDIRECTING
,
szStatusText
);
break
;
case
BINDSTATUS_BEGINDOWNLOADDATA
:
fill_stgmed_buffer
(
This
->
stgmed_buf
);
break
;
case
BINDSTATUS_SENDINGREQUEST
:
on_progress
(
This
,
0
,
0
,
BINDSTATUS_SENDINGREQUEST
,
szStatusText
);
...
...
@@ -1078,8 +1035,6 @@ static void report_data(Binding *This, DWORD bscf, ULONG progress, ULONG progres
if
(
This
->
stgmed_buf
->
file
!=
INVALID_HANDLE_VALUE
)
read_protocol_data
(
This
->
stgmed_buf
);
else
if
(
This
->
download_state
==
BEFORE_DOWNLOAD
)
fill_stgmed_buffer
(
This
->
stgmed_buf
);
if
(
This
->
download_state
==
BEFORE_DOWNLOAD
)
{
This
->
download_state
=
DOWNLOADING
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment