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
c1647cbb
Commit
c1647cbb
authored
Jun 30, 2015
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Jun 30, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmstyle: Remove the extraneous IUnknown from DMMotifTrack.
Also lock/unlock the module only on creation/destruction of the object.
parent
1d2bc65c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
77 deletions
+50
-77
motiftrack.c
dlls/dmstyle/motiftrack.c
+50
-77
No files found.
dlls/dmstyle/motiftrack.c
View file @
c1647cbb
...
...
@@ -21,76 +21,16 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dmstyle
);
static
ULONG
WINAPI
IDirectMusicMotifTrack_IUnknown_AddRef
(
LPUNKNOWN
iface
);
static
ULONG
WINAPI
IDirectMusicMotifTrack_IPersistStream_AddRef
(
LPPERSISTSTREAM
iface
);
/*****************************************************************************
* IDirectMusicMotifTrack implementation
*/
typedef
struct
IDirectMusicMotifTrack
{
const
IUnknownVtbl
*
UnknownVtbl
;
IDirectMusicTrack8
IDirectMusicTrack8_iface
;
const
IPersistStreamVtbl
*
PersistStreamVtbl
;
LONG
ref
;
DMUS_OBJECTDESC
*
pDesc
;
}
IDirectMusicMotifTrack
;
/* IDirectMusicMotifTrack IUnknown part: */
static
HRESULT
WINAPI
IDirectMusicMotifTrack_IUnknown_QueryInterface
(
LPUNKNOWN
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
ICOM_THIS_MULTI
(
IDirectMusicMotifTrack
,
UnknownVtbl
,
iface
);
TRACE
(
"(%p, %s, %p)
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ppobj
);
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
))
{
*
ppobj
=
&
This
->
UnknownVtbl
;
IDirectMusicMotifTrack_IUnknown_AddRef
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
);
return
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IDirectMusicTrack
)
||
IsEqualIID
(
riid
,
&
IID_IDirectMusicTrack8
))
{
*
ppobj
=
&
This
->
IDirectMusicTrack8_iface
;
IDirectMusicTrack8_AddRef
(
&
This
->
IDirectMusicTrack8_iface
);
return
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IPersistStream
))
{
*
ppobj
=
&
This
->
PersistStreamVtbl
;
IDirectMusicMotifTrack_IPersistStream_AddRef
((
LPPERSISTSTREAM
)
&
This
->
PersistStreamVtbl
);
return
S_OK
;
}
WARN
(
"(%p, %s, %p): not found
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ppobj
);
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
IDirectMusicMotifTrack_IUnknown_AddRef
(
LPUNKNOWN
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicMotifTrack
,
UnknownVtbl
,
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p): AddRef from %d
\n
"
,
This
,
ref
-
1
);
DMSTYLE_LockModule
();
return
ref
;
}
static
ULONG
WINAPI
IDirectMusicMotifTrack_IUnknown_Release
(
LPUNKNOWN
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicMotifTrack
,
UnknownVtbl
,
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p): ReleaseRef to %d
\n
"
,
This
,
ref
);
if
(
ref
==
0
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
DMSTYLE_UnlockModule
();
return
ref
;
}
static
const
IUnknownVtbl
DirectMusicMotifTrack_Unknown_Vtbl
=
{
IDirectMusicMotifTrack_IUnknown_QueryInterface
,
IDirectMusicMotifTrack_IUnknown_AddRef
,
IDirectMusicMotifTrack_IUnknown_Release
};
/* IDirectMusicMotifTrack IDirectMusicTrack8 part: */
static
inline
IDirectMusicMotifTrack
*
impl_from_IDirectMusicTrack8
(
IDirectMusicTrack8
*
iface
)
{
...
...
@@ -98,22 +38,51 @@ static inline IDirectMusicMotifTrack *impl_from_IDirectMusicTrack8(IDirectMusicT
}
static
HRESULT
WINAPI
IDirectMusicTrack8Impl_QueryInterface
(
IDirectMusicTrack8
*
iface
,
REFIID
riid
,
void
**
ppobj
)
void
**
ret_iface
)
{
IDirectMusicMotifTrack
*
This
=
impl_from_IDirectMusicTrack8
(
iface
);
return
IDirectMusicMotifTrack_IUnknown_QueryInterface
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
,
riid
,
ppobj
);
TRACE
(
"(%p, %s, %p)
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ret_iface
);
*
ret_iface
=
NULL
;
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
)
||
IsEqualIID
(
riid
,
&
IID_IDirectMusicTrack
)
||
IsEqualIID
(
riid
,
&
IID_IDirectMusicTrack8
))
*
ret_iface
=
iface
;
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
;
}
IUnknown_AddRef
((
IUnknown
*
)
*
ret_iface
);
return
S_OK
;
}
static
ULONG
WINAPI
IDirectMusicTrack8Impl_AddRef
(
IDirectMusicTrack8
*
iface
)
{
IDirectMusicMotifTrack
*
This
=
impl_from_IDirectMusicTrack8
(
iface
);
return
IDirectMusicMotifTrack_IUnknown_AddRef
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
);
LONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p) ref=%d
\n
"
,
This
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
IDirectMusicTrack8Impl_Release
(
IDirectMusicTrack8
*
iface
)
{
IDirectMusicMotifTrack
*
This
=
impl_from_IDirectMusicTrack8
(
iface
);
return
IDirectMusicMotifTrack_IUnknown_Release
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
);
LONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p) ref=%d
\n
"
,
This
,
ref
);
if
(
!
ref
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
DMSTYLE_UnlockModule
();
}
return
ref
;
}
static
HRESULT
WINAPI
IDirectMusicTrack8Impl_Init
(
IDirectMusicTrack8
*
iface
,
...
...
@@ -282,17 +251,17 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = {
/* IDirectMusicMotifTrack IPersistStream part: */
static
HRESULT
WINAPI
IDirectMusicMotifTrack_IPersistStream_QueryInterface
(
LPPERSISTSTREAM
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
ICOM_THIS_MULTI
(
IDirectMusicMotifTrack
,
PersistStreamVtbl
,
iface
);
return
IDirectMusic
MotifTrack_IUnknown_QueryInterface
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
,
riid
,
ppobj
);
return
IDirectMusic
Track8_QueryInterface
(
&
This
->
IDirectMusicTrack8_iface
,
riid
,
ppobj
);
}
static
ULONG
WINAPI
IDirectMusicMotifTrack_IPersistStream_AddRef
(
LPPERSISTSTREAM
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicMotifTrack
,
PersistStreamVtbl
,
iface
);
return
IDirectMusic
MotifTrack_IUnknown_AddRef
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
);
return
IDirectMusic
Track8_AddRef
(
&
This
->
IDirectMusicTrack8_iface
);
}
static
ULONG
WINAPI
IDirectMusicMotifTrack_IPersistStream_Release
(
LPPERSISTSTREAM
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicMotifTrack
,
PersistStreamVtbl
,
iface
);
return
IDirectMusic
MotifTrack_IUnknown_Release
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
);
return
IDirectMusic
Track8_Release
(
&
This
->
IDirectMusicTrack8_iface
);
}
static
HRESULT
WINAPI
IDirectMusicMotifTrack_IPersistStream_GetClassID
(
LPPERSISTSTREAM
iface
,
CLSID
*
pClassID
)
{
...
...
@@ -330,21 +299,25 @@ static const IPersistStreamVtbl DirectMusicMotifTrack_PersistStream_Vtbl = {
/* for ClassFactory */
HRESULT
WINAPI
create_dmmotiftrack
(
REFIID
lpcGUID
,
void
**
ppobj
)
{
IDirectMusicMotifTrack
*
track
;
track
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IDirectMusicMotifTrack
));
if
(
NULL
==
track
)
{
*
ppobj
=
NULL
;
return
E_OUTOFMEMORY
;
}
track
->
UnknownVtbl
=
&
DirectMusicMotifTrack_Unknown_Vtbl
;
IDirectMusicMotifTrack
*
track
;
HRESULT
hr
;
track
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
track
));
if
(
!
track
)
{
*
ppobj
=
NULL
;
return
E_OUTOFMEMORY
;
}
track
->
IDirectMusicTrack8_iface
.
lpVtbl
=
&
dmtrack8_vtbl
;
track
->
PersistStreamVtbl
=
&
DirectMusicMotifTrack_PersistStream_Vtbl
;
track
->
pDesc
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
DMUS_OBJECTDESC
));
DM_STRUCT_INIT
(
track
->
pDesc
);
track
->
pDesc
->
dwValidData
|=
DMUS_OBJ_CLASS
;
track
->
pDesc
->
guidClass
=
CLSID_DirectMusicMotifTrack
;
track
->
ref
=
0
;
/* will be inited by QueryInterface */
track
->
ref
=
1
;
DMSTYLE_LockModule
();
hr
=
IDirectMusicTrack8_QueryInterface
(
&
track
->
IDirectMusicTrack8_iface
,
lpcGUID
,
ppobj
);
IDirectMusicTrack8_Release
(
&
track
->
IDirectMusicTrack8_iface
);
return
IDirectMusicMotifTrack_IUnknown_QueryInterface
((
LPUNKNOWN
)
&
track
->
UnknownVtbl
,
lpcGUID
,
ppobj
)
;
return
hr
;
}
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