Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
ced0a1de
Commit
ced0a1de
authored
Mar 18, 2019
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfplat: Get rid of variant coercion calls.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
780378b2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
23 deletions
+53
-23
main.c
dlls/mfplat/main.c
+50
-22
mfplat.c
dlls/mfplat/tests/mfplat.c
+3
-1
No files found.
dlls/mfplat/main.c
View file @
ced0a1de
...
...
@@ -37,6 +37,7 @@
#include "mfplat_private.h"
#include "mfreadwrite.h"
#include "propvarutil.h"
#include "strsafe.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
mfplat
);
...
...
@@ -857,7 +858,8 @@ static HRESULT WINAPI mfattributes_GetUINT32(IMFAttributes *iface, REFGUID key,
attrval
.
vt
=
VT_UI4
;
hr
=
attributes_get_item
(
attributes
,
key
,
&
attrval
);
if
(
SUCCEEDED
(
hr
))
hr
=
PropVariantToUInt32
(
&
attrval
,
value
);
*
value
=
attrval
.
u
.
ulVal
;
return
hr
;
}
...
...
@@ -873,7 +875,8 @@ static HRESULT WINAPI mfattributes_GetUINT64(IMFAttributes *iface, REFGUID key,
attrval
.
vt
=
VT_UI8
;
hr
=
attributes_get_item
(
attributes
,
key
,
&
attrval
);
if
(
SUCCEEDED
(
hr
))
hr
=
PropVariantToUInt64
(
&
attrval
,
value
);
*
value
=
attrval
.
u
.
uhVal
.
QuadPart
;
return
hr
;
}
...
...
@@ -889,7 +892,8 @@ static HRESULT WINAPI mfattributes_GetDouble(IMFAttributes *iface, REFGUID key,
attrval
.
vt
=
VT_R8
;
hr
=
attributes_get_item
(
attributes
,
key
,
&
attrval
);
if
(
SUCCEEDED
(
hr
))
hr
=
PropVariantToDouble
(
&
attrval
,
value
);
*
value
=
attrval
.
u
.
dblVal
;
return
hr
;
}
...
...
@@ -905,7 +909,7 @@ static HRESULT WINAPI mfattributes_GetGUID(IMFAttributes *iface, REFGUID key, GU
attrval
.
vt
=
VT_CLSID
;
hr
=
attributes_get_item
(
attributes
,
key
,
&
attrval
);
if
(
SUCCEEDED
(
hr
))
hr
=
PropVariantToGUID
(
&
attrval
,
value
)
;
*
value
=
*
attrval
.
u
.
puuid
;
return
hr
;
}
...
...
@@ -913,17 +917,25 @@ static HRESULT WINAPI mfattributes_GetGUID(IMFAttributes *iface, REFGUID key, GU
static
HRESULT
WINAPI
mfattributes_GetStringLength
(
IMFAttributes
*
iface
,
REFGUID
key
,
UINT32
*
length
)
{
struct
attributes
*
attributes
=
impl_from_IMFAttributes
(
iface
);
PROPVARIANT
attrval
;
HRESULT
hr
;
struct
attribute
*
attribute
;
HRESULT
hr
=
S_OK
;
TRACE
(
"%p, %s, %p.
\n
"
,
iface
,
debugstr_attr
(
key
),
length
);
PropVariantInit
(
&
attrval
);
attrval
.
vt
=
VT_LPWSTR
;
hr
=
attributes_get_item
(
attributes
,
key
,
&
attrval
);
if
(
SUCCEEDED
(
hr
)
&&
length
)
*
length
=
lstrlenW
(
attrval
.
u
.
pwszVal
);
PropVariantClear
(
&
attrval
);
EnterCriticalSection
(
&
attributes
->
cs
);
attribute
=
attributes_find_item
(
attributes
,
key
,
NULL
);
if
(
attribute
)
{
if
(
attribute
->
value
.
vt
==
MF_ATTRIBUTE_STRING
)
*
length
=
strlenW
(
attribute
->
value
.
u
.
pwszVal
);
else
hr
=
MF_E_INVALIDTYPE
;
}
else
hr
=
MF_E_ATTRIBUTENOTFOUND
;
LeaveCriticalSection
(
&
attributes
->
cs
);
return
hr
;
}
...
...
@@ -932,19 +944,35 @@ static HRESULT WINAPI mfattributes_GetString(IMFAttributes *iface, REFGUID key,
UINT32
size
,
UINT32
*
length
)
{
struct
attributes
*
attributes
=
impl_from_IMFAttributes
(
iface
);
PROPVARIANT
attrval
;
HRESULT
hr
;
struct
attribute
*
attribute
;
HRESULT
hr
=
S_OK
;
TRACE
(
"%p, %s, %p, %d, %p.
\n
"
,
iface
,
debugstr_attr
(
key
),
value
,
size
,
length
);
PropVariantInit
(
&
attrval
);
attrval
.
vt
=
VT_LPWSTR
;
hr
=
attributes_get_item
(
attributes
,
key
,
&
attrval
);
if
(
SUCCEEDED
(
hr
))
hr
=
PropVariantToString
(
&
attrval
,
value
,
size
);
if
(
SUCCEEDED
(
hr
)
&&
length
)
*
length
=
lstrlenW
(
value
);
PropVariantClear
(
&
attrval
);
EnterCriticalSection
(
&
attributes
->
cs
);
attribute
=
attributes_find_item
(
attributes
,
key
,
NULL
);
if
(
attribute
)
{
if
(
attribute
->
value
.
vt
==
MF_ATTRIBUTE_STRING
)
{
int
len
=
strlenW
(
attribute
->
value
.
u
.
pwszVal
);
if
(
length
)
*
length
=
len
;
if
(
size
<=
len
)
return
STRSAFE_E_INSUFFICIENT_BUFFER
;
memcpy
(
value
,
attribute
->
value
.
u
.
pwszVal
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
}
else
hr
=
MF_E_INVALIDTYPE
;
}
else
hr
=
MF_E_ATTRIBUTENOTFOUND
;
LeaveCriticalSection
(
&
attributes
->
cs
);
return
hr
;
}
...
...
dlls/mfplat/tests/mfplat.c
View file @
ced0a1de
...
...
@@ -708,9 +708,11 @@ static void test_attributes(void)
ok
(
!
lstrcmpW
(
bufferW
,
stringW
),
"Unexpected string %s.
\n
"
,
wine_dbgstr_w
(
bufferW
));
memset
(
bufferW
,
0
,
sizeof
(
bufferW
));
hr
=
IMFAttributes_GetString
(
attributes
,
&
DUMMY_GUID1
,
bufferW
,
1
,
NULL
);
string_length
=
0
;
hr
=
IMFAttributes_GetString
(
attributes
,
&
DUMMY_GUID1
,
bufferW
,
1
,
&
string_length
);
ok
(
hr
==
STRSAFE_E_INSUFFICIENT_BUFFER
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
bufferW
[
0
],
"Unexpected string %s.
\n
"
,
wine_dbgstr_w
(
bufferW
));
ok
(
string_length
,
"Unexpected length.
\n
"
);
string_length
=
0xdeadbeef
;
hr
=
IMFAttributes_GetStringLength
(
attributes
,
&
GUID_NULL
,
&
string_length
);
...
...
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