diff options
author | Sergiu Giurgiu <sgiurgiu11@gmail.com> | 2016-12-04 14:03:20 -0500 |
---|---|---|
committer | Sergiu Giurgiu <sgiurgiu11@gmail.com> | 2016-12-04 14:03:20 -0500 |
commit | c63113f8250c3ef0eb4dfc25aeab7e2e7c475fc4 (patch) | |
tree | 72fcad77e8393bd236ed684efaed97ee22721e7a /include | |
parent | 4e39b23e455e455f1878b3e68d729a1737f3e431 (diff) | |
download | crow-c63113f8250c3ef0eb4dfc25aeab7e2e7c475fc4.tar.gz crow-c63113f8250c3ef0eb4dfc25aeab7e2e7c475fc4.zip |
Removed strict-aliasing warning
Diffstat (limited to 'include')
-rw-r--r-- | include/crow/websocket.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/crow/websocket.h b/include/crow/websocket.h index a1e8e8f..3724375 100644 --- a/include/crow/websocket.h +++ b/include/crow/websocket.h @@ -212,11 +212,13 @@ namespace crow case WebSocketReadState::Len16: { remaining_length_ = 0; - boost::asio::async_read(adaptor_.socket(), boost::asio::buffer(&remaining_length_, 2), - [this](const boost::system::error_code& ec, std::size_t bytes_transferred) + uint16_t remaining_length16_ = 0; + boost::asio::async_read(adaptor_.socket(), boost::asio::buffer(&remaining_length16_, 2), + [this,&remaining_length16_](const boost::system::error_code& ec, std::size_t bytes_transferred) { is_reading = false; - remaining_length_ = ntohs(*(uint16_t*)&remaining_length_); + remaining_length16_ = ntohs(remaining_length16_); + remaining_length_ = remaining_length16_; #ifdef CROW_ENABLE_DEBUG if (!ec && bytes_transferred != 2) { |