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
fb8fa44b
Commit
fb8fa44b
authored
May 13, 2012
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 14, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Store encoding-codepage mapping in a table.
parent
d5913b5c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
13 deletions
+42
-13
mxwriter.c
dlls/msxml3/mxwriter.c
+42
-13
No files found.
dlls/msxml3/mxwriter.c
View file @
fb8fa44b
...
...
@@ -39,18 +39,33 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
msxml
);
static
const
WCHAR
utf16W
[]
=
{
'U'
,
'T'
,
'F'
,
'-'
,
'1'
,
'6'
,
0
};
static
const
WCHAR
emptyW
[]
=
{
0
};
static
const
WCHAR
spaceW
[]
=
{
' '
};
static
const
WCHAR
quotW
[]
=
{
'\"'
};
/* should be ordered as encoding names are sorted */
typedef
enum
{
XmlEncoding_UTF16
=
0
,
XmlEncoding_UTF8
,
XmlEncoding_UTF16
,
XmlEncoding_Unknown
}
xml_encoding
;
struct
xml_encoding_data
{
const
WCHAR
*
encoding
;
xml_encoding
enc
;
UINT
cp
;
};
static
const
WCHAR
utf16W
[]
=
{
'U'
,
'T'
,
'F'
,
'-'
,
'1'
,
'6'
,
0
};
static
const
WCHAR
utf8W
[]
=
{
'U'
,
'T'
,
'F'
,
'-'
,
'8'
,
0
};
static
const
struct
xml_encoding_data
xml_encoding_map
[]
=
{
{
utf16W
,
XmlEncoding_UTF16
,
~
0
},
/* there's no codepage for this case */
{
utf8W
,
XmlEncoding_UTF8
,
CP_UTF8
}
};
typedef
enum
{
OutputBuffer_Native
=
0x001
,
...
...
@@ -169,9 +184,25 @@ static HRESULT mxattributes_grow(mxattributes *This)
static
xml_encoding
parse_encoding_name
(
const
WCHAR
*
encoding
)
{
static
const
WCHAR
utf8W
[]
=
{
'U'
,
'T'
,
'F'
,
'-'
,
'8'
,
0
};
if
(
!
strcmpiW
(
encoding
,
utf8W
))
return
XmlEncoding_UTF8
;
if
(
!
strcmpiW
(
encoding
,
utf16W
))
return
XmlEncoding_UTF16
;
int
min
,
max
,
n
,
c
;
min
=
0
;
max
=
sizeof
(
xml_encoding_map
)
/
sizeof
(
struct
xml_encoding_data
)
-
1
;
while
(
min
<=
max
)
{
n
=
(
min
+
max
)
/
2
;
c
=
strcmpiW
(
xml_encoding_map
[
n
].
encoding
,
encoding
);
if
(
!
c
)
return
xml_encoding_map
[
n
].
enc
;
if
(
c
>
0
)
max
=
n
-
1
;
else
min
=
n
+
1
;
}
return
XmlEncoding_Unknown
;
}
...
...
@@ -195,19 +226,17 @@ static void free_encoded_buffer(encoded_buffer *buffer)
static
HRESULT
get_code_page
(
xml_encoding
encoding
,
UINT
*
cp
)
{
switch
(
encoding
)
const
struct
xml_encoding_data
*
data
;
if
(
encoding
==
XmlEncoding_Unknown
)
{
case
XmlEncoding_UTF8
:
*
cp
=
CP_UTF8
;
break
;
case
XmlEncoding_UTF16
:
*
cp
=
~
0
;
break
;
default:
FIXME
(
"unsupported encoding %d
\n
"
,
encoding
);
return
E_NOTIMPL
;
}
data
=
&
xml_encoding_map
[
encoding
];
*
cp
=
data
->
cp
;
return
S_OK
;
}
...
...
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