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
d1658260
Commit
d1658260
authored
Aug 05, 2015
by
Hans Leidekker
Committed by
Alexandre Julliard
Aug 06, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmllite: Implement CreateXmlWriterOutputWithEncodingCodePage.
parent
afb98a38
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
11 deletions
+65
-11
reader.c
dlls/xmllite/reader.c
+10
-0
writer.c
dlls/xmllite/tests/writer.c
+19
-0
writer.c
dlls/xmllite/writer.c
+34
-10
xmllite.spec
dlls/xmllite/xmllite.spec
+1
-1
xmllite_private.h
dlls/xmllite/xmllite_private.h
+1
-0
No files found.
dlls/xmllite/reader.c
View file @
d1658260
...
...
@@ -160,6 +160,16 @@ const WCHAR *get_encoding_name(xml_encoding encoding)
return
xml_encoding_map
[
encoding
].
name
;
}
xml_encoding
get_encoding_from_codepage
(
UINT
codepage
)
{
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
xml_encoding_map
)
/
sizeof
(
xml_encoding_map
[
0
]);
i
++
)
{
if
(
xml_encoding_map
[
i
].
cp
==
codepage
)
return
xml_encoding_map
[
i
].
enc
;
}
return
XmlEncoding_Unknown
;
}
typedef
struct
{
char
*
data
;
...
...
dlls/xmllite/tests/writer.c
View file @
d1658260
...
...
@@ -36,6 +36,10 @@ static HRESULT (WINAPI *pCreateXmlWriterOutputWithEncodingName)(IUnknown *stream
IMalloc
*
imalloc
,
LPCWSTR
encoding_name
,
IXmlWriterOutput
**
output
);
static
HRESULT
(
WINAPI
*
pCreateXmlWriterOutputWithEncodingCodePage
)(
IUnknown
*
stream
,
IMalloc
*
imalloc
,
UINT
codepage
,
IXmlWriterOutput
**
output
);
static
HRESULT
WINAPI
testoutput_QueryInterface
(
IUnknown
*
iface
,
REFIID
riid
,
void
**
obj
)
{
...
...
@@ -168,6 +172,7 @@ static BOOL init_pointers(void)
#define MAKEFUNC(f) if (!(p##f = (void*)GetProcAddress(mod, #f))) return FALSE;
MAKEFUNC
(
CreateXmlWriter
);
MAKEFUNC
(
CreateXmlWriterOutputWithEncodingName
);
MAKEFUNC
(
CreateXmlWriterOutputWithEncodingCodePage
);
#undef MAKEFUNC
return
TRUE
;
...
...
@@ -193,6 +198,20 @@ static void test_writeroutput(void)
ok
(
unk
!=
NULL
,
"got %p
\n
"
,
unk
);
/* releasing 'unk' crashes on native */
IUnknown_Release
(
output
);
output
=
NULL
;
hr
=
pCreateXmlWriterOutputWithEncodingCodePage
(
&
testoutput
,
NULL
,
~
0u
,
&
output
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
IUnknown_Release
(
output
);
hr
=
pCreateXmlWriterOutputWithEncodingCodePage
(
&
testoutput
,
NULL
,
CP_UTF8
,
&
output
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
unk
=
NULL
;
hr
=
IUnknown_QueryInterface
(
output
,
&
IID_IXmlWriterOutput
,
(
void
**
)
&
unk
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
unk
!=
NULL
,
"got %p
\n
"
,
unk
);
/* releasing 'unk' crashes on native */
IUnknown_Release
(
output
);
}
static
void
test_writestartdocument
(
void
)
...
...
dlls/xmllite/writer.c
View file @
d1658260
...
...
@@ -1085,19 +1085,12 @@ HRESULT WINAPI CreateXmlWriter(REFIID riid, void **obj, IMalloc *imalloc)
return
S_OK
;
}
HRESULT
WINAPI
CreateXmlWriterOutputWithEncodingName
(
IUnknown
*
stream
,
IMalloc
*
imalloc
,
LPCWSTR
encoding
,
IXmlWriterOutput
**
output
)
static
HRESULT
create_writer
(
IUnknown
*
stream
,
IMalloc
*
imalloc
,
xml_encoding
encoding
,
IXmlWriterOutput
**
output
)
{
static
const
WCHAR
utf8W
[]
=
{
'U'
,
'T'
,
'F'
,
'-'
,
'8'
,
0
};
xmlwriteroutput
*
writeroutput
;
HRESULT
hr
;
TRACE
(
"%p %p %s %p
\n
"
,
stream
,
imalloc
,
debugstr_w
(
encoding
),
output
);
if
(
!
stream
||
!
output
)
return
E_INVALIDARG
;
*
output
=
NULL
;
if
(
imalloc
)
...
...
@@ -1110,7 +1103,7 @@ HRESULT WINAPI CreateXmlWriterOutputWithEncodingName(IUnknown *stream,
writeroutput
->
ref
=
1
;
writeroutput
->
imalloc
=
imalloc
;
if
(
imalloc
)
IMalloc_AddRef
(
imalloc
);
writeroutput
->
encoding
=
parse_encoding_name
(
encoding
?
encoding
:
utf8W
,
-
1
)
;
writeroutput
->
encoding
=
encoding
;
writeroutput
->
stream
=
NULL
;
hr
=
init_output_buffer
(
writeroutput
);
if
(
FAILED
(
hr
))
{
...
...
@@ -1126,3 +1119,34 @@ HRESULT WINAPI CreateXmlWriterOutputWithEncodingName(IUnknown *stream,
return
S_OK
;
}
HRESULT
WINAPI
CreateXmlWriterOutputWithEncodingName
(
IUnknown
*
stream
,
IMalloc
*
imalloc
,
LPCWSTR
encoding
,
IXmlWriterOutput
**
output
)
{
static
const
WCHAR
utf8W
[]
=
{
'U'
,
'T'
,
'F'
,
'-'
,
'8'
,
0
};
xml_encoding
xml_enc
;
TRACE
(
"%p %p %s %p
\n
"
,
stream
,
imalloc
,
debugstr_w
(
encoding
),
output
);
if
(
!
stream
||
!
output
)
return
E_INVALIDARG
;
xml_enc
=
parse_encoding_name
(
encoding
?
encoding
:
utf8W
,
-
1
);
return
create_writer
(
stream
,
imalloc
,
xml_enc
,
output
);
}
HRESULT
WINAPI
CreateXmlWriterOutputWithEncodingCodePage
(
IUnknown
*
stream
,
IMalloc
*
imalloc
,
UINT
codepage
,
IXmlWriterOutput
**
output
)
{
xml_encoding
xml_enc
;
TRACE
(
"%p %p %u %p
\n
"
,
stream
,
imalloc
,
codepage
,
output
);
if
(
!
stream
||
!
output
)
return
E_INVALIDARG
;
xml_enc
=
get_encoding_from_codepage
(
codepage
);
return
create_writer
(
stream
,
imalloc
,
xml_enc
,
output
);
}
dlls/xmllite/xmllite.spec
View file @
d1658260
...
...
@@ -2,5 +2,5 @@
@ stub CreateXmlReaderInputWithEncodingCodePage
@ stdcall CreateXmlReaderInputWithEncodingName(ptr ptr ptr long ptr ptr)
@ stdcall CreateXmlWriter(ptr ptr ptr)
@ st
ub CreateXmlWriterOutputWithEncodingCodePage
@ st
dcall CreateXmlWriterOutputWithEncodingCodePage(ptr ptr long ptr)
@ stdcall CreateXmlWriterOutputWithEncodingName(ptr ptr wstr ptr)
dlls/xmllite/xmllite_private.h
View file @
d1658260
...
...
@@ -71,5 +71,6 @@ typedef enum
xml_encoding
parse_encoding_name
(
const
WCHAR
*
,
int
)
DECLSPEC_HIDDEN
;
HRESULT
get_code_page
(
xml_encoding
,
UINT
*
)
DECLSPEC_HIDDEN
;
const
WCHAR
*
get_encoding_name
(
xml_encoding
)
DECLSPEC_HIDDEN
;
xml_encoding
get_encoding_from_codepage
(
UINT
)
DECLSPEC_HIDDEN
;
#endif
/* __XMLLITE_PRIVATE__ */
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