Skip to content

Commit

Permalink
Fixed maybe be used unitialized warnings (eProsima#1277)
Browse files Browse the repository at this point in the history
```
/home/johnny/ACE/src/fastrtps/src/cpp/rtps/messages/MessageReceiver.cpp:745:14: note: ‘fragmentSize’ was declared here
  745 |     uint16_t fragmentSize;
      |              ^~~~~~~~~~~~
/home/johnny/ACE/src/fastrtps/src/cpp/rtps/messages/MessageReceiver.cpp:842:39: warning: ‘fragmentsInSubmessage’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  842 |             reader->processDataFragMsg(&ch, sampleSize, fragmentStartingNum, fragmentsInSubmessage);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johnny/ACE/src/fastrtps/src/cpp/rtps/messages/MessageReceiver.cpp:760:18: warning: ‘octetsToInlineQos’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  760 |         msg->pos += (octetsToInlineQos - RTPSMESSAGE_OCTETSTOINLINEQOS_DATAFRAGSUBMSG);
      |         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Signed-off-by: Johnny Willemsen <[email protected]>
  • Loading branch information
jwillemsen authored Jul 7, 2020
1 parent 503d157 commit 3cba049
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cpp/rtps/messages/MessageReceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ bool MessageReceiver::proc_Submsg_Data(
msg->pos += 2;

bool valid = true;
int16_t octetsToInlineQos;
int16_t octetsToInlineQos = 0;
valid &= CDRMessage::readInt16(msg, &octetsToInlineQos); //it should be 16 in this implementation

//reader and writer ID
Expand Down Expand Up @@ -705,7 +705,7 @@ bool MessageReceiver::proc_Submsg_DataFrag(
msg->pos += 2;

bool valid = true;
int16_t octetsToInlineQos;
int16_t octetsToInlineQos = 0;
valid &= CDRMessage::readInt16(msg, &octetsToInlineQos); //it should be 16 in this implementation

//reader and writer ID
Expand Down Expand Up @@ -742,7 +742,7 @@ bool MessageReceiver::proc_Submsg_DataFrag(
valid &= CDRMessage::readUInt16(msg, &fragmentsInSubmessage);

// READ FRAGMENTSIZE
uint16_t fragmentSize;
uint16_t fragmentSize = 0;
valid &= CDRMessage::readUInt16(msg, &fragmentSize);

// READ SAMPLESIZE
Expand Down

0 comments on commit 3cba049

Please sign in to comment.