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
c1b3b58e
Commit
c1b3b58e
authored
Jan 30, 2014
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Jan 30, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmband: Remove the extraneous IUnknown from DirectMusicBand.
Also lock/unlock the module only on creation/destruction of the object.
parent
868ad7dc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
73 deletions
+47
-73
band.c
dlls/dmband/band.c
+47
-71
dmband_private.h
dlls/dmband/dmband_private.h
+0
-2
No files found.
dlls/dmband/band.c
View file @
c1b3b58e
...
...
@@ -31,83 +31,55 @@ static inline IDirectMusicBandImpl *impl_from_IDirectMusicBand(IDirectMusicBand
return
CONTAINING_RECORD
(
iface
,
IDirectMusicBandImpl
,
IDirectMusicBand_iface
);
}
/* IDirectMusicBandImpl IUnknown part: */
static
HRESULT
WINAPI
IDirectMusicBandImpl_IUnknown_QueryInterface
(
LPUNKNOWN
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
ICOM_THIS_MULTI
(
IDirectMusicBandImpl
,
UnknownVtbl
,
iface
);
TRACE
(
"(%p, %s, %p)
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ppobj
);
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
))
{
*
ppobj
=
&
This
->
UnknownVtbl
;
IUnknown_AddRef
(
iface
);
return
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IDirectMusicBand
))
{
*
ppobj
=
&
This
->
IDirectMusicBand_iface
;
IUnknown_AddRef
(
iface
);
return
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IDirectMusicObject
))
{
*
ppobj
=
&
This
->
ObjectVtbl
;
IUnknown_AddRef
(
iface
);
return
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IPersistStream
))
{
*
ppobj
=
&
This
->
PersistStreamVtbl
;
IUnknown_AddRef
(
iface
);
return
S_OK
;
}
WARN
(
"(%p, %s, %p): not found
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ppobj
);
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
IDirectMusicBandImpl_IUnknown_AddRef
(
LPUNKNOWN
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicBandImpl
,
UnknownVtbl
,
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p) : AddRef from %d
\n
"
,
This
,
ref
-
1
);
DMBAND_LockModule
();
return
ref
;
}
/* DirectMusicBandImpl IDirectMusicBand part: */
static
HRESULT
WINAPI
IDirectMusicBandImpl_QueryInterface
(
IDirectMusicBand
*
iface
,
REFIID
riid
,
void
**
ret_iface
)
{
IDirectMusicBandImpl
*
This
=
impl_from_IDirectMusicBand
(
iface
);
static
ULONG
WINAPI
IDirectMusicBandImpl_IUnknown_Release
(
LPUNKNOWN
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicBandImpl
,
UnknownVtbl
,
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p, %s, %p)
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ret_iface
);
TRACE
(
"(%p) : ReleaseRef to %d
\n
"
,
This
,
ref
)
;
*
ret_iface
=
NULL
;
if
(
ref
==
0
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
)
||
IsEqualIID
(
riid
,
&
IID_IDirectMusicBand
))
*
ret_iface
=
iface
;
else
if
(
IsEqualIID
(
riid
,
&
IID_IDirectMusicObject
))
*
ret_iface
=
&
This
->
ObjectVtbl
;
else
if
(
IsEqualIID
(
riid
,
&
IID_IPersistStream
))
*
ret_iface
=
&
This
->
PersistStreamVtbl
;
else
{
WARN
(
"(%p, %s, %p): not found
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ret_iface
);
return
E_NOINTERFACE
;
}
DMBAND_UnlockModule
();
return
ref
;
}
static
const
IUnknownVtbl
DirectMusicBand_Unknown_Vtbl
=
{
IDirectMusicBandImpl_IUnknown_QueryInterface
,
IDirectMusicBandImpl_IUnknown_AddRef
,
IDirectMusicBandImpl_IUnknown_Release
};
/* IDirectMusicBandImpl IDirectMusicBand part: */
static
HRESULT
WINAPI
IDirectMusicBandImpl_QueryInterface
(
IDirectMusicBand
*
iface
,
REFIID
riid
,
void
**
ppobj
)
{
IDirectMusicBandImpl
*
This
=
impl_from_IDirectMusicBand
(
iface
);
return
IUnknown_QueryInterface
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
,
riid
,
ppobj
);
IDirectMusicBand_AddRef
((
IUnknown
*
)
*
ret_iface
);
return
S_OK
;
}
static
ULONG
WINAPI
IDirectMusicBandImpl_AddRef
(
IDirectMusicBand
*
iface
)
{
IDirectMusicBandImpl
*
This
=
impl_from_IDirectMusicBand
(
iface
);
return
IUnknown_AddRef
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
);
LONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p) ref=%d
\n
"
,
This
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
IDirectMusicBandImpl_Release
(
IDirectMusicBand
*
iface
)
{
IDirectMusicBandImpl
*
This
=
impl_from_IDirectMusicBand
(
iface
);
return
IUnknown_Release
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
);
LONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p) ref=%d
\n
"
,
This
,
ref
);
if
(
!
ref
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pDesc
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
DMBAND_UnlockModule
();
}
return
ref
;
}
static
HRESULT
WINAPI
IDirectMusicBandImpl_CreateSegment
(
IDirectMusicBand
*
iface
,
...
...
@@ -146,17 +118,17 @@ static const IDirectMusicBandVtbl dmband_vtbl = {
/* IDirectMusicBandImpl IDirectMusicObject part: */
static
HRESULT
WINAPI
IDirectMusicBandImpl_IDirectMusicObject_QueryInterface
(
LPDIRECTMUSICOBJECT
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
ICOM_THIS_MULTI
(
IDirectMusicBandImpl
,
ObjectVtbl
,
iface
);
return
IUnknown_QueryInterface
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
,
riid
,
ppobj
);
return
IDirectMusicBand_QueryInterface
(
&
This
->
IDirectMusicBand_iface
,
riid
,
ppobj
);
}
static
ULONG
WINAPI
IDirectMusicBandImpl_IDirectMusicObject_AddRef
(
LPDIRECTMUSICOBJECT
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicBandImpl
,
ObjectVtbl
,
iface
);
return
IUnknown_AddRef
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
);
return
IDirectMusicBand_AddRef
(
&
This
->
IDirectMusicBand_iface
);
}
static
ULONG
WINAPI
IDirectMusicBandImpl_IDirectMusicObject_Release
(
LPDIRECTMUSICOBJECT
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicBandImpl
,
ObjectVtbl
,
iface
);
return
IUnknown_Release
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
);
return
IDirectMusicBand_Release
(
&
This
->
IDirectMusicBand_iface
);
}
static
HRESULT
WINAPI
IDirectMusicBandImpl_IDirectMusicObject_GetDescriptor
(
LPDIRECTMUSICOBJECT
iface
,
LPDMUS_OBJECTDESC
pDesc
)
{
...
...
@@ -360,17 +332,17 @@ static const IDirectMusicObjectVtbl DirectMusicBand_Object_Vtbl = {
/* IDirectMusicBandImpl IPersistStream part: */
static
HRESULT
WINAPI
IDirectMusicBandImpl_IPersistStream_QueryInterface
(
LPPERSISTSTREAM
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
ICOM_THIS_MULTI
(
IDirectMusicBandImpl
,
PersistStreamVtbl
,
iface
);
return
I
Unknown_QueryInterface
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
,
riid
,
ppobj
);
return
I
DirectMusicBand_QueryInterface
(
&
This
->
IDirectMusicBand_iface
,
riid
,
ppobj
);
}
static
ULONG
WINAPI
IDirectMusicBandImpl_IPersistStream_AddRef
(
LPPERSISTSTREAM
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicBandImpl
,
PersistStreamVtbl
,
iface
);
return
I
Unknown_AddRef
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
);
return
I
DirectMusicBand_AddRef
(
&
This
->
IDirectMusicBand_iface
);
}
static
ULONG
WINAPI
IDirectMusicBandImpl_IPersistStream_Release
(
LPPERSISTSTREAM
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicBandImpl
,
PersistStreamVtbl
,
iface
);
return
I
Unknown_Release
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
);
return
I
DirectMusicBand_Release
(
&
This
->
IDirectMusicBand_iface
);
}
static
HRESULT
WINAPI
IDirectMusicBandImpl_IPersistStream_GetClassID
(
LPPERSISTSTREAM
iface
,
CLSID
*
pClassID
)
{
...
...
@@ -705,13 +677,13 @@ static const IPersistStreamVtbl DirectMusicBand_PersistStream_Vtbl = {
HRESULT
WINAPI
create_dmband
(
REFIID
lpcGUID
,
void
**
ppobj
)
{
IDirectMusicBandImpl
*
obj
;
HRESULT
hr
;
obj
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IDirectMusicBandImpl
));
if
(
NULL
==
obj
)
{
*
ppobj
=
NULL
;
return
E_OUTOFMEMORY
;
}
obj
->
UnknownVtbl
=
&
DirectMusicBand_Unknown_Vtbl
;
obj
->
IDirectMusicBand_iface
.
lpVtbl
=
&
dmband_vtbl
;
obj
->
ObjectVtbl
=
&
DirectMusicBand_Object_Vtbl
;
obj
->
PersistStreamVtbl
=
&
DirectMusicBand_PersistStream_Vtbl
;
...
...
@@ -719,8 +691,12 @@ HRESULT WINAPI create_dmband(REFIID lpcGUID, void **ppobj)
DM_STRUCT_INIT
(
obj
->
pDesc
);
obj
->
pDesc
->
dwValidData
|=
DMUS_OBJ_CLASS
;
obj
->
pDesc
->
guidClass
=
CLSID_DirectMusicBand
;
obj
->
ref
=
0
;
/* will be inited by QueryInterface */
obj
->
ref
=
1
;
list_init
(
&
obj
->
Instruments
);
return
IDirectMusicBandImpl_IUnknown_QueryInterface
((
LPUNKNOWN
)
&
obj
->
UnknownVtbl
,
lpcGUID
,
ppobj
);
DMBAND_LockModule
();
hr
=
IDirectMusicBand_QueryInterface
(
&
obj
->
IDirectMusicBand_iface
,
lpcGUID
,
ppobj
);
IDirectMusicBand_Release
(
&
obj
->
IDirectMusicBand_iface
);
return
hr
;
}
dlls/dmband/dmband_private.h
View file @
c1b3b58e
...
...
@@ -86,8 +86,6 @@ typedef struct _DMUS_PRIVATE_BAND {
* IDirectMusicBandImpl implementation structure
*/
struct
IDirectMusicBandImpl
{
/* IUnknown fields */
const
IUnknownVtbl
*
UnknownVtbl
;
IDirectMusicBand
IDirectMusicBand_iface
;
const
IDirectMusicObjectVtbl
*
ObjectVtbl
;
const
IPersistStreamVtbl
*
PersistStreamVtbl
;
...
...
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