Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
77a5fef9
Commit
77a5fef9
authored
Oct 12, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net_Read, net_Write use void pointer for data
parent
918910e2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
+15
-8
include/vlc_network.h
include/vlc_network.h
+2
-2
src/network/io.c
src/network/io.c
+13
-6
No files found.
include/vlc_network.h
View file @
77a5fef9
...
@@ -143,10 +143,10 @@ struct virtual_socket_t
...
@@ -143,10 +143,10 @@ struct virtual_socket_t
};
};
#define net_Read(a,b,c,d,e,f) __net_Read(VLC_OBJECT(a),b,c,d,e,f)
#define net_Read(a,b,c,d,e,f) __net_Read(VLC_OBJECT(a),b,c,d,e,f)
VLC_EXPORT
(
ssize_t
,
__net_Read
,
(
vlc_object_t
*
p_this
,
int
fd
,
const
v_socket_t
*
,
uint8_t
*
p_data
,
size_t
i_data
,
bool
b_retry
)
);
VLC_EXPORT
(
ssize_t
,
__net_Read
,
(
vlc_object_t
*
p_this
,
int
fd
,
const
v_socket_t
*
,
void
*
p_data
,
size_t
i_data
,
bool
b_retry
)
);
#define net_Write(a,b,c,d,e) __net_Write(VLC_OBJECT(a),b,c,d,e)
#define net_Write(a,b,c,d,e) __net_Write(VLC_OBJECT(a),b,c,d,e)
VLC_EXPORT
(
ssize_t
,
__net_Write
,
(
vlc_object_t
*
p_this
,
int
fd
,
const
v_socket_t
*
,
const
uint8_t
*
p_data
,
size_t
i_data
)
);
VLC_EXPORT
(
ssize_t
,
__net_Write
,
(
vlc_object_t
*
p_this
,
int
fd
,
const
v_socket_t
*
,
const
void
*
p_data
,
size_t
i_data
)
);
#define net_Gets(a,b,c) __net_Gets(VLC_OBJECT(a),b,c)
#define net_Gets(a,b,c) __net_Gets(VLC_OBJECT(a),b,c)
VLC_EXPORT
(
char
*
,
__net_Gets
,
(
vlc_object_t
*
p_this
,
int
fd
,
const
v_socket_t
*
)
);
VLC_EXPORT
(
char
*
,
__net_Gets
,
(
vlc_object_t
*
p_this
,
int
fd
,
const
v_socket_t
*
)
);
...
...
src/network/io.c
View file @
77a5fef9
...
@@ -288,7 +288,7 @@ int *net_Listen (vlc_object_t *p_this, const char *psz_host,
...
@@ -288,7 +288,7 @@ int *net_Listen (vlc_object_t *p_this, const char *psz_host,
*****************************************************************************/
*****************************************************************************/
ssize_t
ssize_t
__net_Read
(
vlc_object_t
*
restrict
p_this
,
int
fd
,
const
v_socket_t
*
vs
,
__net_Read
(
vlc_object_t
*
restrict
p_this
,
int
fd
,
const
v_socket_t
*
vs
,
uint8_t
*
restrict
p_buf
,
size_t
i_buflen
,
bool
waitall
)
void
*
restrict
p_buf
,
size_t
i_buflen
,
bool
waitall
)
{
{
size_t
i_total
=
0
;
size_t
i_total
=
0
;
struct
pollfd
ufd
[
2
]
=
{
struct
pollfd
ufd
[
2
]
=
{
...
@@ -394,7 +394,7 @@ __net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
...
@@ -394,7 +394,7 @@ __net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
break
;
// EOF
break
;
// EOF
i_total
+=
n
;
i_total
+=
n
;
p_buf
+=
n
;
p_buf
=
(
char
*
)
p_buf
+
n
;
i_buflen
-=
n
;
i_buflen
-=
n
;
if
(
!
waitall
)
if
(
!
waitall
)
...
@@ -412,7 +412,7 @@ silent:
...
@@ -412,7 +412,7 @@ silent:
/* Write exact amount requested */
/* Write exact amount requested */
ssize_t
__net_Write
(
vlc_object_t
*
p_this
,
int
fd
,
const
v_socket_t
*
p_vs
,
ssize_t
__net_Write
(
vlc_object_t
*
p_this
,
int
fd
,
const
v_socket_t
*
p_vs
,
const
uint8_t
*
p_data
,
size_t
i_data
)
const
void
*
restrict
p_data
,
size_t
i_data
)
{
{
size_t
i_total
=
0
;
size_t
i_total
=
0
;
struct
pollfd
ufd
[
2
]
=
{
struct
pollfd
ufd
[
2
]
=
{
...
@@ -473,7 +473,7 @@ ssize_t __net_Write( vlc_object_t *p_this, int fd, const v_socket_t *p_vs,
...
@@ -473,7 +473,7 @@ ssize_t __net_Write( vlc_object_t *p_this, int fd, const v_socket_t *p_vs,
break
;
break
;
}
}
p_data
+=
val
;
p_data
=
(
const
char
*
)
p_data
+
val
;
i_data
-=
val
;
i_data
-=
val
;
i_total
+=
val
;
i_total
+=
val
;
}
}
...
@@ -485,6 +485,13 @@ error:
...
@@ -485,6 +485,13 @@ error:
return
-
1
;
return
-
1
;
}
}
/**
* Reads a line from a file descriptor.
* This function is not thread-safe; the same file descriptor cI/O annot be read
* by another thread at the same time (although it can be written to).
*
* @return nul-terminated heap-allocated string, or NULL on I/O error.
*/
char
*
__net_Gets
(
vlc_object_t
*
p_this
,
int
fd
,
const
v_socket_t
*
p_vs
)
char
*
__net_Gets
(
vlc_object_t
*
p_this
,
int
fd
,
const
v_socket_t
*
p_vs
)
{
{
char
*
psz_line
=
NULL
,
*
ptr
=
NULL
;
char
*
psz_line
=
NULL
,
*
ptr
=
NULL
;
...
@@ -500,7 +507,7 @@ char *__net_Gets( vlc_object_t *p_this, int fd, const v_socket_t *p_vs )
...
@@ -500,7 +507,7 @@ char *__net_Gets( vlc_object_t *p_this, int fd, const v_socket_t *p_vs )
ptr
=
psz_line
+
i_line
;
ptr
=
psz_line
+
i_line
;
}
}
if
(
net_Read
(
p_this
,
fd
,
p_vs
,
(
uint8_t
*
)
ptr
,
1
,
true
)
!=
1
)
if
(
net_Read
(
p_this
,
fd
,
p_vs
,
ptr
,
1
,
true
)
!=
1
)
{
{
if
(
i_line
==
0
)
if
(
i_line
==
0
)
{
{
...
@@ -546,7 +553,7 @@ ssize_t __net_vaPrintf( vlc_object_t *p_this, int fd, const v_socket_t *p_vs,
...
@@ -546,7 +553,7 @@ ssize_t __net_vaPrintf( vlc_object_t *p_this, int fd, const v_socket_t *p_vs,
int
i_size
=
vasprintf
(
&
psz
,
psz_fmt
,
args
);
int
i_size
=
vasprintf
(
&
psz
,
psz_fmt
,
args
);
if
(
i_size
==
-
1
)
if
(
i_size
==
-
1
)
return
-
1
;
return
-
1
;
i_ret
=
__net_Write
(
p_this
,
fd
,
p_vs
,
(
uint8_t
*
)
psz
,
i_size
)
<
i_size
i_ret
=
__net_Write
(
p_this
,
fd
,
p_vs
,
psz
,
i_size
)
<
i_size
?
-
1
:
i_size
;
?
-
1
:
i_size
;
free
(
psz
);
free
(
psz
);
...
...
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