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
160c4f96
Commit
160c4f96
authored
Mar 15, 2011
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Mar 15, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32/tests: COM cleanup in olepicture.c.
parent
0dc91c49
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
17 deletions
+23
-17
olepicture.c
dlls/oleaut32/tests/olepicture.c
+23
-17
No files found.
dlls/oleaut32/tests/olepicture.c
View file @
160c4f96
...
...
@@ -25,6 +25,7 @@
#include <float.h>
#define COBJMACROS
#define CONST_VTABLE
#define NONAMELESSUNION
#include "wine/test.h"
...
...
@@ -169,17 +170,17 @@ static const unsigned char enhmetafile[] = {
};
struct
NoStatStreamImpl
typedef
struct
NoStatStreamImpl
{
const
IStreamVtbl
*
lpVtbl
;
IStream
IStream_iface
;
LONG
ref
;
HGLOBAL
supportHandle
;
ULARGE_INTEGER
streamSize
;
ULARGE_INTEGER
currentPosition
;
};
typedef
struct
NoStatStreamImpl
NoStatStreamImpl
;
static
NoStatStreamImpl
*
NoStatStreamImpl
_Construct
(
HGLOBAL
hGlobal
);
}
NoStatStreamImpl
;
static
IStream
*
NoStatStream
_Construct
(
HGLOBAL
hGlobal
);
static
void
test_pic_with_stream
(
LPSTREAM
stream
,
unsigned
int
imgsize
)
...
...
@@ -282,7 +283,7 @@ test_pic(const unsigned char *imgdata, unsigned int imgsize)
IStream_Release
(
stream
);
/* again with Non Statable and Non Seekable stream */
stream
=
(
LPSTREAM
)
NoStatStreamImpl
_Construct
(
hglob
);
stream
=
NoStatStream
_Construct
(
hglob
);
hglob
=
0
;
/* Non-statable impl always deletes on release */
test_pic_with_stream
(
stream
,
0
);
...
...
@@ -313,7 +314,7 @@ test_pic(const unsigned char *imgdata, unsigned int imgsize)
IStream_Release
(
stream
);
/* again with Non Statable and Non Seekable stream */
stream
=
(
LPSTREAM
)
NoStatStreamImpl
_Construct
(
hglob
);
stream
=
NoStatStream
_Construct
(
hglob
);
hglob
=
0
;
/* Non-statable impl always deletes on release */
test_pic_with_stream
(
stream
,
0
);
...
...
@@ -1002,6 +1003,11 @@ START_TEST(olepicture)
/* Helper functions only ... */
static
inline
NoStatStreamImpl
*
impl_from_IStream
(
IStream
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
NoStatStreamImpl
,
IStream_iface
);
}
static
void
NoStatStreamImpl_Destroy
(
NoStatStreamImpl
*
This
)
{
GlobalFree
(
This
->
supportHandle
);
...
...
@@ -1012,7 +1018,7 @@ static void NoStatStreamImpl_Destroy(NoStatStreamImpl* This)
static
ULONG
WINAPI
NoStatStreamImpl_AddRef
(
IStream
*
iface
)
{
NoStatStreamImpl
*
const
This
=
(
NoStatStreamImpl
*
)
iface
;
NoStatStreamImpl
*
const
This
=
impl_from_IStream
(
iface
)
;
return
InterlockedIncrement
(
&
This
->
ref
);
}
...
...
@@ -1021,7 +1027,7 @@ static HRESULT WINAPI NoStatStreamImpl_QueryInterface(
REFIID
riid
,
/* [in] */
void
**
ppvObject
)
/* [iid_is][out] */
{
NoStatStreamImpl
*
const
This
=
(
NoStatStreamImpl
*
)
iface
;
NoStatStreamImpl
*
const
This
=
impl_from_IStream
(
iface
)
;
if
(
ppvObject
==
0
)
return
E_INVALIDARG
;
*
ppvObject
=
0
;
if
(
IsEqualIID
(
&
IID_IUnknown
,
riid
))
...
...
@@ -1042,7 +1048,7 @@ static HRESULT WINAPI NoStatStreamImpl_QueryInterface(
static
ULONG
WINAPI
NoStatStreamImpl_Release
(
IStream
*
iface
)
{
NoStatStreamImpl
*
const
This
=
(
NoStatStreamImpl
*
)
iface
;
NoStatStreamImpl
*
const
This
=
impl_from_IStream
(
iface
)
;
ULONG
newRef
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
newRef
==
0
)
NoStatStreamImpl_Destroy
(
This
);
...
...
@@ -1055,7 +1061,7 @@ static HRESULT WINAPI NoStatStreamImpl_Read(
ULONG
cb
,
/* [in] */
ULONG
*
pcbRead
)
/* [out] */
{
NoStatStreamImpl
*
const
This
=
(
NoStatStreamImpl
*
)
iface
;
NoStatStreamImpl
*
const
This
=
impl_from_IStream
(
iface
)
;
void
*
supportBuffer
;
ULONG
bytesReadBuffer
;
ULONG
bytesToReadFromBuffer
;
...
...
@@ -1079,7 +1085,7 @@ static HRESULT WINAPI NoStatStreamImpl_Write(
ULONG
cb
,
/* [in] */
ULONG
*
pcbWritten
)
/* [out] */
{
NoStatStreamImpl
*
const
This
=
(
NoStatStreamImpl
*
)
iface
;
NoStatStreamImpl
*
const
This
=
impl_from_IStream
(
iface
)
;
void
*
supportBuffer
;
ULARGE_INTEGER
newSize
;
ULONG
bytesWritten
=
0
;
...
...
@@ -1107,7 +1113,7 @@ static HRESULT WINAPI NoStatStreamImpl_Seek(
DWORD
dwOrigin
,
/* [in] */
ULARGE_INTEGER
*
plibNewPosition
)
/* [out] */
{
NoStatStreamImpl
*
const
This
=
(
NoStatStreamImpl
*
)
iface
;
NoStatStreamImpl
*
const
This
=
impl_from_IStream
(
iface
)
;
ULARGE_INTEGER
newPosition
;
switch
(
dwOrigin
)
{
...
...
@@ -1136,7 +1142,7 @@ static HRESULT WINAPI NoStatStreamImpl_SetSize(
IStream
*
iface
,
ULARGE_INTEGER
libNewSize
)
/* [in] */
{
NoStatStreamImpl
*
const
This
=
(
NoStatStreamImpl
*
)
iface
;
NoStatStreamImpl
*
const
This
=
impl_from_IStream
(
iface
)
;
HGLOBAL
supportHandle
;
if
(
libNewSize
.
u
.
HighPart
!=
0
)
return
STG_E_INVALIDFUNCTION
;
...
...
@@ -1249,14 +1255,14 @@ static const IStreamVtbl NoStatStreamImpl_Vtbl;
In any case the object takes ownership of memory handle and will free it on
object release.
*/
static
NoStatStreamImpl
*
NoStatStreamImpl
_Construct
(
HGLOBAL
hGlobal
)
static
IStream
*
NoStatStream
_Construct
(
HGLOBAL
hGlobal
)
{
NoStatStreamImpl
*
newStream
;
newStream
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
NoStatStreamImpl
));
if
(
newStream
!=
0
)
{
newStream
->
lpVtbl
=
&
NoStatStreamImpl_Vtbl
;
newStream
->
IStream_iface
.
lpVtbl
=
&
NoStatStreamImpl_Vtbl
;
newStream
->
ref
=
1
;
newStream
->
supportHandle
=
hGlobal
;
...
...
@@ -1268,7 +1274,7 @@ static NoStatStreamImpl* NoStatStreamImpl_Construct(HGLOBAL hGlobal)
newStream
->
streamSize
.
u
.
HighPart
=
0
;
newStream
->
streamSize
.
u
.
LowPart
=
GlobalSize
(
newStream
->
supportHandle
);
}
return
newStream
;
return
&
newStream
->
IStream_iface
;
}
...
...
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