[vlc-commits] chromecast: use iterator
Thomas Guillem
git at videolan.org
Fri Jan 19 18:44:20 CET 2018
vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jan 19 14:23:42 2018 +0100| [2b05babab8bb29908b3e62223549ad6900674791] | committer: Jean-Baptiste Kempf
chromecast: use iterator
(cherry picked from commit 1f5411487e1015faf480b4c67b96c69a18f09e65)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=2b05babab8bb29908b3e62223549ad6900674791
---
modules/stream_out/chromecast/cast.cpp | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp
index d5d0e9c75a..0da18a867f 100644
--- a/modules/stream_out/chromecast/cast.cpp
+++ b/modules/stream_out/chromecast/cast.cpp
@@ -220,19 +220,22 @@ static void Del(sout_stream_t *p_stream, sout_stream_id_sys_t *id)
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
- for (size_t i=0; i<p_sys->streams.size(); i++)
+ for (std::vector<sout_stream_id_sys_t*>::iterator it = p_sys->streams.begin();
+ it != p_sys->streams.end(); )
{
- if ( p_sys->streams[i] == id )
+ sout_stream_id_sys_t *p_sys_id = *it;
+ if ( p_sys_id == id )
{
- if ( p_sys->streams[i]->p_sub_id != NULL )
- sout_StreamIdDel( p_sys->p_out, p_sys->streams[i]->p_sub_id );
+ if ( p_sys_id->p_sub_id != NULL )
+ sout_StreamIdDel( p_sys->p_out, p_sys_id->p_sub_id );
- es_format_Clean( &p_sys->streams[i]->fmt );
- free( p_sys->streams[i] );
- p_sys->streams.erase( p_sys->streams.begin() + i );
+ es_format_Clean( &p_sys_id->fmt );
+ free( p_sys_id );
+ p_sys->streams.erase( it );
p_sys->es_changed = true;
break;
}
+ it++;
}
if ( p_sys->streams.empty() )
More information about the vlc-commits
mailing list