Small code formatting
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Sat, 13 Aug 2011 22:58:04 +0000 (19:58 -0300)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Sat, 13 Aug 2011 22:58:04 +0000 (19:58 -0300)
src/dns/dnsresolver.cpp
src/dns/timetolive.cpp
src/icmp/checksumcalculator.h
src/icmp/icmpdestinationunreachablemessage.cpp
src/icmp/icmpechoreplymessage.cpp
src/icmp/icmpechorequestmessage.cpp
src/icmp/icmpheader.cpp
src/ip/ipv4header.cpp
src/link/linkstatusanalyzer.cpp
src/tcp/tcppinger.cpp

index 37de84d..865b1a2 100644 (file)
@@ -149,7 +149,7 @@ int DnsResolver::get_resolved_ip_count() const
 
     BOOST_ASSERT( 1 <= resolved_ip_count );
 
-    return static_cast<int> ( resolved_ip_count );
+    return static_cast<int>( resolved_ip_count );
 }
 
 /**
index ee1fde7..2a8b140 100644 (file)
@@ -64,7 +64,7 @@ void TimeToLive::set_value( const int ttl )
 int TimeToLive::get_updated_value() const
 {
     ptime now = microsec_clock::universal_time();
-    int elapsed_seconds = static_cast<int> (
+    int elapsed_seconds = static_cast<int>(
             (now - TtlSetTime).total_seconds()
     );
     int original_ttl = get_value();
index c2699e2..00e2e3e 100644 (file)
@@ -69,15 +69,15 @@ template<typename Iterator>
         Iterator body_iter = BodyBegin;
         while ( body_iter != BodyEnd )
         {
-            sum += (static_cast<uint8_t> ( *body_iter++ ) << 8);
+            sum += (static_cast<uint8_t>( *body_iter++ ) << 8);
             if ( body_iter != BodyEnd )
-                sum += static_cast<uint8_t> ( *body_iter++ );
+                sum += static_cast<uint8_t>( *body_iter++ );
         }
 
         sum = (sum >> 16) + (sum & 0xFFFF);
         sum += (sum >> 16);
 
-        uint16_t checksum = static_cast<uint16_t> ( ~sum );
+        uint16_t checksum = static_cast<uint16_t>( ~sum );
 
         return checksum;
     }
index 30f10c7..55439ec 100644 (file)
@@ -25,14 +25,14 @@ IcmpDestinationUnreachableMessage::~IcmpDestinationUnreachableMessage()
 
 IcmpType IcmpDestinationUnreachableMessage::get_type() const
 {
-    IcmpType type = static_cast<IcmpType> ( Payload[ 0 ] );
+    IcmpType type = static_cast<IcmpType>( Payload[ 0 ] );
 
     return type;
 }
 
 void IcmpDestinationUnreachableMessage::set_type( IcmpType type )
 {
-    uint8_t n = static_cast<uint8_t> ( type );
+    uint8_t n = static_cast<uint8_t>( type );
 
     Payload[ 0 ] = n;
 }
index 929cdaf..20f2884 100644 (file)
@@ -25,14 +25,14 @@ IcmpEchoReplyMessage::~IcmpEchoReplyMessage()
 
 IcmpType IcmpEchoReplyMessage::get_type() const
 {
-    IcmpType type = static_cast<IcmpType> ( Payload[ 0 ] );
+    IcmpType type = static_cast<IcmpType>( Payload[ 0 ] );
 
     return type;
 }
 
 void IcmpEchoReplyMessage::set_type( IcmpType type )
 {
-    uint8_t n = static_cast<uint8_t> ( type );
+    uint8_t n = static_cast<uint8_t>( type );
 
     Payload[ 0 ] = n;
 }
index ec532aa..bd16441 100644 (file)
@@ -25,14 +25,14 @@ IcmpEchoRequestMessage::~IcmpEchoRequestMessage()
 
 IcmpType IcmpEchoRequestMessage::get_type() const
 {
-    IcmpType type = static_cast<IcmpType> ( Payload[ 0 ] );
+    IcmpType type = static_cast<IcmpType>( Payload[ 0 ] );
 
     return type;
 }
 
 void IcmpEchoRequestMessage::set_type( IcmpType type )
 {
-    uint8_t n = static_cast<uint8_t> ( type );
+    uint8_t n = static_cast<uint8_t>( type );
 
     Payload[ 0 ] = n;
 }
index 1ff7aa5..54f4523 100644 (file)
@@ -153,7 +153,7 @@ void IcmpHeader::set_icmp_message_format( std::istream &is )
     (void) is.putback( first_byte );
 
     // now select the message format for the given type
-    IcmpType header_type = static_cast<IcmpType> ( first_byte );
+    IcmpType header_type = static_cast<IcmpType>( first_byte );
     set_icmp_message_format( header_type );
 }
 
index 7e304b4..515932b 100644 (file)
@@ -29,7 +29,7 @@ uint8_t Ipv4Header::get_version() const
 
 uint16_t Ipv4Header::get_header_length() const
 {
-    return static_cast<uint16_t> ( (Payload[ 0 ] & 0xF) * 4 );
+    return static_cast<uint16_t>( (Payload[ 0 ] & 0xF) * 4 );
 }
 
 uint8_t Ipv4Header::get_type_of_service() const
@@ -136,5 +136,5 @@ uint16_t Ipv4Header::decode( int left_byte, int right_byte ) const
 
     BOOST_ASSERT( value <= numeric_limits<uint16_t>::max() );
 
-    return static_cast<uint16_t> ( value );
+    return static_cast<uint16_t>( value );
 }
index 946fb44..78c6864 100644 (file)
@@ -146,7 +146,7 @@ void LinkStatusAnalyzer::add_host_down( const string &host_address )
 
 bool LinkStatusAnalyzer::exceeded_host_down_limit() const
 {
-    int host_down_count = static_cast<int> ( HostsDownList.size() );
+    int host_down_count = static_cast<int>( HostsDownList.size() );
 
     return ( host_down_count > HostsDownLimit );
 }
index 26328c1..e68ae86 100644 (file)
@@ -166,7 +166,7 @@ void TcpPinger::start_send()
     ++SequenceNumber;
 
     // Create an TCP header for an ACK request.
-    uint16_t source_port = static_cast<uint16_t> ( ( random() % 16383 ) + 49152 ); // same as random() % 65536;
+    uint16_t source_port = static_cast<uint16_t>( ( random() % 16383 ) + 49152 ); // same as random() % 65536;
     uint16_t destination_port = 80;
     TcpHeader tcp_header = create_ack_request(
             source_port,