Skip to content

Commit

Permalink
Refs #18687. Fix compilation warnings with VS2017
Browse files Browse the repository at this point in the history
Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>
  • Loading branch information
richiware committed Jul 5, 2023
1 parent 0952ca9 commit 8f595f7
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 41 deletions.
2 changes: 1 addition & 1 deletion test/xcdr/basic_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ void longdouble_align_serialize(

TEST_P(XCdrBasicTypesTest, short)
{
constexpr int16_t short_value {static_cast<int16_t>(0xCDDC)};
const int16_t short_value {static_cast<int16_t>(0xCDDC)};
constexpr uint8_t ival {0xCD};
constexpr uint8_t fval {0xDC};

Expand Down
84 changes: 44 additions & 40 deletions test/xcdr/optional.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1921,76 +1921,77 @@ TEST_P(XCdrOptionalTest, octet_optional)
TEST_P(XCdrOptionalTest, char_optional)
{
constexpr char char_value {'}'};
constexpr uint8_t valu {static_cast<uint8_t>(char_value)};

//{ Defining expected XCDR streams
XCdrStreamValues expected_streams;
expected_streams[0 + EncodingAlgorithmFlag::PLAIN_CDR + Cdr::Endianness::BIG_ENDIANNESS] =
{
0x00, 0x00, 0x00, 0x00, // Encapsulation
0x00, 0x01, 0x00, 0x01, // ShortMemberHeader
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::PLAIN_CDR + Cdr::Endianness::LITTLE_ENDIANNESS] =
{
0x00, 0x01, 0x00, 0x00, // Encapsulation
0x01, 0x00, 0x01, 0x00, // ShortMemberHeader
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::PL_CDR + Cdr::Endianness::BIG_ENDIANNESS] =
{
0x00, 0x02, 0x00, 0x00, // Encapsulation
0x00, 0x01, 0x00, 0x01, // ShortMemberHeader
char_value, // Char
valu, // Char
0x00, 0x00, 0x00, // Alignment
0x3F, 0x02, 0x00, 0x00 // Sentinel
};
expected_streams[0 + EncodingAlgorithmFlag::PL_CDR + Cdr::Endianness::LITTLE_ENDIANNESS] =
{
0x00, 0x03, 0x00, 0x00, // Encapsulation
0x01, 0x00, 0x01, 0x00, // ShortMemberHeader
char_value, // Char
valu, // Char
0x00, 0x00, 0x00, // Alignment
0x02, 0x3F, 0x00, 0x00 // Sentinel
};
expected_streams[0 + EncodingAlgorithmFlag::PLAIN_CDR2 + Cdr::Endianness::BIG_ENDIANNESS] =
{
0x00, 0x06, 0x00, 0x00, // Encapsulation
0x01, // Present
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::PLAIN_CDR2 + Cdr::Endianness::LITTLE_ENDIANNESS] =
{
0x00, 0x07, 0x00, 0x00, // Encapsulation
0x01, // Present
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::DELIMIT_CDR2 + Cdr::Endianness::BIG_ENDIANNESS] =
{
0x00, 0x08, 0x00, 0x00, // Encapsulation
0x00, 0x00, 0x00, 0x02, // DHEADER
0x01, // Present
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::DELIMIT_CDR2 + Cdr::Endianness::LITTLE_ENDIANNESS] =
{
0x00, 0x09, 0x00, 0x00, // Encapsulation
0x02, 0x00, 0x00, 0x00, // DHEADER
0x01, // Present
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::PL_CDR2 + Cdr::Endianness::BIG_ENDIANNESS] =
{
0x00, 0x0a, 0x00, 0x00, // Encapsulation
0x00, 0x00, 0x00, 0x05, // DHEADER
0x00, 0x00, 0x00, 0x01, // EMHEADER1(M) without NEXTINT
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::PL_CDR2 + Cdr::Endianness::LITTLE_ENDIANNESS] =
{
0x00, 0x0b, 0x00, 0x00, // Encapsulation
0x05, 0x00, 0x00, 0x00, // DHEADER
0x01, 0x00, 0x00, 0x00, // EMHEADER1(M) without NEXTINT
char_value // Char
valu // Char
};
//}

Expand Down Expand Up @@ -6067,6 +6068,7 @@ TEST_P(XCdrOptionalTest, char_align_1_optional)
{
const uint8_t align_value {0xAB};
constexpr char char_value {'}'};
constexpr uint8_t valu {static_cast<uint8_t>(char_value)};

//{ Defining expected XCDR streams
XCdrStreamValues expected_streams;
Expand All @@ -6076,15 +6078,15 @@ TEST_P(XCdrOptionalTest, char_align_1_optional)
align_value,
0x00, 0x00, 0x00, // Alignment
0x00, 0x01, 0x00, 0x01, // ShortMemberHeader
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::PLAIN_CDR + Cdr::Endianness::LITTLE_ENDIANNESS] =
{
0x00, 0x01, 0x00, 0x00, // Encapsulation
align_value,
0x00, 0x00, 0x00, // Alignment
0x01, 0x00, 0x01, 0x00, // ShortMemberHeader
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::PL_CDR + Cdr::Endianness::BIG_ENDIANNESS] =
{
Expand All @@ -6093,7 +6095,7 @@ TEST_P(XCdrOptionalTest, char_align_1_optional)
align_value,
0x00, 0x00, 0x00, // Alignment
0x00, 0x01, 0x00, 0x01, // ShortMemberHeader
char_value, // Char
valu, // Char
0x00, 0x00, 0x00, // Alignment
0x3F, 0x02, 0x00, 0x00 // Sentinel
};
Expand All @@ -6104,7 +6106,7 @@ TEST_P(XCdrOptionalTest, char_align_1_optional)
align_value,
0x00, 0x00, 0x00, // Alignment
0x01, 0x00, 0x01, 0x00, // ShortMemberHeader
char_value, // Char
valu, // Char
0x00, 0x00, 0x00, // Alignment
0x02, 0x3F, 0x00, 0x00 // Sentinel
};
Expand All @@ -6113,30 +6115,30 @@ TEST_P(XCdrOptionalTest, char_align_1_optional)
0x00, 0x06, 0x00, 0x00, // Encapsulation
align_value,
0x01, // Present
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::PLAIN_CDR2 + Cdr::Endianness::LITTLE_ENDIANNESS] =
{
0x00, 0x07, 0x00, 0x00, // Encapsulation
align_value,
0x01, // Present
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::DELIMIT_CDR2 + Cdr::Endianness::BIG_ENDIANNESS] =
{
0x00, 0x08, 0x00, 0x00, // Encapsulation
0x00, 0x00, 0x00, 0x03, // DHEADER
align_value,
0x01, // Present
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::DELIMIT_CDR2 + Cdr::Endianness::LITTLE_ENDIANNESS] =
{
0x00, 0x09, 0x00, 0x00, // Encapsulation
0x03, 0x00, 0x00, 0x00, // DHEADER
align_value,
0x01, // Present
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::PL_CDR2 + Cdr::Endianness::BIG_ENDIANNESS] =
{
Expand All @@ -6146,7 +6148,7 @@ TEST_P(XCdrOptionalTest, char_align_1_optional)
align_value,
0x00, 0x00, 0x00, // Alignment
0x00, 0x00, 0x00, 0x01, // EMHEADER1(M) without NEXTINT
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::PL_CDR2 + Cdr::Endianness::LITTLE_ENDIANNESS] =
{
Expand All @@ -6156,7 +6158,7 @@ TEST_P(XCdrOptionalTest, char_align_1_optional)
align_value,
0x00, 0x00, 0x00, // Alignment
0x01, 0x00, 0x00, 0x00, // EMHEADER1(M) without NEXTINT
char_value // Char
valu // Char
};
//}

Expand All @@ -6174,6 +6176,7 @@ TEST_P(XCdrOptionalTest, char_align_2_optional)
constexpr uint8_t iava {0xAB};
constexpr uint8_t fava {0xBA};
constexpr char char_value {'}'};
constexpr uint8_t valu {static_cast<uint8_t>(char_value)};

//{ Defining expected XCDR streams
XCdrStreamValues expected_streams;
Expand All @@ -6183,15 +6186,15 @@ TEST_P(XCdrOptionalTest, char_align_2_optional)
iava, fava,
0x00, 0x00, // Alignment
0x00, 0x01, 0x00, 0x01, // ShortMemberHeader
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::PLAIN_CDR + Cdr::Endianness::LITTLE_ENDIANNESS] =
{
0x00, 0x01, 0x00, 0x00, // Encapsulation
fava, iava,
0x00, 0x00, // Alignment
0x01, 0x00, 0x01, 0x00, // ShortMemberHeader
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::PL_CDR + Cdr::Endianness::BIG_ENDIANNESS] =
{
Expand All @@ -6200,7 +6203,7 @@ TEST_P(XCdrOptionalTest, char_align_2_optional)
iava, fava,
0x00, 0x00, // Alignment
0x00, 0x01, 0x00, 0x01, // ShortMemberHeader
char_value, // Char
valu, // Char
0x00, 0x00, 0x00, // Alignment
0x3F, 0x02, 0x00, 0x00 // Sentinel
};
Expand All @@ -6211,7 +6214,7 @@ TEST_P(XCdrOptionalTest, char_align_2_optional)
fava, iava,
0x00, 0x00, // Alignment
0x01, 0x00, 0x01, 0x00, // ShortMemberHeader
char_value, // Char
valu, // Char
0x00, 0x00, 0x00, // Alignment
0x02, 0x3F, 0x00, 0x00 // Sentinel
};
Expand All @@ -6220,30 +6223,30 @@ TEST_P(XCdrOptionalTest, char_align_2_optional)
0x00, 0x06, 0x00, 0x00, // Encapsulation
iava, fava,
0x01, // Present
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::PLAIN_CDR2 + Cdr::Endianness::LITTLE_ENDIANNESS] =
{
0x00, 0x07, 0x00, 0x00, // Encapsulation
fava, iava,
0x01, // Present
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::DELIMIT_CDR2 + Cdr::Endianness::BIG_ENDIANNESS] =
{
0x00, 0x08, 0x00, 0x00, // Encapsulation
0x00, 0x00, 0x00, 0x04, // DHEADER
iava, fava,
0x01, // Present
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::DELIMIT_CDR2 + Cdr::Endianness::LITTLE_ENDIANNESS] =
{
0x00, 0x09, 0x00, 0x00, // Encapsulation
0x04, 0x00, 0x00, 0x00, // DHEADER
fava, iava,
0x01, // Present
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::PL_CDR2 + Cdr::Endianness::BIG_ENDIANNESS] =
{
Expand All @@ -6253,7 +6256,7 @@ TEST_P(XCdrOptionalTest, char_align_2_optional)
iava, fava,
0x00, 0x00, // Alignment
0x00, 0x00, 0x00, 0x01, // EMHEADER1(M) without NEXTINT
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::PL_CDR2 + Cdr::Endianness::LITTLE_ENDIANNESS] =
{
Expand All @@ -6263,7 +6266,7 @@ TEST_P(XCdrOptionalTest, char_align_2_optional)
fava, iava,
0x00, 0x00, // Alignment
0x01, 0x00, 0x00, 0x00, // EMHEADER1(M) without NEXTINT
char_value // Char
valu // Char
};
//}

Expand All @@ -6281,6 +6284,7 @@ TEST_P(XCdrOptionalTest, char_align_4_optional)
constexpr uint8_t iava {0xAB};
constexpr uint8_t fava {0xBA};
constexpr char char_value {'}'};
constexpr uint8_t valu {static_cast<uint8_t>(char_value)};

//{ Defining expected XCDR streams
XCdrStreamValues expected_streams;
Expand All @@ -6289,22 +6293,22 @@ TEST_P(XCdrOptionalTest, char_align_4_optional)
0x00, 0x00, 0x00, 0x00, // Encapsulation
iava, iava, iava, fava,
0x00, 0x01, 0x00, 0x01, // ShortMemberHeader
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::PLAIN_CDR + Cdr::Endianness::LITTLE_ENDIANNESS] =
{
0x00, 0x01, 0x00, 0x00, // Encapsulation
fava, iava, iava, iava,
0x01, 0x00, 0x01, 0x00, // ShortMemberHeader
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::PL_CDR + Cdr::Endianness::BIG_ENDIANNESS] =
{
0x00, 0x02, 0x00, 0x00, // Encapsulation
0x00, 0x00, 0x00, 0x04, // ShortMemberHeader
iava, iava, iava, fava,
0x00, 0x01, 0x00, 0x01, // ShortMemberHeader
char_value, // Char
valu, // Char
0x00, 0x00, 0x00, // Alignment
0x3F, 0x02, 0x00, 0x00 // Sentinel
};
Expand All @@ -6314,7 +6318,7 @@ TEST_P(XCdrOptionalTest, char_align_4_optional)
0x00, 0x00, 0x04, 0x00, // ShortMemberHeader
fava, iava, iava, iava,
0x01, 0x00, 0x01, 0x00, // ShortMemberHeader
char_value, // Char
valu, // Char
0x00, 0x00, 0x00, // Alignment
0x02, 0x3F, 0x00, 0x00 // Sentinel
};
Expand All @@ -6323,30 +6327,30 @@ TEST_P(XCdrOptionalTest, char_align_4_optional)
0x00, 0x06, 0x00, 0x00, // Encapsulation
iava, iava, iava, fava,
0x01, // Present
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::PLAIN_CDR2 + Cdr::Endianness::LITTLE_ENDIANNESS] =
{
0x00, 0x07, 0x00, 0x00, // Encapsulation
fava, iava, iava, iava,
0x01, // Present
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::DELIMIT_CDR2 + Cdr::Endianness::BIG_ENDIANNESS] =
{
0x00, 0x08, 0x00, 0x00, // Encapsulation
0x00, 0x00, 0x00, 0x06, // DHEADER
iava, iava, iava, fava,
0x01, // Present
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::DELIMIT_CDR2 + Cdr::Endianness::LITTLE_ENDIANNESS] =
{
0x00, 0x09, 0x00, 0x00, // Encapsulation
0x06, 0x00, 0x00, 0x00, // DHEADER
fava, iava, iava, iava,
0x01, // Present
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::PL_CDR2 + Cdr::Endianness::BIG_ENDIANNESS] =
{
Expand All @@ -6355,7 +6359,7 @@ TEST_P(XCdrOptionalTest, char_align_4_optional)
0x20, 0x00, 0x00, 0x00, // EMHEADER1(M) without NEXTINT
iava, iava, iava, fava,
0x00, 0x00, 0x00, 0x01, // EMHEADER1(M) without NEXTINT
char_value // Char
valu // Char
};
expected_streams[0 + EncodingAlgorithmFlag::PL_CDR2 + Cdr::Endianness::LITTLE_ENDIANNESS] =
{
Expand All @@ -6364,7 +6368,7 @@ TEST_P(XCdrOptionalTest, char_align_4_optional)
0x00, 0x00, 0x00, 0x20, // EMHEADER1(M) without NEXTINT
fava, iava, iava, iava,
0x01, 0x00, 0x00, 0x00, // EMHEADER1(M) without NEXTINT
char_value // Char
valu // Char
};
//}

Expand Down

0 comments on commit 8f595f7

Please sign in to comment.