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
de653570
Commit
de653570
authored
Jul 05, 2005
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Clean up net_Gets()
parent
ae0c85f8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
25 deletions
+21
-25
src/misc/net.c
src/misc/net.c
+21
-25
No files found.
src/misc/net.c
View file @
de653570
...
...
@@ -896,45 +896,41 @@ int __net_Write( vlc_object_t *p_this, int fd, v_socket_t *p_vs,
char
*
__net_Gets
(
vlc_object_t
*
p_this
,
int
fd
,
v_socket_t
*
p_vs
)
{
char
*
psz_line
=
malloc
(
1024
);
int
i_line
=
0
;
int
i_max
=
1024
;
char
*
psz_line
=
NULL
,
*
ptr
=
NULL
;
size_t
i_line
=
0
,
i_max
=
0
;
for
(
;;
)
{
if
(
net_Read
(
p_this
,
fd
,
p_vs
,
&
psz_line
[
i_line
],
1
,
VLC_TRUE
)
!=
1
)
{
psz_line
[
i_line
]
=
'\0'
;
break
;
}
i_line
++
;
if
(
psz_line
[
i_line
-
1
]
==
'\n'
)
{
psz_line
[
i_line
]
=
'\0'
;
break
;
}
if
(
i_line
>=
i_max
-
1
)
if
(
i_line
==
i_max
)
{
i_max
+=
1024
;
psz_line
=
realloc
(
psz_line
,
i_max
);
}
ptr
=
psz_line
+
i_line
;
}
if
(
i_line
<=
0
)
if
(
net_Read
(
p_this
,
fd
,
p_vs
,
ptr
,
1
,
VLC_TRUE
)
!=
1
)
{
if
(
i_line
==
0
)
{
free
(
psz_line
);
return
NULL
;
}
break
;
}
while
(
i_line
>=
1
&&
(
psz_line
[
i_line
-
1
]
==
'\n'
||
psz_line
[
i_line
-
1
]
==
'\r'
)
)
{
i_line
--
;
p
sz_line
[
i_line
]
=
'\0'
;
if
(
*
ptr
==
'\n'
)
break
;
i_line
++
;
p
tr
++
;
}
*
ptr
--
=
'\0'
;
if
(
(
ptr
>
psz_line
)
&&
(
*
ptr
==
'\r'
)
)
*
ptr
=
'\0'
;
return
psz_line
;
}
...
...
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