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
e93125f3
Commit
e93125f3
authored
May 01, 2011
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 02, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Basic support for encoding property.
parent
92668f1d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
4 deletions
+66
-4
mxwriter.c
dlls/msxml3/mxwriter.c
+28
-4
saxreader.c
dlls/msxml3/tests/saxreader.c
+38
-0
No files found.
dlls/msxml3/mxwriter.c
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
;
...
...
dlls/msxml3/tests/saxreader.c
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
);
}
...
...
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