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
Show 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 @@
...
@@ -25,6 +25,7 @@
#include <float.h>
#include <float.h>
#define COBJMACROS
#define COBJMACROS
#define CONST_VTABLE
#define NONAMELESSUNION
#define NONAMELESSUNION
#include "wine/test.h"
#include "wine/test.h"
...
@@ -169,17 +170,17 @@ static const unsigned char enhmetafile[] = {
...
@@ -169,17 +170,17 @@ static const unsigned char enhmetafile[] = {
};
};
struct
NoStatStreamImpl
typedef
struct
NoStatStreamImpl
{
{
const
IStreamVtbl
*
lpVtbl
;
IStream
IStream_iface
;
LONG
ref
;
LONG
ref
;
HGLOBAL
supportHandle
;
HGLOBAL
supportHandle
;
ULARGE_INTEGER
streamSize
;
ULARGE_INTEGER
streamSize
;
ULARGE_INTEGER
currentPosition
;
ULARGE_INTEGER
currentPosition
;
};
}
NoStatStreamImpl
;
typedef
struct
NoStatStreamImpl
NoStatStreamImpl
;
static
NoStatStreamImpl
*
NoStatStreamImpl
_Construct
(
HGLOBAL
hGlobal
);
static
IStream
*
NoStatStream
_Construct
(
HGLOBAL
hGlobal
);
static
void
static
void
test_pic_with_stream
(
LPSTREAM
stream
,
unsigned
int
imgsize
)
test_pic_with_stream
(
LPSTREAM
stream
,
unsigned
int
imgsize
)
...
@@ -282,7 +283,7 @@ test_pic(const unsigned char *imgdata, unsigned int imgsize)
...
@@ -282,7 +283,7 @@ test_pic(const unsigned char *imgdata, unsigned int imgsize)
IStream_Release
(
stream
);
IStream_Release
(
stream
);
/* again with Non Statable and Non Seekable 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 */
hglob
=
0
;
/* Non-statable impl always deletes on release */
test_pic_with_stream
(
stream
,
0
);
test_pic_with_stream
(
stream
,
0
);
...
@@ -313,7 +314,7 @@ test_pic(const unsigned char *imgdata, unsigned int imgsize)
...
@@ -313,7 +314,7 @@ test_pic(const unsigned char *imgdata, unsigned int imgsize)
IStream_Release
(
stream
);
IStream_Release
(
stream
);
/* again with Non Statable and Non Seekable 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 */
hglob
=
0
;
/* Non-statable impl always deletes on release */
test_pic_with_stream
(
stream
,
0
);
test_pic_with_stream
(
stream
,
0
);
...
@@ -1002,6 +1003,11 @@ START_TEST(olepicture)
...
@@ -1002,6 +1003,11 @@ START_TEST(olepicture)
/* Helper functions only ... */
/* Helper functions only ... */
static
inline
NoStatStreamImpl
*
impl_from_IStream
(
IStream
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
NoStatStreamImpl
,
IStream_iface
);
}
static
void
NoStatStreamImpl_Destroy
(
NoStatStreamImpl
*
This
)
static
void
NoStatStreamImpl_Destroy
(
NoStatStreamImpl
*
This
)
{
{
GlobalFree
(
This
->
supportHandle
);
GlobalFree
(
This
->
supportHandle
);
...
@@ -1012,7 +1018,7 @@ static void NoStatStreamImpl_Destroy(NoStatStreamImpl* This)
...
@@ -1012,7 +1018,7 @@ static void NoStatStreamImpl_Destroy(NoStatStreamImpl* This)
static
ULONG
WINAPI
NoStatStreamImpl_AddRef
(
static
ULONG
WINAPI
NoStatStreamImpl_AddRef
(
IStream
*
iface
)
IStream
*
iface
)
{
{
NoStatStreamImpl
*
const
This
=
(
NoStatStreamImpl
*
)
iface
;
NoStatStreamImpl
*
const
This
=
impl_from_IStream
(
iface
)
;
return
InterlockedIncrement
(
&
This
->
ref
);
return
InterlockedIncrement
(
&
This
->
ref
);
}
}
...
@@ -1021,7 +1027,7 @@ static HRESULT WINAPI NoStatStreamImpl_QueryInterface(
...
@@ -1021,7 +1027,7 @@ static HRESULT WINAPI NoStatStreamImpl_QueryInterface(
REFIID
riid
,
/* [in] */
REFIID
riid
,
/* [in] */
void
**
ppvObject
)
/* [iid_is][out] */
void
**
ppvObject
)
/* [iid_is][out] */
{
{
NoStatStreamImpl
*
const
This
=
(
NoStatStreamImpl
*
)
iface
;
NoStatStreamImpl
*
const
This
=
impl_from_IStream
(
iface
)
;
if
(
ppvObject
==
0
)
return
E_INVALIDARG
;
if
(
ppvObject
==
0
)
return
E_INVALIDARG
;
*
ppvObject
=
0
;
*
ppvObject
=
0
;
if
(
IsEqualIID
(
&
IID_IUnknown
,
riid
))
if
(
IsEqualIID
(
&
IID_IUnknown
,
riid
))
...
@@ -1042,7 +1048,7 @@ static HRESULT WINAPI NoStatStreamImpl_QueryInterface(
...
@@ -1042,7 +1048,7 @@ static HRESULT WINAPI NoStatStreamImpl_QueryInterface(
static
ULONG
WINAPI
NoStatStreamImpl_Release
(
static
ULONG
WINAPI
NoStatStreamImpl_Release
(
IStream
*
iface
)
IStream
*
iface
)
{
{
NoStatStreamImpl
*
const
This
=
(
NoStatStreamImpl
*
)
iface
;
NoStatStreamImpl
*
const
This
=
impl_from_IStream
(
iface
)
;
ULONG
newRef
=
InterlockedDecrement
(
&
This
->
ref
);
ULONG
newRef
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
newRef
==
0
)
if
(
newRef
==
0
)
NoStatStreamImpl_Destroy
(
This
);
NoStatStreamImpl_Destroy
(
This
);
...
@@ -1055,7 +1061,7 @@ static HRESULT WINAPI NoStatStreamImpl_Read(
...
@@ -1055,7 +1061,7 @@ static HRESULT WINAPI NoStatStreamImpl_Read(
ULONG
cb
,
/* [in] */
ULONG
cb
,
/* [in] */
ULONG
*
pcbRead
)
/* [out] */
ULONG
*
pcbRead
)
/* [out] */
{
{
NoStatStreamImpl
*
const
This
=
(
NoStatStreamImpl
*
)
iface
;
NoStatStreamImpl
*
const
This
=
impl_from_IStream
(
iface
)
;
void
*
supportBuffer
;
void
*
supportBuffer
;
ULONG
bytesReadBuffer
;
ULONG
bytesReadBuffer
;
ULONG
bytesToReadFromBuffer
;
ULONG
bytesToReadFromBuffer
;
...
@@ -1079,7 +1085,7 @@ static HRESULT WINAPI NoStatStreamImpl_Write(
...
@@ -1079,7 +1085,7 @@ static HRESULT WINAPI NoStatStreamImpl_Write(
ULONG
cb
,
/* [in] */
ULONG
cb
,
/* [in] */
ULONG
*
pcbWritten
)
/* [out] */
ULONG
*
pcbWritten
)
/* [out] */
{
{
NoStatStreamImpl
*
const
This
=
(
NoStatStreamImpl
*
)
iface
;
NoStatStreamImpl
*
const
This
=
impl_from_IStream
(
iface
)
;
void
*
supportBuffer
;
void
*
supportBuffer
;
ULARGE_INTEGER
newSize
;
ULARGE_INTEGER
newSize
;
ULONG
bytesWritten
=
0
;
ULONG
bytesWritten
=
0
;
...
@@ -1107,7 +1113,7 @@ static HRESULT WINAPI NoStatStreamImpl_Seek(
...
@@ -1107,7 +1113,7 @@ static HRESULT WINAPI NoStatStreamImpl_Seek(
DWORD
dwOrigin
,
/* [in] */
DWORD
dwOrigin
,
/* [in] */
ULARGE_INTEGER
*
plibNewPosition
)
/* [out] */
ULARGE_INTEGER
*
plibNewPosition
)
/* [out] */
{
{
NoStatStreamImpl
*
const
This
=
(
NoStatStreamImpl
*
)
iface
;
NoStatStreamImpl
*
const
This
=
impl_from_IStream
(
iface
)
;
ULARGE_INTEGER
newPosition
;
ULARGE_INTEGER
newPosition
;
switch
(
dwOrigin
)
switch
(
dwOrigin
)
{
{
...
@@ -1136,7 +1142,7 @@ static HRESULT WINAPI NoStatStreamImpl_SetSize(
...
@@ -1136,7 +1142,7 @@ static HRESULT WINAPI NoStatStreamImpl_SetSize(
IStream
*
iface
,
IStream
*
iface
,
ULARGE_INTEGER
libNewSize
)
/* [in] */
ULARGE_INTEGER
libNewSize
)
/* [in] */
{
{
NoStatStreamImpl
*
const
This
=
(
NoStatStreamImpl
*
)
iface
;
NoStatStreamImpl
*
const
This
=
impl_from_IStream
(
iface
)
;
HGLOBAL
supportHandle
;
HGLOBAL
supportHandle
;
if
(
libNewSize
.
u
.
HighPart
!=
0
)
if
(
libNewSize
.
u
.
HighPart
!=
0
)
return
STG_E_INVALIDFUNCTION
;
return
STG_E_INVALIDFUNCTION
;
...
@@ -1249,14 +1255,14 @@ static const IStreamVtbl NoStatStreamImpl_Vtbl;
...
@@ -1249,14 +1255,14 @@ static const IStreamVtbl NoStatStreamImpl_Vtbl;
In any case the object takes ownership of memory handle and will free it on
In any case the object takes ownership of memory handle and will free it on
object release.
object release.
*/
*/
static
NoStatStreamImpl
*
NoStatStreamImpl
_Construct
(
HGLOBAL
hGlobal
)
static
IStream
*
NoStatStream
_Construct
(
HGLOBAL
hGlobal
)
{
{
NoStatStreamImpl
*
newStream
;
NoStatStreamImpl
*
newStream
;
newStream
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
NoStatStreamImpl
));
newStream
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
NoStatStreamImpl
));
if
(
newStream
!=
0
)
if
(
newStream
!=
0
)
{
{
newStream
->
lpVtbl
=
&
NoStatStreamImpl_Vtbl
;
newStream
->
IStream_iface
.
lpVtbl
=
&
NoStatStreamImpl_Vtbl
;
newStream
->
ref
=
1
;
newStream
->
ref
=
1
;
newStream
->
supportHandle
=
hGlobal
;
newStream
->
supportHandle
=
hGlobal
;
...
@@ -1268,7 +1274,7 @@ static NoStatStreamImpl* NoStatStreamImpl_Construct(HGLOBAL hGlobal)
...
@@ -1268,7 +1274,7 @@ static NoStatStreamImpl* NoStatStreamImpl_Construct(HGLOBAL hGlobal)
newStream
->
streamSize
.
u
.
HighPart
=
0
;
newStream
->
streamSize
.
u
.
HighPart
=
0
;
newStream
->
streamSize
.
u
.
LowPart
=
GlobalSize
(
newStream
->
supportHandle
);
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