From cf289c98ce05577664ed8dc14766b277748cfa88 Mon Sep 17 00:00:00 2001 From: Guilherme Maciel Ferreira Date: Sat, 13 Aug 2011 19:58:04 -0300 Subject: [PATCH] Small code formatting --- src/dns/dnsresolver.cpp | 2 +- src/dns/timetolive.cpp | 2 +- src/icmp/checksumcalculator.h | 6 +++--- src/icmp/icmpdestinationunreachablemessage.cpp | 4 ++-- src/icmp/icmpechoreplymessage.cpp | 4 ++-- src/icmp/icmpechorequestmessage.cpp | 4 ++-- src/icmp/icmpheader.cpp | 2 +- src/ip/ipv4header.cpp | 4 ++-- src/link/linkstatusanalyzer.cpp | 2 +- src/tcp/tcppinger.cpp | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/dns/dnsresolver.cpp b/src/dns/dnsresolver.cpp index 37de84d..865b1a2 100644 --- a/src/dns/dnsresolver.cpp +++ b/src/dns/dnsresolver.cpp @@ -149,7 +149,7 @@ int DnsResolver::get_resolved_ip_count() const BOOST_ASSERT( 1 <= resolved_ip_count ); - return static_cast ( resolved_ip_count ); + return static_cast( resolved_ip_count ); } /** diff --git a/src/dns/timetolive.cpp b/src/dns/timetolive.cpp index ee1fde7..2a8b140 100644 --- a/src/dns/timetolive.cpp +++ b/src/dns/timetolive.cpp @@ -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 elapsed_seconds = static_cast( (now - TtlSetTime).total_seconds() ); int original_ttl = get_value(); diff --git a/src/icmp/checksumcalculator.h b/src/icmp/checksumcalculator.h index c2699e2..00e2e3e 100644 --- a/src/icmp/checksumcalculator.h +++ b/src/icmp/checksumcalculator.h @@ -69,15 +69,15 @@ template Iterator body_iter = BodyBegin; while ( body_iter != BodyEnd ) { - sum += (static_cast ( *body_iter++ ) << 8); + sum += (static_cast( *body_iter++ ) << 8); if ( body_iter != BodyEnd ) - sum += static_cast ( *body_iter++ ); + sum += static_cast( *body_iter++ ); } sum = (sum >> 16) + (sum & 0xFFFF); sum += (sum >> 16); - uint16_t checksum = static_cast ( ~sum ); + uint16_t checksum = static_cast( ~sum ); return checksum; } diff --git a/src/icmp/icmpdestinationunreachablemessage.cpp b/src/icmp/icmpdestinationunreachablemessage.cpp index 30f10c7..55439ec 100644 --- a/src/icmp/icmpdestinationunreachablemessage.cpp +++ b/src/icmp/icmpdestinationunreachablemessage.cpp @@ -25,14 +25,14 @@ IcmpDestinationUnreachableMessage::~IcmpDestinationUnreachableMessage() IcmpType IcmpDestinationUnreachableMessage::get_type() const { - IcmpType type = static_cast ( Payload[ 0 ] ); + IcmpType type = static_cast( Payload[ 0 ] ); return type; } void IcmpDestinationUnreachableMessage::set_type( IcmpType type ) { - uint8_t n = static_cast ( type ); + uint8_t n = static_cast( type ); Payload[ 0 ] = n; } diff --git a/src/icmp/icmpechoreplymessage.cpp b/src/icmp/icmpechoreplymessage.cpp index 929cdaf..20f2884 100644 --- a/src/icmp/icmpechoreplymessage.cpp +++ b/src/icmp/icmpechoreplymessage.cpp @@ -25,14 +25,14 @@ IcmpEchoReplyMessage::~IcmpEchoReplyMessage() IcmpType IcmpEchoReplyMessage::get_type() const { - IcmpType type = static_cast ( Payload[ 0 ] ); + IcmpType type = static_cast( Payload[ 0 ] ); return type; } void IcmpEchoReplyMessage::set_type( IcmpType type ) { - uint8_t n = static_cast ( type ); + uint8_t n = static_cast( type ); Payload[ 0 ] = n; } diff --git a/src/icmp/icmpechorequestmessage.cpp b/src/icmp/icmpechorequestmessage.cpp index ec532aa..bd16441 100644 --- a/src/icmp/icmpechorequestmessage.cpp +++ b/src/icmp/icmpechorequestmessage.cpp @@ -25,14 +25,14 @@ IcmpEchoRequestMessage::~IcmpEchoRequestMessage() IcmpType IcmpEchoRequestMessage::get_type() const { - IcmpType type = static_cast ( Payload[ 0 ] ); + IcmpType type = static_cast( Payload[ 0 ] ); return type; } void IcmpEchoRequestMessage::set_type( IcmpType type ) { - uint8_t n = static_cast ( type ); + uint8_t n = static_cast( type ); Payload[ 0 ] = n; } diff --git a/src/icmp/icmpheader.cpp b/src/icmp/icmpheader.cpp index 1ff7aa5..54f4523 100644 --- a/src/icmp/icmpheader.cpp +++ b/src/icmp/icmpheader.cpp @@ -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 ( first_byte ); + IcmpType header_type = static_cast( first_byte ); set_icmp_message_format( header_type ); } diff --git a/src/ip/ipv4header.cpp b/src/ip/ipv4header.cpp index 7e304b4..515932b 100644 --- a/src/ip/ipv4header.cpp +++ b/src/ip/ipv4header.cpp @@ -29,7 +29,7 @@ uint8_t Ipv4Header::get_version() const uint16_t Ipv4Header::get_header_length() const { - return static_cast ( (Payload[ 0 ] & 0xF) * 4 ); + return static_cast( (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::max() ); - return static_cast ( value ); + return static_cast( value ); } diff --git a/src/link/linkstatusanalyzer.cpp b/src/link/linkstatusanalyzer.cpp index 946fb44..78c6864 100644 --- a/src/link/linkstatusanalyzer.cpp +++ b/src/link/linkstatusanalyzer.cpp @@ -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 ( HostsDownList.size() ); + int host_down_count = static_cast( HostsDownList.size() ); return ( host_down_count > HostsDownLimit ); } diff --git a/src/tcp/tcppinger.cpp b/src/tcp/tcppinger.cpp index 26328c1..e68ae86 100644 --- a/src/tcp/tcppinger.cpp +++ b/src/tcp/tcppinger.cpp @@ -166,7 +166,7 @@ void TcpPinger::start_send() ++SequenceNumber; // Create an TCP header for an ACK request. - uint16_t source_port = static_cast ( ( random() % 16383 ) + 49152 ); // same as random() % 65536; + uint16_t source_port = static_cast( ( random() % 16383 ) + 49152 ); // same as random() % 65536; uint16_t destination_port = 80; TcpHeader tcp_header = create_ack_request( source_port, -- 1.7.1