From 4fd5050396585f0cff7f22b7baafc8f2c2d1b047 Mon Sep 17 00:00:00 2001 From: Guilherme Maciel Ferreira Date: Tue, 3 Jan 2012 07:48:44 -0200 Subject: [PATCH] PC-Lint warnings fixed: - Info 713: Loss of precision (arg. no. 1) (unsigned int to int); - Info 701: Shift left of signed quantity (int). --- src/host/messagepayload.cpp | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) 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 ] ); -- 1.7.1