Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 21, 2016, 1:59:04 PM (9 years ago)
Author:
muemart
Message:

Fix some clang-tidy warnings.
Also, Serialise.h was doing some C-style casts that ended up being const casts. I moved those const casts as close to the source as possible and changed the loadAndIncrease functions to not do that.

Location:
code/trunk/src/libraries/network
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/network/MasterServer.cc

    r11071 r11083  
    253253    /* convert to string */
    254254    std::string ip = std::string( addrconv );
     255    /* output debug info about the data that has come */
     256    helper_output_debug(event, addrconv);
    255257    /* delete addrconv */
    256258    if( addrconv ) free( addrconv );
     
    259261    char * packetdata = (char *)event->packet->data;
    260262
    261     /* output debug info about the data that has come */
    262     helper_output_debug( event, addrconv );
    263263
    264264    /* GAME SERVER OR CLIENT CONNECTION? */
     
    332332  {
    333333    /***** ENTER MAIN LOOP *****/
    334     ENetEvent *event = (ENetEvent *)calloc(sizeof(ENetEvent), sizeof(char));
     334    ENetEvent *event = (ENetEvent *)calloc(1, sizeof(ENetEvent));
    335335    if( event == nullptr )
    336336    {
  • code/trunk/src/libraries/network/packet/Gamestate.cc

    r11071 r11083  
    489489Gamestate* Gamestate::diffVariables(Gamestate *base)
    490490{
    491   assert(this && base); assert(data_ && base->data_);
     491  assert(base); assert(data_ && base->data_);
    492492  assert(!header_.isCompressed() && !base->header_.isCompressed());
    493493  assert(!header_.isDiffed());
  • code/trunk/src/libraries/network/packet/ServerInformation.cc

    r11071 r11083  
    5555      // Save ACK
    5656      uint8_t* temp = event->packet->data;
    57       char* ack = new char[strlen(LAN_DISCOVERY_ACK)+1];
     57      char* ack = nullptr;
    5858      loadAndIncrease((char*&)ack, temp);
    5959
     
    6464      // Save Server Name
    6565      loadAndIncrease(this->serverName_, temp);
     66      delete[] ack;
    6667    }
    6768
     
    7475    {
    7576      std::string payload = this->serverName_ + Ogre::StringConverter::toString(this->clientNumber_);
    76       uint32_t size = returnSize((char*&)LAN_DISCOVERY_ACK) + returnSize(payload);
     77      uint32_t size = returnSize(LAN_DISCOVERY_ACK) + returnSize(payload);
    7778      uint8_t* temp = new uint8_t[size];
    7879      uint8_t* temp2 = temp;
    79       saveAndIncrease((char*&)LAN_DISCOVERY_ACK, temp2);
     80      saveAndIncrease(LAN_DISCOVERY_ACK, temp2);
    8081      saveAndIncrease(payload, temp2);
    8182      ENetPacket* packet = enet_packet_create( temp, size, 0 );
Note: See TracChangeset for help on using the changeset viewer.