Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
f929e866
Commit
f929e866
authored
Oct 13, 2012
by
KO Myung-Hun
Committed by
Rémi Denis-Courmont
Oct 13, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input: Allocate an enough buffer for
UTF-8
Signed-off-by:
Rémi Denis-Courmont
<
remi@remlab.net
>
parent
9c1d3543
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
src/input/stream.c
src/input/stream.c
+7
-3
No files found.
src/input/stream.c
View file @
f929e866
...
@@ -1597,16 +1597,20 @@ char *stream_ReadLine( stream_t *s )
...
@@ -1597,16 +1597,20 @@ char *stream_ReadLine( stream_t *s )
i_line
+=
s
->
p_text
->
i_char_width
;
/* the added \0 */
i_line
+=
s
->
p_text
->
i_char_width
;
/* the added \0 */
if
(
s
->
p_text
->
i_char_width
>
1
)
if
(
s
->
p_text
->
i_char_width
>
1
)
{
{
int
i_new_line
=
0
;
size_t
i_in
=
0
,
i_out
=
0
;
size_t
i_in
=
0
,
i_out
=
0
;
const
char
*
p_in
=
NULL
;
const
char
*
p_in
=
NULL
;
char
*
p_out
=
NULL
;
char
*
p_out
=
NULL
;
char
*
psz_new_line
=
NULL
;
char
*
psz_new_line
=
NULL
;
/* iconv */
/* iconv */
psz_new_line
=
malloc
(
i_line
);
/* UTF-8 needs at most 150% of the buffer as many as UTF-16 */
i_new_line
=
i_line
*
3
/
2
;
psz_new_line
=
malloc
(
i_new_line
);
if
(
psz_new_line
==
NULL
)
if
(
psz_new_line
==
NULL
)
goto
error
;
goto
error
;
i_in
=
i_out
=
(
size_t
)
i_line
;
i_in
=
(
size_t
)
i_line
;
i_out
=
(
size_t
)
i_new_line
;
p_in
=
p_line
;
p_in
=
p_line
;
p_out
=
psz_new_line
;
p_out
=
psz_new_line
;
...
@@ -1617,7 +1621,7 @@ char *stream_ReadLine( stream_t *s )
...
@@ -1617,7 +1621,7 @@ char *stream_ReadLine( stream_t *s )
}
}
free
(
p_line
);
free
(
p_line
);
p_line
=
psz_new_line
;
p_line
=
psz_new_line
;
i_line
=
(
size_t
)
i_line
-
i_out
;
/* does not include \0 */
i_line
=
(
size_t
)
i_
new_
line
-
i_out
;
/* does not include \0 */
}
}
/* Remove trailing LF/CR */
/* Remove trailing LF/CR */
...
...
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