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
beffac00
Commit
beffac00
authored
Dec 21, 2012
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 26, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmllite: Shrink buffer when enough data processed.
parent
d8a0da9d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
reader.c
dlls/xmllite/reader.c
+18
-0
No files found.
dlls/xmllite/reader.c
View file @
beffac00
...
@@ -481,6 +481,7 @@ static void readerinput_switchencoding(xmlreaderinput *readerinput, xml_encoding
...
@@ -481,6 +481,7 @@ static void readerinput_switchencoding(xmlreaderinput *readerinput, xml_encoding
{
{
readerinput_grow
(
readerinput
,
len
);
readerinput_grow
(
readerinput
,
len
);
memcpy
(
dest
->
data
,
src
->
cur
,
len
);
memcpy
(
dest
->
data
,
src
->
cur
,
len
);
dest
->
written
+=
len
*
sizeof
(
WCHAR
);
readerinput
->
buffer
->
code_page
=
cp
;
readerinput
->
buffer
->
code_page
=
cp
;
return
;
return
;
}
}
...
@@ -491,6 +492,22 @@ static void readerinput_switchencoding(xmlreaderinput *readerinput, xml_encoding
...
@@ -491,6 +492,22 @@ static void readerinput_switchencoding(xmlreaderinput *readerinput, xml_encoding
MultiByteToWideChar
(
cp
,
0
,
src
->
cur
,
len
,
ptr
,
dest_len
);
MultiByteToWideChar
(
cp
,
0
,
src
->
cur
,
len
,
ptr
,
dest_len
);
ptr
[
dest_len
]
=
0
;
ptr
[
dest_len
]
=
0
;
readerinput
->
buffer
->
code_page
=
cp
;
readerinput
->
buffer
->
code_page
=
cp
;
dest
->
written
+=
dest_len
*
sizeof
(
WCHAR
);
}
/* shrinks parsed data a buffer begins with */
static
void
reader_shrink
(
xmlreader
*
reader
)
{
encoded_buffer
*
buffer
=
&
reader
->
input
->
buffer
->
utf16
;
/* avoid to move too often using threshold shrink length */
if
(
buffer
->
cur
-
buffer
->
data
>
buffer
->
written
/
2
)
{
buffer
->
written
-=
buffer
->
cur
-
buffer
->
data
;
memmove
(
buffer
->
data
,
buffer
->
cur
,
buffer
->
written
);
buffer
->
cur
=
buffer
->
data
;
*
(
WCHAR
*
)
&
buffer
->
cur
[
buffer
->
written
]
=
0
;
}
}
}
static
inline
const
WCHAR
*
reader_get_cur
(
xmlreader
*
reader
)
static
inline
const
WCHAR
*
reader_get_cur
(
xmlreader
*
reader
)
...
@@ -772,6 +789,7 @@ static HRESULT reader_parse_comment(xmlreader *reader)
...
@@ -772,6 +789,7 @@ static HRESULT reader_parse_comment(xmlreader *reader)
/* skip '<!--' */
/* skip '<!--' */
reader_skipn
(
reader
,
4
);
reader_skipn
(
reader
,
4
);
reader_shrink
(
reader
);
ptr
=
start
=
reader_get_cur
(
reader
);
ptr
=
start
=
reader_get_cur
(
reader
);
while
(
*
ptr
)
while
(
*
ptr
)
...
...
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