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
ec2a7a32
Commit
ec2a7a32
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
dmsynth: Move constructor parameter checks to class factory.
parent
8ee23728
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
30 deletions
+32
-30
dmsynth_main.c
dlls/dmsynth/dmsynth_main.c
+17
-11
dmsynth_private.h
dlls/dmsynth/dmsynth_private.h
+2
-2
synth.c
dlls/dmsynth/synth.c
+7
-9
synthsink.c
dlls/dmsynth/synthsink.c
+6
-8
No files found.
dlls/dmsynth/dmsynth_main.c
View file @
ec2a7a32
...
@@ -27,7 +27,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmsynth);
...
@@ -27,7 +27,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmsynth);
typedef
struct
{
typedef
struct
{
IClassFactory
IClassFactory_iface
;
IClassFactory
IClassFactory_iface
;
HRESULT
(
*
fnCreateInstance
)(
REFIID
riid
,
void
**
ppv
);
HRESULT
(
*
create_instance
)(
IUnknown
**
ret_iface
);
}
IClassFactoryImpl
;
}
IClassFactoryImpl
;
/******************************************************************
/******************************************************************
...
@@ -68,17 +68,24 @@ static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
...
@@ -68,17 +68,24 @@ static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
return
1
;
/* non-heap based object */
return
1
;
/* non-heap based object */
}
}
static
HRESULT
WINAPI
ClassFactory_CreateInstance
(
IClassFactory
*
iface
,
IUnknown
*
pUnkO
uter
,
static
HRESULT
WINAPI
ClassFactory_CreateInstance
(
IClassFactory
*
iface
,
IUnknown
*
unk_o
uter
,
REFIID
riid
,
void
**
ppv
)
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
);
if
(
pUnkOuter
)
*
ret_iface
=
NULL
;
return
CLASS_E_NOAGGREGATION
;
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
This
->
fnCreateInstance
(
riid
,
ppv
)
;
return
hr
;
}
}
static
HRESULT
WINAPI
ClassFactory_LockServer
(
IClassFactory
*
iface
,
BOOL
dolock
)
static
HRESULT
WINAPI
ClassFactory_LockServer
(
IClassFactory
*
iface
,
BOOL
dolock
)
...
@@ -95,9 +102,8 @@ static const IClassFactoryVtbl classfactory_vtbl = {
...
@@ -95,9 +102,8 @@ static const IClassFactoryVtbl classfactory_vtbl = {
ClassFactory_LockServer
ClassFactory_LockServer
};
};
static
IClassFactoryImpl
Synth_CF
=
{{
&
classfactory_vtbl
},
DMUSIC_CreateDirectMusicSynthImpl
};
static
IClassFactoryImpl
Synth_CF
=
{{
&
classfactory_vtbl
},
synth_create
};
static
IClassFactoryImpl
SynthSink_CF
=
{{
&
classfactory_vtbl
},
static
IClassFactoryImpl
SynthSink_CF
=
{{
&
classfactory_vtbl
},
synth_sink_create
};
DMUSIC_CreateDirectMusicSynthSinkImpl
};
/******************************************************************
/******************************************************************
...
...
dlls/dmsynth/dmsynth_private.h
View file @
ec2a7a32
...
@@ -43,8 +43,8 @@
...
@@ -43,8 +43,8 @@
/*****************************************************************************
/*****************************************************************************
* ClassFactory
* ClassFactory
*/
*/
extern
HRESULT
DMUSIC_CreateDirectMusicSynthImpl
(
REFIID
riid
,
void
**
ppobj
);
extern
HRESULT
synth_create
(
IUnknown
**
ret_iface
);
extern
HRESULT
DMUSIC_CreateDirectMusicSynthSinkImpl
(
REFIID
riid
,
void
**
ppobj
);
extern
HRESULT
synth_sink_create
(
IUnknown
**
ret_iface
);
/*****************************************************************************
/*****************************************************************************
* Misc.
* Misc.
...
...
dlls/dmsynth/synth.c
View file @
ec2a7a32
...
@@ -737,19 +737,18 @@ static const IKsControlVtbl synth_control_vtbl =
...
@@ -737,19 +737,18 @@ static const IKsControlVtbl synth_control_vtbl =
synth_control_KsEvent
,
synth_control_KsEvent
,
};
};
HRESULT
DMUSIC_CreateDirectMusicSynthImpl
(
REFIID
riid
,
void
**
ppobj
)
HRESULT
synth_create
(
IUnknown
**
ret_iface
)
{
{
struct
synth
*
obj
;
struct
synth
*
obj
;
HRESULT
hr
;
TRACE
(
"(%
s, %p)
\n
"
,
debugstr_guid
(
riid
),
ppobj
);
TRACE
(
"(%
p)
\n
"
,
ret_iface
);
*
ppobj
=
NULL
;
*
ret_iface
=
NULL
;
if
(
!
(
obj
=
calloc
(
1
,
sizeof
(
*
obj
))))
return
E_OUTOFMEMORY
;
if
(
!
(
obj
=
calloc
(
1
,
sizeof
(
*
obj
))))
return
E_OUTOFMEMORY
;
obj
->
IDirectMusicSynth8_iface
.
lpVtbl
=
&
synth_vtbl
;
obj
->
IDirectMusicSynth8_iface
.
lpVtbl
=
&
synth_vtbl
;
obj
->
IKsControl_iface
.
lpVtbl
=
&
synth_control_vtbl
;
obj
->
IKsControl_iface
.
lpVtbl
=
&
synth_control_vtbl
;
obj
->
ref
=
1
;
obj
->
ref
=
1
;
/* fill in caps */
obj
->
caps
.
dwSize
=
sizeof
(
DMUS_PORTCAPS
);
obj
->
caps
.
dwSize
=
sizeof
(
DMUS_PORTCAPS
);
obj
->
caps
.
dwFlags
=
DMUS_PC_DLS
|
DMUS_PC_SOFTWARESYNTH
|
DMUS_PC_DIRECTSOUND
|
DMUS_PC_DLS2
|
DMUS_PC_AUDIOPATH
|
DMUS_PC_WAVE
;
obj
->
caps
.
dwFlags
=
DMUS_PC_DLS
|
DMUS_PC_SOFTWARESYNTH
|
DMUS_PC_DIRECTSOUND
|
DMUS_PC_DLS2
|
DMUS_PC_AUDIOPATH
|
DMUS_PC_WAVE
;
obj
->
caps
.
guidPort
=
CLSID_DirectMusicSynth
;
obj
->
caps
.
guidPort
=
CLSID_DirectMusicSynth
;
...
@@ -762,8 +761,7 @@ HRESULT DMUSIC_CreateDirectMusicSynthImpl(REFIID riid, void **ppobj)
...
@@ -762,8 +761,7 @@ HRESULT DMUSIC_CreateDirectMusicSynthImpl(REFIID riid, void **ppobj)
obj
->
caps
.
dwEffectFlags
=
DMUS_EFFECT_REVERB
;
obj
->
caps
.
dwEffectFlags
=
DMUS_EFFECT_REVERB
;
lstrcpyW
(
obj
->
caps
.
wszDescription
,
L"Microsoft Synthesizer"
);
lstrcpyW
(
obj
->
caps
.
wszDescription
,
L"Microsoft Synthesizer"
);
hr
=
IDirectMusicSynth8_QueryInterface
(
&
obj
->
IDirectMusicSynth8_iface
,
riid
,
ppobj
);
TRACE
(
"Created DirectMusicSynth %p
\n
"
,
obj
);
IDirectMusicSynth8_Release
(
&
obj
->
IDirectMusicSynth8_iface
);
*
ret_iface
=
(
IUnknown
*
)
&
obj
->
IDirectMusicSynth8_iface
;
return
S_OK
;
return
hr
;
}
}
dlls/dmsynth/synthsink.c
View file @
ec2a7a32
...
@@ -371,29 +371,27 @@ static const IKsControlVtbl synth_sink_control =
...
@@ -371,29 +371,27 @@ static const IKsControlVtbl synth_sink_control =
synth_sink_control_KsEvent
,
synth_sink_control_KsEvent
,
};
};
HRESULT
DMUSIC_CreateDirectMusicSynthSinkImpl
(
REFIID
riid
,
void
**
ret_iface
)
HRESULT
synth_sink_create
(
IUnknown
**
ret_iface
)
{
{
struct
synth_sink
*
obj
;
struct
synth_sink
*
obj
;
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"(%
s, %p)
\n
"
,
debugstr_guid
(
riid
)
,
ret_iface
);
TRACE
(
"(%
p)
\n
"
,
ret_iface
);
*
ret_iface
=
NULL
;
*
ret_iface
=
NULL
;
if
(
!
(
obj
=
calloc
(
1
,
sizeof
(
*
obj
))))
return
E_OUTOFMEMORY
;
if
(
!
(
obj
=
calloc
(
1
,
sizeof
(
*
obj
))))
return
E_OUTOFMEMORY
;
obj
->
IDirectMusicSynthSink_iface
.
lpVtbl
=
&
synth_sink_vtbl
;
obj
->
IDirectMusicSynthSink_iface
.
lpVtbl
=
&
synth_sink_vtbl
;
obj
->
IKsControl_iface
.
lpVtbl
=
&
synth_sink_control
;
obj
->
IKsControl_iface
.
lpVtbl
=
&
synth_sink_control
;
obj
->
ref
=
1
;
obj
->
ref
=
1
;
hr
=
CoCreateInstance
(
&
CLSID_SystemClock
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IReferenceClock
,
(
LPVOID
*
)
&
obj
->
latency_clock
);
hr
=
CoCreateInstance
(
&
CLSID_SystemClock
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IReferenceClock
,
(
void
*
*
)
&
obj
->
latency_clock
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
free
(
obj
);
free
(
obj
);
return
hr
;
return
hr
;
}
}
hr
=
IDirectMusicSynthSink_QueryInterface
(
&
obj
->
IDirectMusicSynthSink_iface
,
riid
,
ret_iface
);
TRACE
(
"Created DirectMusicSynthSink %p
\n
"
,
obj
);
IDirectMusicSynthSink_Release
(
&
obj
->
IDirectMusicSynthSink_iface
);
*
ret_iface
=
(
IUnknown
*
)
&
obj
->
IDirectMusicSynthSink_iface
;
return
S_OK
;
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