Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 21, 2015, 7:05:53 PM (9 years ago)
Author:
muemart
Message:

Run clang-modernize -loop-convert

  • Again, not all possible loops were converted
  • It can do pretty cool transformations, but I had to fix a few compile errors, so there might be some runtime errors lurking around too
Location:
code/branches/cpp11_v2/src/libraries/network
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/libraries/network/FunctionCall.cc

    r10765 r10821  
    131131  *(uint32_t*)(mem+2*sizeof(uint32_t)) = this->objectID_;
    132132  mem += 3*sizeof(uint32_t);
    133   for( std::vector<MultiType>::iterator it = this->arguments_.begin(); it!=this->arguments_.end(); ++it )
     133  for(auto & elem : this->arguments_)
    134134  {
    135     it->exportData( mem );
     135    elem.exportData( mem );
    136136  }
    137137}
  • code/branches/cpp11_v2/src/libraries/network/Host.cc

    r10768 r10821  
    8080  void Host::addPacket(ENetPacket *packet, int clientID, uint8_t channelID)
    8181  {
    82     for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
     82    for(auto & instances_ : instances_s)
    8383    {
    84       if( (*it)->isActive() )
     84      if( (instances_)->isActive() )
    8585      {
    86         (*it)->queuePacket(packet, clientID, channelID);
     86        (instances_)->queuePacket(packet, clientID, channelID);
    8787      }
    8888    }
     
    9797  void Host::sendChat(const std::string& message, unsigned int sourceID, unsigned int targetID)
    9898  {
    99     for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
    100       if( (*it)->isActive() )
    101         (*it)->doSendChat(message, sourceID, targetID);
     99    for(auto & instances_ : instances_s)
     100      if( (instances_)->isActive() )
     101        (instances_)->doSendChat(message, sourceID, targetID);
    102102  }
    103103
     
    114114  bool Host::isServer()
    115115  {
    116     for (std::vector<Host*>::iterator it=instances_s.begin(); it!=instances_s.end(); ++it )
     116    for (auto & instances_ : instances_s)
    117117    {
    118       if( (*it)->isActive() )
     118      if( (instances_)->isActive() )
    119119      {
    120         if( (*it)->isServer_() )
     120        if( (instances_)->isServer_() )
    121121          return true;
    122122      }
  • code/branches/cpp11_v2/src/libraries/network/synchronisable/Synchronisable.cc

    r10768 r10821  
    8888    }
    8989    // delete all Synchronisable Variables from syncList_ ( which are also in stringList_ )
    90     for(std::vector<SynchronisableVariableBase*>::iterator it = syncList_.begin(); it!=syncList_.end(); it++)
    91       delete (*it);
     90    for(auto & elem : syncList_)
     91      delete (elem);
    9292    syncList_.clear();
    9393    stringList_.clear();
Note: See TracChangeset for help on using the changeset viewer.