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
1202f7e6
Commit
1202f7e6
authored
Jun 26, 2011
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lua_demux: return nil when read/peek fails.
parent
6e5543ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
modules/lua/demux.c
modules/lua/demux.c
+15
-4
No files found.
modules/lua/demux.c
View file @
1202f7e6
...
...
@@ -60,8 +60,12 @@ static int vlclua_demux_peek( lua_State *L )
demux_t
*
p_demux
=
(
demux_t
*
)
vlclua_get_this
(
L
);
int
n
=
luaL_checkint
(
L
,
1
);
const
uint8_t
*
p_peek
;
int
i_peek
=
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
n
);
lua_pushlstring
(
L
,
(
const
char
*
)
p_peek
,
i_peek
);
if
(
i_peek
>
0
)
lua_pushlstring
(
L
,
(
const
char
*
)
p_peek
,
i_peek
);
else
lua_pushnil
(
L
);
return
1
;
}
...
...
@@ -71,9 +75,16 @@ static int vlclua_demux_read( lua_State *L )
const
uint8_t
*
p_read
;
int
n
=
luaL_checkint
(
L
,
1
);
int
i_read
=
stream_Peek
(
p_demux
->
s
,
&
p_read
,
n
);
lua_pushlstring
(
L
,
(
const
char
*
)
p_read
,
i_read
);
int
i_seek
=
stream_Read
(
p_demux
->
s
,
NULL
,
i_read
);
assert
(
i_read
==
i_seek
);
if
(
i_read
>
0
)
{
lua_pushlstring
(
L
,
(
const
char
*
)
p_read
,
i_read
);
int
i_seek
=
stream_Read
(
p_demux
->
s
,
NULL
,
i_read
);
assert
(
i_read
==
i_seek
);
}
else
lua_pushnil
(
L
);
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