Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zsolt Vadász
wine
Commits
e93125f3
Commit
e93125f3
authored
13 years ago
by
Nikolay Sivov
Committed by
Alexandre Julliard
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
msxml3: Basic support for encoding property.
parent
92668f1d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/msxml3/mxwriter.c
+28
-4
28 additions, 4 deletions
dlls/msxml3/mxwriter.c
dlls/msxml3/tests/saxreader.c
+38
-0
38 additions, 0 deletions
dlls/msxml3/tests/saxreader.c
with
66 additions
and
4 deletions
dlls/msxml3/mxwriter.c
+
28
−
4
View file @
e93125f3
...
...
@@ -46,6 +46,7 @@ typedef struct _mxwriter
LONG
ref
;
VARIANT_BOOL
standalone
;
BSTR
encoding
;
IStream
*
dest
;
}
mxwriter
;
...
...
@@ -107,6 +108,7 @@ static ULONG WINAPI mxwriter_Release(IMXWriter *iface)
if
(
!
ref
)
{
if
(
This
->
dest
)
IStream_Release
(
This
->
dest
);
SysFreeString
(
This
->
encoding
);
heap_free
(
This
);
}
...
...
@@ -232,16 +234,35 @@ static HRESULT WINAPI mxwriter_get_output(IMXWriter *iface, VARIANT *dest)
static
HRESULT
WINAPI
mxwriter_put_encoding
(
IMXWriter
*
iface
,
BSTR
encoding
)
{
static
const
WCHAR
utf16W
[]
=
{
'U'
,
'T'
,
'F'
,
'-'
,
'1'
,
'6'
,
0
};
static
const
WCHAR
utf8W
[]
=
{
'U'
,
'T'
,
'F'
,
'-'
,
'8'
,
0
};
mxwriter
*
This
=
impl_from_IMXWriter
(
iface
);
FIXME
(
"(%p)->(%s)
\n
"
,
This
,
debugstr_w
(
encoding
));
return
E_NOTIMPL
;
TRACE
(
"(%p)->(%s)
\n
"
,
This
,
debugstr_w
(
encoding
));
/* FIXME: filter all supported encodings */
if
(
!
strcmpW
(
encoding
,
utf16W
)
||
!
strcmpW
(
encoding
,
utf8W
))
{
SysFreeString
(
This
->
encoding
);
This
->
encoding
=
SysAllocString
(
encoding
);
return
S_OK
;
}
else
{
FIXME
(
"unsupported encoding %s
\n
"
,
debugstr_w
(
encoding
));
return
E_INVALIDARG
;
}
}
static
HRESULT
WINAPI
mxwriter_get_encoding
(
IMXWriter
*
iface
,
BSTR
*
encoding
)
{
mxwriter
*
This
=
impl_from_IMXWriter
(
iface
);
FIXME
(
"(%p)->(%p)
\n
"
,
This
,
encoding
);
return
E_NOTIMPL
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
encoding
);
if
(
!
encoding
)
return
E_POINTER
;
return
return_bstr
(
This
->
encoding
,
encoding
);
}
static
HRESULT
WINAPI
mxwriter_put_byteOrderMark
(
IMXWriter
*
iface
,
VARIANT_BOOL
writeBOM
)
...
...
@@ -532,6 +553,7 @@ static const struct ISAXContentHandlerVtbl mxwriter_saxcontent_vtbl =
HRESULT
MXWriter_create
(
IUnknown
*
pUnkOuter
,
void
**
ppObj
)
{
static
const
WCHAR
utf16W
[]
=
{
'U'
,
'T'
,
'F'
,
'-'
,
'1'
,
'6'
,
0
};
mxwriter
*
This
;
TRACE
(
"(%p,%p)
\n
"
,
pUnkOuter
,
ppObj
);
...
...
@@ -547,6 +569,8 @@ HRESULT MXWriter_create(IUnknown *pUnkOuter, void **ppObj)
This
->
ref
=
1
;
This
->
standalone
=
VARIANT_FALSE
;
This
->
encoding
=
SysAllocString
(
utf16W
);
This
->
dest
=
NULL
;
*
ppObj
=
&
This
->
IMXWriter_iface
;
...
...
This diff is collapsed.
Click to expand it.
dlls/msxml3/tests/saxreader.c
+
38
−
0
View file @
e93125f3
...
...
@@ -691,9 +691,13 @@ static void test_mxwriter_contenthandler(void)
static
void
test_mxwriter_properties
(
void
)
{
static
const
WCHAR
utf16W
[]
=
{
'U'
,
'T'
,
'F'
,
'-'
,
'1'
,
'6'
,
0
};
static
const
WCHAR
emptyW
[]
=
{
0
};
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
IMXWriter
*
writer
;
VARIANT_BOOL
b
;
HRESULT
hr
;
BSTR
str
,
str2
;
hr
=
CoCreateInstance
(
&
CLSID_MXXMLWriter
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IMXWriter
,
(
void
**
)
&
writer
);
...
...
@@ -716,6 +720,40 @@ static void test_mxwriter_properties(void)
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
b
==
VARIANT_TRUE
,
"got %d
\n
"
,
b
);
hr
=
IMXWriter_get_encoding
(
writer
,
NULL
);
ok
(
hr
==
E_POINTER
,
"got %08x
\n
"
,
hr
);
/* UTF-16 is a default setting apparently */
str
=
(
void
*
)
0xdeadbeef
;
hr
=
IMXWriter_get_encoding
(
writer
,
&
str
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
lstrcmpW
(
str
,
utf16W
)
==
0
,
"expected empty string, got %s
\n
"
,
wine_dbgstr_w
(
str
));
str2
=
(
void
*
)
0xdeadbeef
;
hr
=
IMXWriter_get_encoding
(
writer
,
&
str2
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
str
!=
str2
,
"expected newly allocated, got same %p
\n
"
,
str
);
SysFreeString
(
str2
);
SysFreeString
(
str
);
/* put empty string */
str
=
SysAllocString
(
emptyW
);
hr
=
IMXWriter_put_encoding
(
writer
,
str
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
SysFreeString
(
str
);
str
=
(
void
*
)
0xdeadbeef
;
hr
=
IMXWriter_get_encoding
(
writer
,
&
str
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
lstrcmpW
(
str
,
utf16W
)
==
0
,
"expected empty string, got %s
\n
"
,
wine_dbgstr_w
(
str
));
/* invalid encoding name */
str
=
SysAllocString
(
testW
);
hr
=
IMXWriter_put_encoding
(
writer
,
str
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
SysFreeString
(
str
);
IMXWriter_Release
(
writer
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment