[vlc-devel] commit: Skins2: Use typedefs for internal template-derived types, and rectify an accidental skip while removing. (JP Dinger )
git version control
git at videolan.org
Sat Dec 5 22:35:05 CET 2009
vlc | branch: master | JP Dinger <jpd at videolan.org> | Sat Sep 12 16:36:00 2009 +0200| [dc19df5d43c037fe79275fb5a75328471b5c7bad] | committer: JP Dinger
Skins2: Use typedefs for internal template-derived types, and rectify an accidental skip while removing.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dc19df5d43c037fe79275fb5a75328471b5c7bad
---
modules/gui/skins2/commands/async_queue.cpp | 26 +++++++++++++-------------
modules/gui/skins2/commands/async_queue.hpp | 3 ++-
modules/gui/skins2/commands/cmd_muxer.cpp | 4 ++--
modules/gui/skins2/commands/cmd_muxer.hpp | 3 ++-
4 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/modules/gui/skins2/commands/async_queue.cpp b/modules/gui/skins2/commands/async_queue.cpp
index bd7a071..759ff6a 100644
--- a/modules/gui/skins2/commands/async_queue.cpp
+++ b/modules/gui/skins2/commands/async_queue.cpp
@@ -89,22 +89,22 @@ void AsyncQueue::push( const CmdGenericPtr &rcCommand, bool removePrev )
void AsyncQueue::remove( const string &rType, const CmdGenericPtr &rcCommand )
{
- list<CmdGenericPtr>::iterator it;
- for( it = m_cmdList.begin(); it != m_cmdList.end(); it++ )
+ cmdList_t::iterator it;
+ for( it = m_cmdList.begin(); it != m_cmdList.end(); /* nothing */ )
{
- // Remove the command if it is of the given type
- if( (*it).get()->getType() == rType )
+ // Remove the command if it is of the given type and the command
+ // doesn't disagree. Note trickery to avoid skipping entries
+ // while maintaining iterator validity.
+
+ if( (*it).get()->getType() == rType &&
+ rcCommand.get()->checkRemove( (*it).get() ) )
{
- // Maybe the command wants to check if it must really be
- // removed
- if( rcCommand.get()->checkRemove( (*it).get() ) == true )
- {
- list<CmdGenericPtr>::iterator itNew = it;
- itNew++;
- m_cmdList.erase( it );
- it = itNew;
- }
+ cmdList_t::iterator itNew = it;
+ ++itNew;
+ m_cmdList.erase( it );
+ it = itNew;
}
+ else ++it;
}
}
diff --git a/modules/gui/skins2/commands/async_queue.hpp b/modules/gui/skins2/commands/async_queue.hpp
index 626b210..2a89f11 100644
--- a/modules/gui/skins2/commands/async_queue.hpp
+++ b/modules/gui/skins2/commands/async_queue.hpp
@@ -56,7 +56,8 @@ public:
private:
/// Command queue
- list<CmdGenericPtr> m_cmdList;
+ typedef std::list<CmdGenericPtr> cmdList_t;
+ cmdList_t m_cmdList;
/// Timer
OSTimer *m_pTimer;
/// Mutex
diff --git a/modules/gui/skins2/commands/cmd_muxer.cpp b/modules/gui/skins2/commands/cmd_muxer.cpp
index 9b652eb..9bc45c9 100644
--- a/modules/gui/skins2/commands/cmd_muxer.cpp
+++ b/modules/gui/skins2/commands/cmd_muxer.cpp
@@ -26,8 +26,8 @@
void CmdMuxer::execute()
{
- list<CmdGeneric*>::const_iterator it;
- for( it = m_list.begin(); it != m_list.end(); it++ )
+ cmdList_t::const_iterator it;
+ for( it = m_list.begin(); it != m_list.end(); ++it )
{
(*it)->execute();
}
diff --git a/modules/gui/skins2/commands/cmd_muxer.hpp b/modules/gui/skins2/commands/cmd_muxer.hpp
index 2ca6a9c..c3b9dd6 100644
--- a/modules/gui/skins2/commands/cmd_muxer.hpp
+++ b/modules/gui/skins2/commands/cmd_muxer.hpp
@@ -40,7 +40,8 @@ public:
private:
/// List of commands we will execute sequentially
- list<CmdGeneric*> m_list;
+ typedef std::list<CmdGeneric*> cmdList_t;
+ cmdList_t m_list;
};
#endif
More information about the vlc-devel
mailing list