From 3886888ca9cfce39adabe641ea7d2cd0215b728f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Thu, 18 Apr 2024 08:35:34 +0200 Subject: [PATCH] Removed warning (#4693) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Removed warning Signed-off-by: Alejandro Hernández Cordero * Added suggestions Signed-off-by: Alejandro Hernández Cordero --------- Signed-off-by: Alejandro Hernández Cordero (cherry picked from commit 82585079864bee11718eecf8d745d5b56cb4da67) --- src/cpp/fastdds/core/policy/ParameterList.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cpp/fastdds/core/policy/ParameterList.cpp b/src/cpp/fastdds/core/policy/ParameterList.cpp index c33db95f993..a62df51e6cf 100644 --- a/src/cpp/fastdds/core/policy/ParameterList.cpp +++ b/src/cpp/fastdds/core/policy/ParameterList.cpp @@ -117,14 +117,14 @@ bool ParameterList::read_guid_from_cdr_msg( fastrtps::rtps::GUID_t& guid) { bool valid = false; - uint16_t pid; - uint16_t plength; + uint16_t pid = 0; + uint16_t plength = 0; while (msg.pos < msg.length) { valid = true; valid &= fastrtps::rtps::CDRMessage::readUInt16(&msg, &pid); valid &= fastrtps::rtps::CDRMessage::readUInt16(&msg, &plength); - if ((pid == PID_SENTINEL) || !valid) + if (!valid || (pid == PID_SENTINEL)) { break; }