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
ed4327ee
Commit
ed4327ee
authored
Sep 04, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 06, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmusic: Move constructor parameter checks to class factory.
parent
54ed994a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
50 deletions
+41
-50
collection.c
dlls/dmusic/collection.c
+16
-25
dmusic.c
dlls/dmusic/dmusic.c
+6
-14
dmusic_main.c
dlls/dmusic/dmusic_main.c
+17
-9
dmusic_private.h
dlls/dmusic/dmusic_private.h
+2
-2
No files found.
dlls/dmusic/collection.c
View file @
ed4327ee
...
...
@@ -520,31 +520,22 @@ static const IPersistStreamVtbl persiststream_vtbl = {
unimpl_IPersistStream_GetSizeMax
};
HRESULT
DMUSIC_CreateDirectMusicCollectionImpl
(
REFIID
lpcGUID
,
void
**
ppobj
,
IUnknown
*
pUnkOuter
)
HRESULT
collection_create
(
IUnknown
**
ret_iface
)
{
IDirectMusicCollectionImpl
*
obj
;
HRESULT
hr
;
*
ppobj
=
NULL
;
if
(
pUnkOuter
)
return
CLASS_E_NOAGGREGATION
;
obj
=
calloc
(
1
,
sizeof
(
IDirectMusicCollectionImpl
));
if
(
!
obj
)
return
E_OUTOFMEMORY
;
obj
->
IDirectMusicCollection_iface
.
lpVtbl
=
&
DirectMusicCollection_Collection_Vtbl
;
obj
->
ref
=
1
;
dmobject_init
(
&
obj
->
dmobj
,
&
CLSID_DirectMusicCollection
,
(
IUnknown
*
)
&
obj
->
IDirectMusicCollection_iface
);
obj
->
dmobj
.
IDirectMusicObject_iface
.
lpVtbl
=
&
dmobject_vtbl
;
obj
->
dmobj
.
IPersistStream_iface
.
lpVtbl
=
&
persiststream_vtbl
;
list_init
(
&
obj
->
Instruments
);
IDirectMusicCollectionImpl
*
obj
;
hr
=
IDirectMusicCollection_QueryInterface
(
&
obj
->
IDirectMusicCollection_iface
,
lpcGUID
,
ppobj
);
IDirectMusicCollection_Release
(
&
obj
->
IDirectMusicCollection_iface
);
return
hr
;
*
ret_iface
=
NULL
;
if
(
!
(
obj
=
calloc
(
1
,
sizeof
(
*
obj
))))
return
E_OUTOFMEMORY
;
obj
->
IDirectMusicCollection_iface
.
lpVtbl
=
&
DirectMusicCollection_Collection_Vtbl
;
obj
->
ref
=
1
;
dmobject_init
(
&
obj
->
dmobj
,
&
CLSID_DirectMusicCollection
,
(
IUnknown
*
)
&
obj
->
IDirectMusicCollection_iface
);
obj
->
dmobj
.
IDirectMusicObject_iface
.
lpVtbl
=
&
dmobject_vtbl
;
obj
->
dmobj
.
IPersistStream_iface
.
lpVtbl
=
&
persiststream_vtbl
;
list_init
(
&
obj
->
Instruments
);
TRACE
(
"Created DirectMusicCollection %p
\n
"
,
obj
);
*
ret_iface
=
(
IUnknown
*
)
&
obj
->
IDirectMusicCollection_iface
;
return
S_OK
;
}
dlls/dmusic/dmusic.c
View file @
ed4327ee
...
...
@@ -577,22 +577,15 @@ static void create_system_ports_list(IDirectMusic8Impl* object)
object
->
num_system_ports
=
nb_ports
;
}
/* For ClassFactory */
HRESULT
DMUSIC_CreateDirectMusicImpl
(
REFIID
riid
,
void
**
ret_iface
,
IUnknown
*
unkouter
)
HRESULT
music_create
(
IUnknown
**
ret_iface
)
{
IDirectMusic8Impl
*
dmusic
;
HRESULT
ret
;
TRACE
(
"(%
s, %p, %p)
\n
"
,
debugstr_guid
(
riid
),
ret_iface
,
unkouter
);
TRACE
(
"(%
p)
\n
"
,
ret_iface
);
*
ret_iface
=
NULL
;
if
(
unkouter
)
return
CLASS_E_NOAGGREGATION
;
dmusic
=
calloc
(
1
,
sizeof
(
IDirectMusic8Impl
));
if
(
!
dmusic
)
return
E_OUTOFMEMORY
;
if
(
!
(
dmusic
=
calloc
(
1
,
sizeof
(
*
dmusic
))))
return
E_OUTOFMEMORY
;
dmusic
->
IDirectMusic8_iface
.
lpVtbl
=
&
DirectMusic8_Vtbl
;
dmusic
->
ref
=
1
;
ret
=
master_clock_create
(
&
dmusic
->
master_clock
);
...
...
@@ -603,8 +596,7 @@ HRESULT DMUSIC_CreateDirectMusicImpl(REFIID riid, void **ret_iface, IUnknown *un
create_system_ports_list
(
dmusic
);
ret
=
IDirectMusic8Impl_QueryInterface
(
&
dmusic
->
IDirectMusic8_iface
,
riid
,
ret_iface
);
IDirectMusic8_Release
(
&
dmusic
->
IDirectMusic8_iface
);
return
ret
;
TRACE
(
"Created DirectMusic %p
\n
"
,
dmusic
);
*
ret_iface
=
(
IUnknown
*
)
&
dmusic
->
IDirectMusic8_iface
;
return
S_OK
;
}
dlls/dmusic/dmusic_main.c
View file @
ed4327ee
...
...
@@ -41,7 +41,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
typedef
struct
{
IClassFactory
IClassFactory_iface
;
HRESULT
(
*
fnCreateInstance
)(
REFIID
riid
,
void
**
ppv
,
IUnknown
*
pUnkOuter
);
HRESULT
(
*
create_instance
)(
IUnknown
**
ret_iface
);
}
IClassFactoryImpl
;
/******************************************************************
...
...
@@ -82,14 +82,23 @@ static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
return
1
;
/* non-heap based object */
}
static
HRESULT
WINAPI
ClassFactory_CreateInstance
(
IClassFactory
*
iface
,
IUnknown
*
pUnkOuter
,
REFIID
riid
,
void
**
ppv
)
static
HRESULT
WINAPI
ClassFactory_CreateInstance
(
IClassFactory
*
iface
,
IUnknown
*
unk_outer
,
REFIID
riid
,
void
**
ret_iface
)
{
IClassFactoryImpl
*
This
=
impl_from_IClassFactory
(
iface
);
IClassFactoryImpl
*
This
=
impl_from_IClassFactory
(
iface
);
IUnknown
*
object
;
HRESULT
hr
;
TRACE
(
"(%p, %s, %p)
\n
"
,
pUnkOuter
,
debugstr_dmguid
(
riid
),
ppv
);
TRACE
(
"(%p, %s, %p)
\n
"
,
unk_outer
,
debugstr_dmguid
(
riid
),
ret_iface
);
return
This
->
fnCreateInstance
(
riid
,
ppv
,
pUnkOuter
);
*
ret_iface
=
NULL
;
if
(
unk_outer
)
return
CLASS_E_NOAGGREGATION
;
if
(
SUCCEEDED
(
hr
=
This
->
create_instance
(
&
object
)))
{
hr
=
IUnknown_QueryInterface
(
object
,
riid
,
ret_iface
);
IUnknown_Release
(
object
);
}
return
hr
;
}
static
HRESULT
WINAPI
ClassFactory_LockServer
(
IClassFactory
*
iface
,
BOOL
dolock
)
...
...
@@ -106,9 +115,8 @@ static const IClassFactoryVtbl classfactory_vtbl = {
ClassFactory_LockServer
};
static
IClassFactoryImpl
DirectMusic_CF
=
{{
&
classfactory_vtbl
},
DMUSIC_CreateDirectMusicImpl
};
static
IClassFactoryImpl
Collection_CF
=
{{
&
classfactory_vtbl
},
DMUSIC_CreateDirectMusicCollectionImpl
};
static
IClassFactoryImpl
DirectMusic_CF
=
{{
&
classfactory_vtbl
},
music_create
};
static
IClassFactoryImpl
Collection_CF
=
{{
&
classfactory_vtbl
},
collection_create
};
...
...
dlls/dmusic/dmusic_private.h
View file @
ed4327ee
...
...
@@ -91,8 +91,8 @@ typedef struct instrument_articulation {
*/
/* CLSID */
extern
HRESULT
DMUSIC_CreateDirectMusicImpl
(
REFIID
riid
,
void
**
ret_iface
,
IUnknown
*
pUnkOuter
);
extern
HRESULT
DMUSIC_CreateDirectMusicCollectionImpl
(
REFIID
riid
,
void
**
ppobj
,
IUnknown
*
pUnkOuter
);
extern
HRESULT
music_create
(
IUnknown
**
ret_iface
);
extern
HRESULT
collection_create
(
IUnknown
**
ret_iface
);
/* Internal */
extern
HRESULT
DMUSIC_CreateDirectMusicBufferImpl
(
LPDMUS_BUFFERDESC
desc
,
LPVOID
*
ret_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