Ticket #1064: iterator-fix.patch

File iterator-fix.patch, 10.2 KB (added by Echelon9, 12 years ago)

Proposed fix for STL iterators prefix/suffix increment

  • source/ps/Profile.cpp

     
    274274CProfileNode::~CProfileNode()
    275275{
    276276    profile_iterator it;
    277     for( it = children.begin(); it != children.end(); it++ )
     277    for( it = children.begin(); it != children.end(); ++it )
    278278        delete( *it ); 
    279     for( it = script_children.begin(); it != script_children.end(); it++ )
     279    for( it = script_children.begin(); it != script_children.end(); ++it )
    280280        delete( *it );
    281281   
    282282    delete display_table;
     
    323323const CProfileNode* CProfileNode::GetChild( const char* childName ) const
    324324{
    325325    const_profile_iterator it;
    326     for( it = children.begin(); it != children.end(); it++ )
     326    for( it = children.begin(); it != children.end(); ++it )
    327327        if( (*it)->name == childName )
    328328            return( *it );
    329329
     
    333333const CProfileNode* CProfileNode::GetScriptChild( const char* childName ) const
    334334{
    335335    const_profile_iterator it;
    336     for( it = script_children.begin(); it != script_children.end(); it++ )
     336    for( it = script_children.begin(); it != script_children.end(); ++it )
    337337        if( (*it)->name == childName )
    338338            return( *it );
    339339
  • source/ps/CConsole.cpp

     
    257257        for (Iter = m_deqMsgHistory.begin();
    258258             Iter != m_deqMsgHistory.end()
    259259                 && (((i - m_iMsgHistPos + 1) * m_iFontHeight) < m_fHeight);
    260              Iter++)
     260             ++Iter)
    261261        {
    262262            if (i >= m_iMsgHistPos){
    263263                glTranslatef(0.0f, -(float)m_iFontHeight, 0.0f);
  • source/ps/Hotkey.cpp

     
    115115
    116116                std::vector<SKey>::iterator itKey, itKey2;
    117117
    118                 for( itKey = keyCombination.begin(); itKey != keyCombination.end(); itKey++ )
     118                for( itKey = keyCombination.begin(); itKey != keyCombination.end(); ++itKey )
    119119                {
    120120                    SHotkeyMapping bindCode;
    121121
    122122                    bindCode.name = hotkeyName;
    123123                    bindCode.negated = itKey->negated;
    124124
    125                     for( itKey2 = keyCombination.begin(); itKey2 != keyCombination.end(); itKey2++ )
     125                    for( itKey2 = keyCombination.begin(); itKey2 != keyCombination.end(); ++itKey2 )
    126126                    {
    127127                        // Push any auxiliary keys.
    128128                        if( itKey != itKey2 )
     
    149149    {
    150150        KeyMapping& hotkeyMap = mapIt->second;
    151151
    152         for( std::vector<SHotkeyMapping>::iterator it = hotkeyMap.begin(); it != hotkeyMap.end(); it++ )
     152        for( std::vector<SHotkeyMapping>::iterator it = hotkeyMap.begin(); it != hotkeyMap.end(); ++it )
    153153        {
    154154            if( !it->negated )
    155155                continue;
    156156
    157157            bool allNegated = true;
    158158
    159             for( std::vector<SKey>::iterator j = it->requires.begin(); j != it->requires.end(); j++ )
     159            for( std::vector<SKey>::iterator j = it->requires.begin(); j != it->requires.end(); ++j )
    160160                if( !j->negated )
    161161                    allNegated = false;
    162162           
     
    263263    std::vector<const char*> closestMapNames;
    264264    size_t closestMapMatch = 0;
    265265
    266     for( std::vector<SHotkeyMapping>::iterator it = g_HotkeyMap[keycode].begin(); it < g_HotkeyMap[keycode].end(); it++ )
     266    for( std::vector<SHotkeyMapping>::iterator it = g_HotkeyMap[keycode].begin(); it < g_HotkeyMap[keycode].end(); ++it )
    267267    {
    268268        // If a key has been pressed, and this event triggers on its release, skip it.
    269269        // Similarly, if the key's been released and the event triggers on a keypress, skip it.
     
    274274       
    275275        bool accept = true;
    276276
    277         for( std::vector<SKey>::iterator itKey = it->requires.begin(); itKey != it->requires.end(); itKey++ )
     277        for( std::vector<SKey>::iterator itKey = it->requires.begin(); itKey != it->requires.end(); ++itKey )
    278278        {
    279279            bool rqdState = !itKey->negated;
    280280
     
    326326
    327327    // -- KEYUP SECTION --
    328328
    329     for( std::vector<SHotkeyMapping>::iterator it = g_HotkeyMap[keycode].begin(); it < g_HotkeyMap[keycode].end(); it++ )
     329    for( std::vector<SHotkeyMapping>::iterator it = g_HotkeyMap[keycode].begin(); it < g_HotkeyMap[keycode].end(); ++it )
    330330    {
    331331        // If it's a keydown event, won't cause HotKeyUps in anything that doesn't
    332332        // use this key negated => skip them
     
    339339
    340340        bool accept = true;
    341341
    342         for( std::vector<SKey>::iterator itKey = it->requires.begin(); itKey != it->requires.end(); itKey++ )
     342        for( std::vector<SKey>::iterator itKey = it->requires.begin(); itKey != it->requires.end(); ++itKey )
    343343        {
    344344            bool rqdState = !itKey->negated;
    345345
  • source/network/fsm.cpp

     
    126126    bool eval = true;
    127127
    128128    CallbackList::const_iterator it = m_Conditions.begin();
    129     for( ; it != m_Conditions.end(); it++ )
     129    for( ; it != m_Conditions.end(); ++it )
    130130    {
    131131        if ( it->pFunction )
    132132        {
     
    149149    bool result = true;
    150150
    151151    CallbackList::const_iterator it = m_Actions.begin();
    152     for( ; it != m_Actions.end(); it++ )
     152    for( ; it != m_Actions.end(); ++it )
    153153    {
    154154        if ( it->pFunction )
    155155        {
     
    200200{
    201201    // Release transitions
    202202    TransitionList::iterator itTransition = m_Transitions.begin();
    203     for ( ; itTransition < m_Transitions.end(); itTransition++ )
     203    for ( ; itTransition < m_Transitions.end(); ++itTransition )
    204204    {
    205205        CFsmTransition* pCurrTransition = *itTransition;
    206206        if ( !pCurrTransition ) continue;
     
    210210
    211211    // Release events
    212212    EventMap::iterator itEvent = m_Events.begin();
    213     for( ; itEvent != m_Events.end(); itEvent++ )
     213    for( ; itEvent != m_Events.end(); ++itEvent )
    214214    {
    215215        CFsmEvent* pCurrEvent = itEvent->second;
    216216        if ( !pCurrEvent ) continue;
     
    335335
    336336    // Loop through the list of transitions
    337337    TransitionList::const_iterator it = m_Transitions.begin();
    338     for ( ; it != m_Transitions.end(); it++ )
     338    for ( ; it != m_Transitions.end(); ++it )
    339339    {
    340340        CFsmTransition* pCurrTransition = *it;
    341341        if ( !pCurrTransition ) continue;
  • source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp

     
    7676    const std::map<CStrW, CCinemaPath>& paths = g_Game->GetView()->GetCinema()->GetAllPaths();
    7777    std::vector<sCinemaPath> atlasPaths;
    7878
    79     for ( std::map<CStrW, CCinemaPath>::const_iterator it=paths.begin(); it!=paths.end(); it++  )
     79    for ( std::map<CStrW, CCinemaPath>::const_iterator it=paths.begin(); it!=paths.end(); ++it  )
    8080    {
    8181        sCinemaPath path = ConstructCinemaPath(&it->second);   
    8282        path.name = it->first;
     
    108108{
    109109    std::map<CStrW, CCinemaPath> paths;
    110110   
    111     for ( std::vector<sCinemaPath>::const_iterator it=atlasPaths.begin(); it!=atlasPaths.end(); it++ )
     111    for ( std::vector<sCinemaPath>::const_iterator it=atlasPaths.begin(); it!=atlasPaths.end(); ++it )
    112112    {
    113113        CStrW pathName(*it->name);
    114114        paths[pathName] = CCinemaPath();
  • source/graphics/MapWriter.cpp

     
    342342        {
    343343            XML_Element("Paths");
    344344
    345             for ( ; it != paths.end(); it++ )
     345            for ( ; it != paths.end(); ++it )
    346346            {
    347347                CStrW name = it->first;
    348348                float timescale = it->second.GetTimescale();
  • source/scripting/ScriptableObject.h

     
    240240    {
    241241        JSFunctionSpec* JSI_methods = new JSFunctionSpec[ m_Methods.size() + 1 ];
    242242        size_t MethodID;
    243         for( MethodID = 0; MethodID < m_Methods.size(); MethodID++ )
     243        for( MethodID = 0; MethodID < m_Methods.size(); ++MethodID )
    244244            JSI_methods[MethodID] = m_Methods[MethodID];
    245245
    246246        JSI_methods[MethodID].name = 0;
     
    255255    static void ScriptingShutdown()
    256256    {
    257257        PropertyTable::iterator it;
    258         for( it = m_NativeProperties.begin(); it != m_NativeProperties.end(); it++ )
     258        for( it = m_NativeProperties.begin(); it != m_NativeProperties.end(); ++it )
    259259            delete( it->second );
    260260        m_NativeProperties.clear();
    261261    }
     
    451451    void Shutdown()
    452452    {
    453453        PropertyTable::iterator it;
    454         for( it = m_ScriptProperties.begin(); it != m_ScriptProperties.end(); it++ )
     454        for( it = m_ScriptProperties.begin(); it != m_ScriptProperties.end(); ++it )
    455455            delete( it->second );
    456456        m_ScriptProperties.clear();
    457457        ReleaseScriptObject();
    458458#ifdef ALLOW_NONSHARED_NATIVES
    459         for( it = m_NonsharedProperties.begin(); it != m_NonsharedProperties.end(); it++ )
     459        for( it = m_NonsharedProperties.begin(); it != m_NonsharedProperties.end(); ++it )
    460460            delete( it->second );
    461461        m_NonsharedProperties.clear();
    462462#endif
  • source/renderer/TerrainRenderer.cpp

     
    171171bool TerrainRenderer::CullPatches(const CFrustum* frustum)
    172172{
    173173    m->filteredPatches.clear();
    174     for (std::vector<CPatchRData*>::iterator it = m->visiblePatches.begin(); it != m->visiblePatches.end(); it++)
     174    for (std::vector<CPatchRData*>::iterator it = m->visiblePatches.begin(); it != m->visiblePatches.end(); ++it)
    175175    {
    176176        if (frustum->IsBoxVisible(CVector3D(0, 0, 0), (*it)->GetPatch()->GetWorldBounds()))
    177177            m->filteredPatches.push_back(*it);
    178178    }
    179179
    180180    m->filteredDecals.clear();
    181     for (std::vector<CDecalRData*>::iterator it = m->visibleDecals.begin(); it != m->visibleDecals.end(); it++)
     181    for (std::vector<CDecalRData*>::iterator it = m->visibleDecals.begin(); it != m->visibleDecals.end(); ++it)
    182182    {
    183183        if (frustum->IsBoxVisible(CVector3D(0, 0, 0), (*it)->GetDecal()->GetWorldBounds()))
    184184            m->filteredDecals.push_back(*it);
  • source/simulation2/components/CCmpRallyPointRenderer.cpp

     
    841841        }
    842842        else
    843843        {
    844             it++;
     844            ++it;
    845845        }
    846846    }
    847847}