Fixed -Wmaybe-uninitialized warnings

These warnings are only triggered when a combination of
`-Wmaybe-uninitialized` and `-ftrivial-auto-var-init=zero` is used
with GCC 14.2 or later.
This commit is contained in:
Mohammad Nejati
2025-07-16 05:54:54 +00:00
committed by Mohammad Nejati
parent e99590f163
commit 1fc5512b92
3 changed files with 5 additions and 5 deletions

View File

@@ -7,8 +7,8 @@ Version 358:
* Removed moved sections from documentation
* Removed superfluous log messages from tests
* Fixed portability issues for building tests in MinGW
* Fixed portability issues for building tests in MinGW
* Fixed `std::is_trivial` deprecation warnings
* Fixed `-Wmaybe-uninitialized` warnings
--------------------------------------------------------------------------------

View File

@@ -19,6 +19,7 @@
* [issue 2999] Used `handshake_timeout` for closing handshake during read operations
* [issue 3003] Added missing `cstdint` header to `detail/cpu_info.hpp`
* [issue 3016] Fixed `std::is_trivial` deprecation warnings
* [issue 3019] Fixed `-Wmaybe-uninitialized` warnings
[*Improvements]

View File

@@ -825,8 +825,7 @@ parse_fh(
{
case 126:
{
std::uint16_t len_be;
std::uint16_t len_be = {};
BOOST_ASSERT(buffer_bytes(cb) >= sizeof(len_be));
cb.consume(net::buffer_copy(
net::mutable_buffer(&len_be, sizeof(len_be)), cb));
@@ -841,7 +840,7 @@ parse_fh(
}
case 127:
{
std::uint64_t len_be;
std::uint64_t len_be = {};
BOOST_ASSERT(buffer_bytes(cb) >= sizeof(len_be));
cb.consume(net::buffer_copy(
net::mutable_buffer(&len_be, sizeof(len_be)), cb));
@@ -857,7 +856,7 @@ parse_fh(
}
if(fh.mask)
{
std::uint32_t key_le;
std::uint32_t key_le = {};
BOOST_ASSERT(buffer_bytes(cb) >= sizeof(key_le));
cb.consume(net::buffer_copy(
net::mutable_buffer(&key_le, sizeof(key_le)), cb));