aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaeseung Ha <ipknhama@gmail.com>2017-09-17 18:03:14 +0900
committerGitHub <noreply@github.com>2017-09-17 18:03:14 +0900
commita3b9c11112856ccc28e90e95feed568efadf3cae (patch)
tree1f9c4ffe0dc004dc4cb648b2b58ac99c8b0dca79
parentc43c052112cd15ac8be1d0cb90b6ad2570b2b99a (diff)
parentef17b8cb9b79921805f13f4947dadb07763ac475 (diff)
downloadcrow-a3b9c11112856ccc28e90e95feed568efadf3cae.tar.gz
crow-a3b9c11112856ccc28e90e95feed568efadf3cae.zip
Merge pull request #200 from sgiurgiu/master
Removed strict-aliasing warning
-rw-r--r--amalgamate/crow_all.h1
-rw-r--r--include/crow/websocket.h8
2 files changed, 5 insertions, 4 deletions
diff --git a/amalgamate/crow_all.h b/amalgamate/crow_all.h
index e4a98f7..77fb663 100644
--- a/amalgamate/crow_all.h
+++ b/amalgamate/crow_all.h
@@ -9705,4 +9705,3 @@ namespace crow
-
diff --git a/include/crow/websocket.h b/include/crow/websocket.h
index efcf834..d21d7e9 100644
--- a/include/crow/websocket.h
+++ b/include/crow/websocket.h
@@ -226,11 +226,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)
{