File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -482,7 +482,9 @@ namespace xt
482482 char header_len_le16[2 ];
483483 istream.read (header_len_le16, 2 );
484484
485- uint16_t header_length = uint16_t (header_len_le16[0 ] << 0 ) | uint16_t (header_len_le16[1 ] << 8 );
485+ uint16_t header_b0 = static_cast <uint16_t >(static_cast <uint8_t >(header_len_le16[0 ]));
486+ uint16_t header_b1 = static_cast <uint16_t >(static_cast <uint8_t >(header_len_le16[1 ])) << 8 ;
487+ uint16_t header_length = header_b0 | header_b1;
486488
487489 if ((magic_string_length + 2 + 2 + header_length) % 16 != 0 )
488490 {
@@ -502,8 +504,11 @@ namespace xt
502504 char header_len_le32[4 ];
503505 istream.read (header_len_le32, 4 );
504506
505- uint32_t header_length = uint32_t (header_len_le32[0 ] << 0 ) | uint32_t (header_len_le32[1 ] << 8 )
506- | uint32_t (header_len_le32[2 ] << 16 ) | uint32_t (header_len_le32[3 ] << 24 );
507+ uint32_t header_b0 = static_cast <uint32_t >(static_cast <uint8_t >(header_len_le32[0 ]));
508+ uint32_t header_b1 = static_cast <uint32_t >(static_cast <uint8_t >(header_len_le32[1 ])) << 8 ;
509+ uint32_t header_b2 = static_cast <uint32_t >(static_cast <uint8_t >(header_len_le32[2 ])) << 16 ;
510+ uint32_t header_b3 = static_cast <uint32_t >(static_cast <uint8_t >(header_len_le32[3 ])) << 24 ;
511+ uint32_t header_length = header_b0 | header_b1 | header_b2 | header_b3;
507512
508513 if ((magic_string_length + 2 + 4 + header_length) % 16 != 0 )
509514 {
You can’t perform that action at this time.
0 commit comments