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
8b30ef11
Commit
8b30ef11
authored
Jun 28, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jun 29, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Implement MetadataHandler_GetValue.
parent
79969b6c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
116 additions
and
4 deletions
+116
-4
metadatahandler.c
dlls/windowscodecs/metadatahandler.c
+76
-3
metadata.c
dlls/windowscodecs/tests/metadata.c
+40
-1
No files found.
dlls/windowscodecs/metadatahandler.c
View file @
8b30ef11
...
...
@@ -213,11 +213,84 @@ static HRESULT WINAPI MetadataHandler_GetValueByIndex(IWICMetadataWriter *iface,
return
hr
;
}
static
BOOL
get_int_value
(
const
PROPVARIANT
*
pv
,
LONGLONG
*
value
)
{
switch
(
pv
->
vt
)
{
case
VT_NULL
:
case
VT_EMPTY
:
*
value
=
0
;
break
;
case
VT_I1
:
*
value
=
pv
->
u
.
cVal
;
break
;
case
VT_UI1
:
*
value
=
pv
->
u
.
bVal
;
break
;
case
VT_I2
:
*
value
=
pv
->
u
.
iVal
;
break
;
case
VT_UI2
:
*
value
=
pv
->
u
.
uiVal
;
break
;
case
VT_I4
:
*
value
=
pv
->
u
.
lVal
;
break
;
case
VT_UI4
:
*
value
=
pv
->
u
.
ulVal
;
break
;
case
VT_I8
:
case
VT_UI8
:
*
value
=
pv
->
u
.
hVal
.
QuadPart
;
break
;
default:
FIXME
(
"not supported variant type %d
\n
"
,
pv
->
vt
);
return
FALSE
;
}
return
TRUE
;
}
/* FiXME: Use propsys.PropVariantCompareEx once it's implemented */
static
int
propvar_cmp
(
const
PROPVARIANT
*
v1
,
const
PROPVARIANT
*
v2
)
{
LONGLONG
value1
,
value2
;
if
(
!
get_int_value
(
v1
,
&
value1
))
return
-
1
;
if
(
!
get_int_value
(
v2
,
&
value2
))
return
-
1
;
value1
-=
value2
;
if
(
value1
)
return
value1
<
0
?
-
1
:
1
;
return
0
;
}
static
HRESULT
WINAPI
MetadataHandler_GetValue
(
IWICMetadataWriter
*
iface
,
const
PROPVARIANT
*
pvarSchema
,
const
PROPVARIANT
*
pvarId
,
PROPVARIANT
*
pvarV
alue
)
const
PROPVARIANT
*
schema
,
const
PROPVARIANT
*
id
,
PROPVARIANT
*
v
alue
)
{
FIXME
(
"(%p,%p,%p,%p): stub
\n
"
,
iface
,
pvarSchema
,
pvarId
,
pvarValue
);
return
E_NOTIMPL
;
UINT
i
;
HRESULT
hr
=
WINCODEC_ERR_PROPERTYNOTFOUND
;
MetadataHandler
*
This
=
impl_from_IWICMetadataWriter
(
iface
);
TRACE
(
"(%p,%p,%p,%p)
\n
"
,
iface
,
schema
,
id
,
value
);
if
(
!
id
)
return
E_INVALIDARG
;
EnterCriticalSection
(
&
This
->
lock
);
for
(
i
=
0
;
i
<
This
->
item_count
;
i
++
)
{
if
(
schema
&&
This
->
items
[
i
].
schema
.
vt
!=
VT_EMPTY
)
{
if
(
propvar_cmp
(
schema
,
&
This
->
items
[
i
].
schema
)
!=
0
)
continue
;
}
if
(
propvar_cmp
(
id
,
&
This
->
items
[
i
].
id
)
!=
0
)
continue
;
hr
=
value
?
PropVariantCopy
(
value
,
&
This
->
items
[
i
].
value
)
:
S_OK
;
break
;
}
LeaveCriticalSection
(
&
This
->
lock
);
return
hr
;
}
static
HRESULT
WINAPI
MetadataHandler_GetEnumerator
(
IWICMetadataWriter
*
iface
,
...
...
dlls/windowscodecs/tests/metadata.c
View file @
8b30ef11
...
...
@@ -726,7 +726,46 @@ static void test_metadata_IFD(void)
PropVariantClear
(
&
value
);
hr
=
IWICMetadataReader_GetValueByIndex
(
reader
,
count
,
&
schema
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"GetValueByIndex should fail
\n
"
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %#x
\n
"
,
hr
);
PropVariantInit
(
&
schema
);
PropVariantInit
(
&
id
);
PropVariantInit
(
&
value
);
hr
=
IWICMetadataReader_GetValue
(
reader
,
&
schema
,
&
id
,
&
value
);
ok
(
hr
==
WINCODEC_ERR_PROPERTYNOTFOUND
,
"expected WINCODEC_ERR_PROPERTYNOTFOUND, got %#x
\n
"
,
hr
);
hr
=
IWICMetadataReader_GetValue
(
reader
,
NULL
,
&
id
,
NULL
);
ok
(
hr
==
WINCODEC_ERR_PROPERTYNOTFOUND
,
"expected WINCODEC_ERR_PROPERTYNOTFOUND, got %#x
\n
"
,
hr
);
hr
=
IWICMetadataReader_GetValue
(
reader
,
&
schema
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %#x
\n
"
,
hr
);
hr
=
IWICMetadataReader_GetValue
(
reader
,
&
schema
,
&
id
,
NULL
);
ok
(
hr
==
WINCODEC_ERR_PROPERTYNOTFOUND
,
"expected WINCODEC_ERR_PROPERTYNOTFOUND, got %#x
\n
"
,
hr
);
hr
=
IWICMetadataReader_GetValue
(
reader
,
&
schema
,
NULL
,
&
value
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %#x
\n
"
,
hr
);
id
.
vt
=
VT_UI2
;
U
(
id
).
uiVal
=
0xf00e
;
hr
=
IWICMetadataReader_GetValue
(
reader
,
NULL
,
&
id
,
NULL
);
ok
(
hr
==
S_OK
,
"GetValue error %#x
\n
"
,
hr
);
/* schema is ignored by Ifd metadata reader */
schema
.
vt
=
VT_UI4
;
U
(
schema
).
ulVal
=
0xdeadbeef
;
hr
=
IWICMetadataReader_GetValue
(
reader
,
&
schema
,
&
id
,
&
value
);
ok
(
hr
==
S_OK
,
"GetValue error %#x
\n
"
,
hr
);
ok
(
value
.
vt
==
VT_LPSTR
,
"unexpected vt: %i
\n
"
,
id
.
vt
);
ok
(
!
strcmp
(
U
(
value
).
pszVal
,
"Hello World!"
),
"unexpected value: %s
\n
"
,
U
(
value
).
pszVal
);
PropVariantClear
(
&
value
);
hr
=
IWICMetadataReader_GetValue
(
reader
,
NULL
,
&
id
,
&
value
);
ok
(
hr
==
S_OK
,
"GetValue error %#x
\n
"
,
hr
);
ok
(
value
.
vt
==
VT_LPSTR
,
"unexpected vt: %i
\n
"
,
id
.
vt
);
ok
(
!
strcmp
(
U
(
value
).
pszVal
,
"Hello World!"
),
"unexpected value: %s
\n
"
,
U
(
value
).
pszVal
);
PropVariantClear
(
&
value
);
hr
=
IWICMetadataReader_QueryInterface
(
reader
,
&
IID_IWICMetadataBlockReader
,
(
void
**
)
&
blockreader
);
ok
(
hr
==
E_NOINTERFACE
,
"QueryInterface failed, hr=%x
\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