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
6704ef14
Commit
6704ef14
authored
Nov 29, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 04, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Fix InitializeFromIStream() to simply wrap target stream.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fc780fe3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
28 deletions
+34
-28
stream.c
dlls/windowscodecs/stream.c
+18
-8
stream.c
dlls/windowscodecs/tests/stream.c
+16
-20
No files found.
dlls/windowscodecs/stream.c
View file @
6704ef14
...
...
@@ -912,16 +912,26 @@ static HRESULT WINAPI IWICStreamImpl_Clone(IWICStream *iface,
return
IStream_Clone
(
This
->
pStream
,
ppstm
);
}
static
HRESULT
WINAPI
IWICStreamImpl_InitializeFromIStream
(
IWICStream
*
iface
,
IStream
*
pIStream
)
static
HRESULT
WINAPI
IWICStreamImpl_InitializeFromIStream
(
IWICStream
*
iface
,
IStream
*
stream
)
{
ULARGE_INTEGER
offset
,
size
;
TRACE
(
"(%p, %p)
\n
"
,
iface
,
pIStream
);
IWICStreamImpl
*
This
=
impl_from_IWICStream
(
iface
);
HRESULT
hr
=
S_OK
;
TRACE
(
"(%p, %p)
\n
"
,
iface
,
stream
);
if
(
!
stream
)
return
E_INVALIDARG
;
if
(
This
->
pStream
)
return
WINCODEC_ERR_WRONGSTATE
;
IStream_AddRef
(
stream
);
if
(
InterlockedCompareExchangePointer
((
void
**
)
&
This
->
pStream
,
stream
,
NULL
))
{
/* Some other thread set the stream first. */
IStream_Release
(
stream
);
hr
=
WINCODEC_ERR_WRONGSTATE
;
}
offset
.
QuadPart
=
0
;
size
.
u
.
LowPart
=
0xffffffff
;
size
.
u
.
HighPart
=
0xffffffff
;
return
IWICStream_InitializeFromIStreamRegion
(
iface
,
pIStream
,
offset
,
size
);
return
hr
;
}
static
HRESULT
WINAPI
IWICStreamImpl_InitializeFromFilename
(
IWICStream
*
iface
,
...
...
dlls/windowscodecs/tests/stream.c
View file @
6704ef14
...
...
@@ -777,7 +777,7 @@ static void test_StreamOnIStream(void)
hr
=
IWICStream_InitializeFromIStream
(
substream
,
(
IStream
*
)
stream
);
ok
(
hr
==
S_OK
,
"Failed to initialize stream, hr %#x.
\n
"
,
hr
);
CHECK_CUR_POS
_TODO
(
substream
,
1
);
CHECK_CUR_POS
(
substream
,
1
);
/* Seek */
CHECK_CUR_POS
(
stream
,
1
);
...
...
@@ -785,12 +785,12 @@ static void test_StreamOnIStream(void)
ok
(
hr
==
S_OK
,
"Failed to seek a stream, hr %#x.
\n
"
,
hr
);
ok
(
newpos
.
QuadPart
==
sizeof
(
memory
),
"Unexpected position %s.
\n
"
,
wine_dbgstr_longlong
(
newpos
.
QuadPart
));
CHECK_CUR_POS
(
substream
,
sizeof
(
memory
));
CHECK_CUR_POS
_TODO
(
stream
,
sizeof
(
memory
));
CHECK_CUR_POS
(
stream
,
sizeof
(
memory
));
hr
=
IWICStream_Seek
(
substream
,
zero_pos
,
STREAM_SEEK_SET
,
&
newpos
);
ok
(
hr
==
S_OK
,
"Failed to seek a stream, hr %#x.
\n
"
,
hr
);
ok
(
newpos
.
QuadPart
==
0
,
"Unexpected position %s.
\n
"
,
wine_dbgstr_longlong
(
newpos
.
QuadPart
));
CHECK_CUR_POS
_TODO
(
stream
,
0
);
CHECK_CUR_POS
(
stream
,
0
);
CHECK_CUR_POS
(
substream
,
0
);
hr
=
IWICStream_Seek
(
substream
,
zero_pos
,
STREAM_SEEK_SET
,
NULL
);
...
...
@@ -801,41 +801,37 @@ static void test_StreamOnIStream(void)
newpos
.
u
.
HighPart
=
0xdeadbeef
;
newpos
.
u
.
LowPart
=
0xdeadbeef
;
hr
=
IWICStream_Seek
(
substream
,
pos
,
STREAM_SEEK_SET
,
&
newpos
);
todo_wine
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_ARITHMETIC_OVERFLOW
),
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
newpos
.
u
.
HighPart
==
0xdeadbeef
&&
newpos
.
u
.
LowPart
==
0xdeadbeef
,
"Unexpected position %s.
\n
"
,
wine_dbgstr_longlong
(
newpos
.
QuadPart
));
CHECK_CUR_POS
_TODO
(
stream
,
0
);
CHECK_CUR_POS
(
stream
,
0
);
CHECK_CUR_POS
(
substream
,
0
);
pos
.
QuadPart
=
sizeof
(
memory
)
+
1
;
newpos
.
u
.
HighPart
=
0xdeadbeef
;
newpos
.
u
.
LowPart
=
0xdeadbeef
;
hr
=
IWICStream_Seek
(
substream
,
pos
,
STREAM_SEEK_SET
,
&
newpos
);
todo_wine
{
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
newpos
.
u
.
HighPart
==
0xdeadbeef
&&
newpos
.
u
.
LowPart
==
0xdeadbeef
,
"Unexpected position %s.
\n
"
,
wine_dbgstr_longlong
(
newpos
.
QuadPart
));
}
CHECK_CUR_POS_TODO
(
stream
,
0
);
CHECK_CUR_POS_TODO
(
substream
,
0
);
CHECK_CUR_POS
(
stream
,
0
);
CHECK_CUR_POS
(
substream
,
0
);
pos
.
QuadPart
=
1
;
newpos
.
u
.
HighPart
=
0xdeadbeef
;
newpos
.
u
.
LowPart
=
0xdeadbeef
;
hr
=
IWICStream_Seek
(
substream
,
pos
,
STREAM_SEEK_END
,
&
newpos
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
newpos
.
u
.
HighPart
==
0xdeadbeef
&&
newpos
.
u
.
LowPart
==
0xdeadbeef
,
"Unexpected position %s.
\n
"
,
wine_dbgstr_longlong
(
newpos
.
QuadPart
));
CHECK_CUR_POS
_TODO
(
stream
,
0
);
CHECK_CUR_POS
_TODO
(
substream
,
0
);
CHECK_CUR_POS
(
stream
,
0
);
CHECK_CUR_POS
(
substream
,
0
);
pos
.
QuadPart
=
-
1
;
hr
=
IWICStream_Seek
(
substream
,
pos
,
STREAM_SEEK_END
,
&
newpos
);
ok
(
hr
==
S_OK
,
"Failed to seek a stream, hr %#x.
\n
"
,
hr
);
ok
(
newpos
.
QuadPart
==
sizeof
(
memory
)
-
1
,
"Unexpected position %s.
\n
"
,
wine_dbgstr_longlong
(
newpos
.
QuadPart
));
CHECK_CUR_POS
_TODO
(
stream
,
sizeof
(
memory
)
-
1
);
CHECK_CUR_POS
(
stream
,
sizeof
(
memory
)
-
1
);
CHECK_CUR_POS
(
substream
,
sizeof
(
memory
)
-
1
);
IWICStream_Seek
(
substream
,
zero_pos
,
STREAM_SEEK_SET
,
NULL
);
...
...
@@ -846,23 +842,23 @@ todo_wine
ok
(
read_len
==
12
,
"Unexpected read length %u.
\n
"
,
read_len
);
ok
(
!
memcmp
(
buff
,
data
,
12
),
"Unexpected data.
\n
"
);
CHECK_CUR_POS
(
substream
,
read_len
);
CHECK_CUR_POS
_TODO
(
stream
,
read_len
);
CHECK_CUR_POS
(
stream
,
read_len
);
IWICStream_Seek
(
substream
,
zero_pos
,
STREAM_SEEK_SET
,
NULL
);
CHECK_CUR_POS
_TODO
(
stream
,
0
);
CHECK_CUR_POS
(
stream
,
0
);
hr
=
IWICStream_Read
(
substream
,
memory
,
10
,
&
read_len
);
/* source = dest */
ok
(
hr
==
S_OK
,
"Failed to read from stream, hr %#x.
\n
"
,
hr
);
ok
(
read_len
==
10
,
"Unexpected read length %u.
\n
"
,
read_len
);
ok
(
!
memcmp
(
memory
,
data
,
read_len
),
"Unexpected data.
\n
"
);
CHECK_CUR_POS
_TODO
(
stream
,
10
);
CHECK_CUR_POS
(
stream
,
10
);
IWICStream_Seek
(
substream
,
zero_pos
,
STREAM_SEEK_SET
,
NULL
);
hr
=
IWICStream_Read
(
substream
,
memory
,
2
*
sizeof
(
data
),
&
read_len
);
/* request too many bytes */
ok
(
hr
==
S_OK
,
"Failed to read from stream, hr %#x.
\n
"
,
hr
);
ok
(
read_len
==
64
,
"Unexpected read length %u.
\n
"
,
read_len
);
ok
(
!
memcmp
(
memory
,
data
,
read_len
),
"Unexpected data.
\n
"
);
CHECK_CUR_POS
_TODO
(
stream
,
sizeof
(
data
));
CHECK_CUR_POS
(
stream
,
sizeof
(
data
));
IWICStream_Seek
(
substream
,
zero_pos
,
STREAM_SEEK_SET
,
NULL
);
read_len
=
0xdeadbeef
;
...
...
@@ -898,7 +894,7 @@ todo_wine
ok
(
written
==
3
,
"Unexpected written length %u.
\n
"
,
written
);
ok
(
!
memcmp
(
buff
,
memory
,
3
),
"Unexpected stream data.
\n
"
);
CHECK_CUR_POS
(
substream
,
written
);
CHECK_CUR_POS
_TODO
(
stream
,
written
);
CHECK_CUR_POS
(
stream
,
written
);
IWICStream_Seek
(
substream
,
zero_pos
,
STREAM_SEEK_SET
,
NULL
);
hr
=
IWICStream_Write
(
substream
,
buff
,
0
,
&
written
);
...
...
@@ -909,14 +905,14 @@ todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
written
==
0xdeadbeef
,
"Unexpected written length %u.
\n
"
,
written
);
CHECK_CUR_POS
(
substream
,
0
);
CHECK_CUR_POS
_TODO
(
stream
,
0
);
CHECK_CUR_POS
(
stream
,
0
);
written
=
0xdeadbeef
;
hr
=
IWICStream_Write
(
substream
,
NULL
,
0
,
&
written
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
written
==
0xdeadbeef
,
"Unexpected written length %u.
\n
"
,
written
);
CHECK_CUR_POS
(
substream
,
0
);
CHECK_CUR_POS
_TODO
(
stream
,
0
);
CHECK_CUR_POS
(
stream
,
0
);
/* SetSize */
newpos
.
u
.
HighPart
=
0
;
...
...
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