Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
5af0a5d4
Commit
5af0a5d4
authored
Feb 17, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stream_ReadLine: handle MacOS-style end-of-line (fixes #2156)
parent
fcead451
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
19 deletions
+24
-19
src/input/stream.c
src/input/stream.c
+24
-19
No files found.
src/input/stream.c
View file @
5af0a5d4
...
@@ -1567,33 +1567,38 @@ char *stream_ReadLine( stream_t *s )
...
@@ -1567,33 +1567,38 @@ char *stream_ReadLine( stream_t *s )
{
{
/* UTF-8: 0A <LF> */
/* UTF-8: 0A <LF> */
psz_eol
=
memchr
(
p_data
,
'\n'
,
i_data
);
psz_eol
=
memchr
(
p_data
,
'\n'
,
i_data
);
if
(
psz_eol
==
NULL
)
/* UTF-8: 0D <CR> */
psz_eol
=
memchr
(
p_data
,
'\r'
,
i_data
);
}
}
else
else
{
{
const
uint8_t
*
p
=
p_data
;
const
uint8_t
*
p
_last
=
p_data
+
i_data
-
s
->
p_text
->
i_char_width
;
const
uint8_t
*
p_last
=
p
+
i_data
-
s
->
p_text
->
i_char_width
;
uint16_t
eol
=
s
->
p_text
->
b_little_endian
?
0x0A00
:
0x00A0
;
assert
(
s
->
p_text
->
i_char_width
==
2
);
assert
(
s
->
p_text
->
i_char_width
==
2
);
if
(
s
->
p_text
->
b_little_endian
==
true
)
psz_eol
=
NULL
;
/* UTF-16: 000A <LF> */
for
(
const
uint8_t
*
p
=
p_data
;
p
<=
p_last
;
p
+=
2
)
{
{
/* UTF-16LE: 0A 00 <LF> */
if
(
U16_AT
(
p
)
==
eol
)
while
(
p
<=
p_last
&&
(
p
[
0
]
!=
0x0A
||
p
[
1
]
!=
0x00
)
)
{
p
+=
2
;
psz_eol
=
(
char
*
)
p
+
1
;
}
break
;
else
}
{
/* UTF-16BE: 00 0A <LF> */
while
(
p
<=
p_last
&&
(
p
[
1
]
!=
0x0A
||
p
[
0
]
!=
0x00
)
)
p
+=
2
;
}
}
if
(
p
>
p_last
)
if
(
psz_eol
==
NULL
)
{
{
/* UTF-16: 000D <CR> */
psz_eol
=
NULL
;
eol
=
s
->
p_text
->
b_little_endian
?
0x0D00
:
0x00D0
;
}
for
(
const
uint8_t
*
p
=
p_data
;
p
<=
p_last
;
p
+=
2
)
else
{
{
if
(
U16_AT
(
p
)
==
eol
)
psz_eol
=
(
char
*
)
p
+
1
;
{
psz_eol
=
(
char
*
)
p
+
1
;
break
;
}
}
}
}
}
}
...
...
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