From: Guilherme Maciel Ferreira Date: Tue, 3 Jan 2012 09:48:44 +0000 (-0200) Subject: PC-Lint warnings fixed: X-Git-Tag: v1.3~18 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=4fd5050396585f0cff7f22b7baafc8f2c2d1b047;p=pingcheck PC-Lint warnings fixed: - Info 713: Loss of precision (arg. no. 1) (unsigned int to int); - Info 701: Shift left of signed quantity (int). --- diff --git a/src/host/messagepayload.cpp b/src/host/messagepayload.cpp index 0ae5155..f2c1eda 100644 --- a/src/host/messagepayload.cpp +++ b/src/host/messagepayload.cpp @@ -108,7 +108,8 @@ const uint8_t& MessagePayload::operator[]( size_t offset ) const { BOOST_ASSERT( offset < PayloadSizeInBytes ); - return Payload[ offset ]; + ptrdiff_t index = static_cast(offset); + return Payload[ index ]; } /** @@ -123,7 +124,8 @@ uint8_t& MessagePayload::operator[]( size_t offset ) { BOOST_ASSERT( offset < PayloadSizeInBytes ); - return Payload[ offset ]; + ptrdiff_t index = static_cast(offset); + return Payload[ index ]; } //lint !e1762 /** @@ -257,7 +259,7 @@ uint32_t MessagePayload::decode32( int current_byte = first_byte; - uint64_t value = static_cast( Payload[ current_byte ] << 24 ); + uint64_t value = static_cast( Payload[ current_byte ] ) << 24; value += static_cast( Payload[ ++current_byte ] << 16 ); value += static_cast( Payload[ ++current_byte ] << 8 ); value += static_cast( Payload[ ++current_byte ] );