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
819d25a7
Commit
819d25a7
authored
Jul 01, 2015
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Jul 01, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmstyle: Use the generic IPersistStream for DMCommandTrack.
parent
28b606b0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
69 deletions
+36
-69
commandtrack.c
dlls/dmstyle/commandtrack.c
+25
-47
dmstyle.c
dlls/dmstyle/tests/dmstyle.c
+11
-22
No files found.
dlls/dmstyle/commandtrack.c
View file @
819d25a7
...
...
@@ -18,6 +18,7 @@
*/
#include "dmstyle_private.h"
#include "dmobject.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
dmstyle
);
WINE_DECLARE_DEBUG_CHANNEL
(
dmfile
);
...
...
@@ -27,9 +28,8 @@ WINE_DECLARE_DEBUG_CHANNEL(dmfile);
*/
typedef
struct
IDirectMusicCommandTrack
{
IDirectMusicTrack8
IDirectMusicTrack8_iface
;
const
IPersistStreamVtbl
*
PersistStreamVtbl
;
struct
dmobject
dmobj
;
/* IPersistStream only */
LONG
ref
;
DMUS_OBJECTDESC
*
pDesc
;
struct
list
Commands
;
}
IDirectMusicCommandTrack
;
...
...
@@ -52,7 +52,7 @@ static HRESULT WINAPI IDirectMusicTrack8Impl_QueryInterface(IDirectMusicTrack8 *
IsEqualIID
(
riid
,
&
IID_IDirectMusicTrack8
))
*
ret_iface
=
iface
;
else
if
(
IsEqualIID
(
riid
,
&
IID_IPersistStream
))
*
ret_iface
=
&
This
->
PersistStreamVtbl
;
*
ret_iface
=
&
This
->
dmobj
.
IPersistStream_iface
;
else
{
WARN
(
"(%p, %s, %p): not found
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ret_iface
);
return
E_NOINTERFACE
;
...
...
@@ -249,32 +249,14 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = {
IDirectMusicTrack8Impl_Join
};
/* IDirectMusicCommandTrack IPersistStream part: */
static
HRESULT
WINAPI
IDirectMusicCommandTrack_IPersistStream_QueryInterface
(
LPPERSISTSTREAM
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
ICOM_THIS_MULTI
(
IDirectMusicCommandTrack
,
PersistStreamVtbl
,
iface
);
return
IDirectMusicTrack8_QueryInterface
(
&
This
->
IDirectMusicTrack8_iface
,
riid
,
ppobj
);
}
static
ULONG
WINAPI
IDirectMusicCommandTrack_IPersistStream_AddRef
(
LPPERSISTSTREAM
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicCommandTrack
,
PersistStreamVtbl
,
iface
);
return
IDirectMusicTrack8_AddRef
(
&
This
->
IDirectMusicTrack8_iface
);
}
static
ULONG
WINAPI
IDirectMusicCommandTrack_IPersistStream_Release
(
LPPERSISTSTREAM
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicCommandTrack
,
PersistStreamVtbl
,
iface
);
return
IDirectMusicTrack8_Release
(
&
This
->
IDirectMusicTrack8_iface
);
}
static
HRESULT
WINAPI
IDirectMusicCommandTrack_IPersistStream_GetClassID
(
LPPERSISTSTREAM
iface
,
CLSID
*
pClassID
)
{
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
IDirectMusicCommandTrack_IPersistStream_IsDirty
(
LPPERSISTSTREAM
iface
)
{
return
E_NOTIMPL
;
static
inline
IDirectMusicCommandTrack
*
impl_from_IPersistStream
(
IPersistStream
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
IDirectMusicCommandTrack
,
dmobj
.
IPersistStream_iface
);
}
static
HRESULT
WINAPI
IDirectMusicCommandTrack_IPersistStream_Load
(
LPPERSISTSTREAM
iface
,
IStream
*
pStm
)
{
ICOM_THIS_MULTI
(
IDirectMusicCommandTrack
,
PersistStreamVtbl
,
iface
);
static
HRESULT
WINAPI
IPersistStreamImpl_Load
(
IPersistStream
*
iface
,
IStream
*
pStm
)
{
IDirectMusicCommandTrack
*
This
=
impl_from_IPersistStream
(
iface
);
FOURCC
chunkID
;
DWORD
chunkSize
,
dwSizeOfStruct
,
nrCommands
;
LARGE_INTEGER
liMove
;
/* used when skipping chunks */
...
...
@@ -299,7 +281,7 @@ static HRESULT WINAPI IDirectMusicCommandTrack_IPersistStream_Load (LPPERSISTSTR
list_add_tail
(
&
This
->
Commands
,
&
pNewCommand
->
entry
);
}
TRACE_
(
dmfile
)(
": reading finished
\n
"
);
This
->
pDesc
->
dwValidData
|=
DMUS_OBJ_LOADED
;
This
->
dmobj
.
desc
.
dwValidData
|=
DMUS_OBJ_LOADED
;
break
;
}
default:
{
...
...
@@ -334,23 +316,21 @@ static HRESULT WINAPI IDirectMusicCommandTrack_IPersistStream_Load (LPPERSISTSTR
return
S_OK
;
}
static
HRESULT
WINAPI
IDirectMusicCommandTrack_IPersistStream_Save
(
LPPERSISTSTREAM
iface
,
IStream
*
pStm
,
BOOL
fClearDirty
)
{
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
IDirectMusicCommandTrack_IPersistStream_GetSizeMax
(
LPPERSISTSTREAM
iface
,
ULARGE_INTEGER
*
pcbSize
)
{
static
HRESULT
WINAPI
IPersistStreamImpl_Save
(
IPersistStream
*
iface
,
IStream
*
stream
,
BOOL
cleardirty
)
{
return
E_NOTIMPL
;
}
static
const
IPersistStreamVtbl
DirectMusicCommandTrack_PersistStream_V
tbl
=
{
IDirectMusicCommandTrack
_IPersistStream_QueryInterface
,
IDirectMusicCommandTrack
_IPersistStream_AddRef
,
IDirectMusicCommandTrack
_IPersistStream_Release
,
IDirectMusicCommandTrack
_IPersistStream_GetClassID
,
IDirectMusicCommandTrack
_IPersistStream_IsDirty
,
IDirectMusicCommandTrack_IPersistStream
_Load
,
IDirectMusicCommandTrack_IPersistStream
_Save
,
IDirectMusicCommandTrack
_IPersistStream_GetSizeMax
static
const
IPersistStreamVtbl
persiststream_v
tbl
=
{
dmobj
_IPersistStream_QueryInterface
,
dmobj
_IPersistStream_AddRef
,
dmobj
_IPersistStream_Release
,
dmobj
_IPersistStream_GetClassID
,
unimpl
_IPersistStream_IsDirty
,
IPersistStreamImpl
_Load
,
IPersistStreamImpl
_Save
,
unimpl
_IPersistStream_GetSizeMax
};
/* for ClassFactory */
...
...
@@ -365,12 +345,10 @@ HRESULT WINAPI create_dmcommandtrack(REFIID lpcGUID, void **ppobj)
return
E_OUTOFMEMORY
;
}
track
->
IDirectMusicTrack8_iface
.
lpVtbl
=
&
dmtrack8_vtbl
;
track
->
PersistStreamVtbl
=
&
DirectMusicCommandTrack_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_DirectMusicCommandTrack
;
track
->
ref
=
1
;
dmobject_init
(
&
track
->
dmobj
,
&
CLSID_DirectMusicCommandTrack
,
(
IUnknown
*
)
&
track
->
IDirectMusicTrack8_iface
);
track
->
dmobj
.
IPersistStream_iface
.
lpVtbl
=
&
persiststream_vtbl
;
list_init
(
&
track
->
Commands
);
DMSTYLE_LockModule
();
...
...
dlls/dmstyle/tests/dmstyle.c
View file @
819d25a7
...
...
@@ -252,14 +252,13 @@ static void test_track(void)
const
char
*
name
;
BOOL
has_save
;
BOOL
has_join
;
BOOL
todo
;
}
class
[]
=
{
{
X
(
DirectMusicAuditionTrack
),
TRUE
,
FALSE
,
FALSE
},
{
X
(
DirectMusicChordTrack
),
TRUE
,
TRUE
,
FALSE
},
{
X
(
DirectMusicCommandTrack
),
TRUE
,
TRUE
,
TRUE
},
{
X
(
DirectMusicMotifTrack
),
FALSE
,
FALSE
,
FALSE
},
{
X
(
DirectMusicMuteTrack
),
TRUE
,
FALSE
,
FALSE
},
{
X
(
DirectMusicStyleTrack
),
FALSE
,
TRUE
,
FALSE
},
{
X
(
DirectMusicAuditionTrack
),
TRUE
,
FALSE
},
{
X
(
DirectMusicChordTrack
),
TRUE
,
TRUE
},
{
X
(
DirectMusicCommandTrack
),
TRUE
,
TRUE
},
{
X
(
DirectMusicMotifTrack
),
FALSE
,
FALSE
},
{
X
(
DirectMusicMuteTrack
),
TRUE
,
FALSE
},
{
X
(
DirectMusicStyleTrack
),
FALSE
,
TRUE
},
};
#undef X
unsigned
int
i
;
...
...
@@ -329,21 +328,11 @@ static void test_track(void)
hr
=
IDirectMusicTrack8_QueryInterface
(
dmt8
,
&
IID_IPersistStream
,
(
void
**
)
&
ps
);
ok
(
hr
==
S_OK
,
"QueryInterface for IID_IPersistStream failed: %08x
\n
"
,
hr
);
hr
=
IPersistStream_GetClassID
(
ps
,
&
classid
);
if
(
class
[
i
].
todo
)
{
todo_wine
{
ok
(
hr
==
S_OK
,
"IPersistStream_GetClassID failed: %08x
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
classid
,
class
[
i
].
clsid
),
"Expected class %s got %s
\n
"
,
class
[
i
].
name
,
wine_dbgstr_guid
(
&
classid
));
hr
=
IPersistStream_IsDirty
(
ps
);
ok
(
hr
==
S_FALSE
,
"IPersistStream_IsDirty failed: %08x
\n
"
,
hr
);
}
}
else
{
ok
(
hr
==
S_OK
,
"IPersistStream_GetClassID failed: %08x
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
classid
,
class
[
i
].
clsid
),
"Expected class %s got %s
\n
"
,
class
[
i
].
name
,
wine_dbgstr_guid
(
&
classid
));
hr
=
IPersistStream_IsDirty
(
ps
);
ok
(
hr
==
S_FALSE
,
"IPersistStream_IsDirty failed: %08x
\n
"
,
hr
);
}
ok
(
hr
==
S_OK
,
"IPersistStream_GetClassID failed: %08x
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
classid
,
class
[
i
].
clsid
),
"Expected class %s got %s
\n
"
,
class
[
i
].
name
,
wine_dbgstr_guid
(
&
classid
));
hr
=
IPersistStream_IsDirty
(
ps
);
ok
(
hr
==
S_FALSE
,
"IPersistStream_IsDirty failed: %08x
\n
"
,
hr
);
hr
=
IPersistStream_GetSizeMax
(
ps
,
&
size
);
ok
(
hr
==
E_NOTIMPL
,
"IPersistStream_GetSizeMax failed: %08x
\n
"
,
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