Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
b0d7c77b
Commit
b0d7c77b
authored
Jun 08, 2011
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lua: return nil when the stream or file ends (fix #4876)
parent
31532669
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
modules/lua/libs/net.c
modules/lua/libs/net.c
+4
-1
modules/lua/libs/stream.c
modules/lua/libs/stream.c
+5
-1
No files found.
modules/lua/libs/net.c
View file @
b0d7c77b
...
@@ -265,7 +265,10 @@ static int vlclua_fd_read( lua_State *L )
...
@@ -265,7 +265,10 @@ static int vlclua_fd_read( lua_State *L )
size_t
i_len
=
luaL_optint
(
L
,
2
,
1
);
size_t
i_len
=
luaL_optint
(
L
,
2
,
1
);
char
psz_buffer
[
i_len
];
char
psz_buffer
[
i_len
];
ssize_t
i_ret
=
read
(
i_fd
,
psz_buffer
,
i_len
);
ssize_t
i_ret
=
read
(
i_fd
,
psz_buffer
,
i_len
);
lua_pushlstring
(
L
,
psz_buffer
,
(
i_ret
>=
0
)
?
i_ret
:
0
);
if
(
i_ret
>
0
)
lua_pushlstring
(
L
,
psz_buffer
,
i_ret
);
else
lua_pushnil
(
L
);
return
1
;
return
1
;
}
}
...
...
modules/lua/libs/stream.c
View file @
b0d7c77b
...
@@ -108,8 +108,12 @@ static int vlclua_stream_read( lua_State *L )
...
@@ -108,8 +108,12 @@ static int vlclua_stream_read( lua_State *L )
int
n
=
luaL_checkint
(
L
,
2
);
int
n
=
luaL_checkint
(
L
,
2
);
uint8_t
*
p_read
=
malloc
(
n
);
uint8_t
*
p_read
=
malloc
(
n
);
if
(
!
p_read
)
return
vlclua_error
(
L
);
if
(
!
p_read
)
return
vlclua_error
(
L
);
i_read
=
stream_Read
(
*
pp_stream
,
p_read
,
n
);
i_read
=
stream_Read
(
*
pp_stream
,
p_read
,
n
);
lua_pushlstring
(
L
,
(
const
char
*
)
p_read
,
i_read
);
if
(
i_read
>
0
)
lua_pushlstring
(
L
,
(
const
char
*
)
p_read
,
i_read
);
else
lua_pushnil
(
L
);
free
(
p_read
);
free
(
p_read
);
return
1
;
return
1
;
}
}
...
...
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