Changeset 4890 for source/ariba


Ignore:
Timestamp:
Jul 14, 2009, 9:17:10 AM (15 years ago)
Author:
Christoph Mayer
Message:

gcc 4 fixes

Location:
source/ariba
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/communication/modules/transport/protlib/address.cpp

    r4889 r4890  
    66/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/address.cpp $
    77// ===========================================================
    8 //                     
     8//
    99// Copyright (C) 2005-2007, all rights reserved by
    1010// - Institute of Telematics, Universitaet Karlsruhe (TH)
     
    1212// More information and contact:
    1313// https://projekte.tm.uka.de/trac/NSIS
    14 //                     
     14//
    1515// This program is free software; you can redistribute it and/or modify
    1616// it under the terms of the GNU General Public License as published by
     
    5454
    5555/** Set subtype. */
    56 address::address(subtype_t st) 
    57         : subtype(st) 
    58 { 
    59   //Log(DEBUG_LOG,LOG_NORMAL,"address","address constructor called for " << (void *) this); 
     56address::address(subtype_t st)
     57        : subtype(st)
     58{
     59  //Log(DEBUG_LOG,LOG_NORMAL,"address","address constructor called for " << (void *) this);
    6060}
    6161
     
    8383        catch_bad_alloc(ha =  new hostaddress(*this));
    8484        return ha;
    85 } // end copy 
     85} // end copy
    8686
    8787bool hostaddress::operator==(const address& ie) const {
     
    102102
    103103/** Initialize hostaddress from string if possible. */
    104 hostaddress::hostaddress(const char *str, bool *res) 
     104hostaddress::hostaddress(const char *str, bool *res)
    105105        : address(IPv6HostAddress),
    106           ipv4flag(false), 
     106          ipv4flag(false),
    107107          outstring(NULL)
    108108{
     
    118118 * @return true on success.
    119119 */
    120 bool 
     120bool
    121121hostaddress::set_ipv4(const char *str) {
    122122        struct in_addr in;
     
    127127} // end set_ipv4
    128128
    129 /** Set IPv4 address from struct in_addr. 
    130  * This changes object type to IPv4. 
     129/** Set IPv4 address from struct in_addr.
     130 * This changes object type to IPv4.
    131131 */
    132132void hostaddress::set_ip(const struct in_addr &in) {
    133133        clear_ip();
    134         ipv4addr = in; 
     134        ipv4addr = in;
    135135        // set subtype to IPv4
    136136        set_subtype(true);
     
    148148                return true;
    149149        } else return false;
    150 } // end set_ipv6       
    151 
    152 /** Set IPv6 address from struct in6_addr. 
    153  * This changes object type to IPv6. 
    154  */
    155 void 
     150} // end set_ipv6
     151
     152/** Set IPv6 address from struct in6_addr.
     153 * This changes object type to IPv6.
     154 */
     155void
    156156hostaddress::set_ip(const struct in6_addr &in) {
    157157        clear_ip();
    158         ipv6addr = in; 
     158        ipv6addr = in;
    159159        // set subtype to IPv6
    160160        set_subtype(false);
     
    185185 * hostaddress object and should be copied if used for a longer time.
    186186 */
    187 const char* hostaddress::get_ip_str() const 
     187const char* hostaddress::get_ip_str() const
    188188{
    189189  // If outstring exists then it is valid.
    190   if (outstring) 
     190  if (outstring)
    191191    return outstring;
    192192  else
    193     outstring= (ipv4flag ? new(nothrow) char[INET_ADDRSTRLEN] : 
     193    outstring= (ipv4flag ? new(nothrow) char[INET_ADDRSTRLEN] :
    194194                           new(nothrow) char[INET6_ADDRSTRLEN]);
    195195
    196   if (hostaddress::get_ip_str(outstring)) 
     196  if (hostaddress::get_ip_str(outstring))
    197197    return outstring;
    198   else 
     198  else
    199199  {
    200200    // error
    201     if (outstring) 
     201    if (outstring)
    202202      delete[] outstring;
    203203
     
    209209 * @param str string buffer
    210210 */
    211 const char* hostaddress::get_ip_str(char *str) const 
     211const char* hostaddress::get_ip_str(char *str) const
    212212{
    213213  if (!str) return NULL;
    214214  memset(str,0, ipv4flag ? INET_ADDRSTRLEN : INET6_ADDRSTRLEN);
    215   return ipv4flag ? inet_ntop(AF_INET,(void*)&ipv4addr,str,INET_ADDRSTRLEN) 
     215  return ipv4flag ? inet_ntop(AF_INET,(void*)&ipv4addr,str,INET_ADDRSTRLEN)
    216216                  : inet_ntop(AF_INET6,(void*)&ipv6addr,str,INET6_ADDRSTRLEN);
    217217} // end get_ip_str(char*)
     
    247247/// returns false if address is not allowed to be used
    248248/// as source address: loopback, multicast, broadcast, unspecified
    249 bool 
     249bool
    250250hostaddress::is_bogus_source() const
    251251{
    252252  if (ipv4flag)
    253253  { // IPv4
    254     if ( IN_MULTICAST(ipv4addr.s_addr) || 
     254    if ( IN_MULTICAST(ipv4addr.s_addr) ||
    255255         ipv4addr.s_addr == INADDR_LOOPBACK  ||
    256256         ipv4addr.s_addr == INADDR_ANY ||
     
    323323
    324324/** Set subtype and IPv4 flag. This does NOT clear the outstring buffer.
    325  * Use clear_ip(). 
     325 * Use clear_ip().
    326326 */
    327327void hostaddress::set_subtype(bool ipv4) {
    328         ipv4flag = ipv4; 
     328        ipv4flag = ipv4;
    329329        subtype = ipv4flag ? IPv4HostAddress : IPv6HostAddress;
    330330} // end set_subtype
     
    422422        catch_bad_alloc(aa = new appladdress(*this));
    423423        return aa;
    424 } // end copy 
     424} // end copy
    425425
    426426bool appladdress::operator==(const address& ie) const {
     
    454454        catch_bad_alloc(na = new netaddress(*this));
    455455        return na;
    456 } // end copy 
     456} // end copy
    457457
    458458bool netaddress::operator==(const address& ie) const {
     
    485485
    486486/** Set subtype and IPv4 flag. This does NOT clear the outstring buffer.
    487  * Use clear_ip(). 
     487 * Use clear_ip().
    488488 * In addition the prefix length is checked and set to reasonable values.
    489489 */
    490490void netaddress::set_subtype(bool ipv4) {
    491         ipv4flag = ipv4; 
     491        ipv4flag = ipv4;
    492492        if (ipv4) {
    493                 subtype = IPv4NetAddress; 
     493                subtype = IPv4NetAddress;
    494494                if (prefix_length>32) prefix_length = 32;
    495495        } else {
     
    502502
    503503/** Constructor sets address type and clears prefix length. */
    504 netaddress::netaddress() : 
     504netaddress::netaddress() :
    505505  hostaddress(),
    506506  prefix_length(0)
     
    514514} // end copy constructor
    515515
    516 /** Initialize with the given host address and prefix length. 
     516/** Initialize with the given host address and prefix length.
    517517 * Prefix length is optional and set to 0 if missing.
    518518 */
     
    530530        long int len = 0;
    531531        uint32 iplen;
    532         char* i = NULL;
     532        const char* i = NULL;
    533533        char* errptr = NULL;
    534534        char ipstr[INET6_ADDRSTRLEN] = {0};
     
    785785        catch_bad_alloc(ha =  new udsaddress(*this));
    786786        return ha;
    787 } // end copy 
     787} // end copy
    788788
    789789bool udsaddress::operator==(const address& ie) const {
     
    876876                }
    877877                props->insert(pair<AddrProperty *, bool>(p, propagate));
    878                
     878
    879879        } else {
    880880                props = new propmap_t();
     
    15251525        if (head->right->index > head->index)
    15261526                collect(head->right, p, list);
    1527        
     1527
    15281528}
    15291529
  • source/ariba/utility/misc/Helper.h

    r4063 r4890  
    4545#include <ctime>
    4646#include <ostream>
     47#include <cstdio>
    4748#include <iomanip>
    4849#include <cassert>
  • source/ariba/utility/serialization/Serialization.hpp

    r3690 r4890  
    200200#include <typeinfo>
    201201#include <iostream>
     202#include <cstdio>
    202203
    203204//---------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.