diff options
-rw-r--r-- | contrib/epee/include/net/levin_base.h | 4 | ||||
-rw-r--r-- | contrib/epee/include/net/levin_client.inl | 8 | ||||
-rw-r--r-- | contrib/epee/include/net/levin_client_async.h | 6 | ||||
-rw-r--r-- | contrib/epee/include/net/levin_helper.h | 4 | ||||
-rw-r--r-- | contrib/epee/include/net/levin_protocol_handler.h | 2 | ||||
-rw-r--r-- | contrib/epee/include/storages/portable_storage_from_bin.h | 12 |
6 files changed, 24 insertions, 12 deletions
diff --git a/contrib/epee/include/net/levin_base.h b/contrib/epee/include/net/levin_base.h index df59a6c44..b680691ad 100644 --- a/contrib/epee/include/net/levin_base.h +++ b/contrib/epee/include/net/levin_base.h @@ -48,7 +48,7 @@ namespace levin { uint64_t m_signature; uint64_t m_cb; - bool m_have_to_return_data; + uint8_t m_have_to_return_data; uint32_t m_command; int32_t m_return_code; uint32_t m_reservedA; //probably some flags in future @@ -63,7 +63,7 @@ namespace levin { uint64_t m_signature; uint64_t m_cb; - bool m_have_to_return_data; + uint8_t m_have_to_return_data; uint32_t m_command; int32_t m_return_code; uint32_t m_flags; diff --git a/contrib/epee/include/net/levin_client.inl b/contrib/epee/include/net/levin_client.inl index 2f048b027..177dd8967 100644 --- a/contrib/epee/include/net/levin_client.inl +++ b/contrib/epee/include/net/levin_client.inl @@ -82,7 +82,7 @@ int levin_client_impl::invoke(int command, const epee::span<const uint8_t> in_bu bucket_head head = {0}; head.m_signature = SWAP64LE(LEVIN_SIGNATURE); head.m_cb = SWAP64LE(in_buff.size()); - head.m_have_to_return_data = true; + head.m_have_to_return_data = 1; head.m_command = SWAP32LE(command); if(!m_transport.send(&head, sizeof(head))) return -1; @@ -118,7 +118,7 @@ int levin_client_impl::notify(int command, const std::string& in_buff) bucket_head head = {0}; head.m_signature = SWAP64LE(LEVIN_SIGNATURE); head.m_cb = SWAP64LE(in_buff.size()); - head.m_have_to_return_data = false; + head.m_have_to_return_data = 0; head.m_command = SWAP32LE(command); if(!m_transport.send((const char*)&head, sizeof(head))) @@ -141,7 +141,7 @@ inline bucket_head2 head = {0}; head.m_signature = SWAP64LE(LEVIN_SIGNATURE); head.m_cb = SWAP64LE(in_buff.size()); - head.m_have_to_return_data = true; + head.m_have_to_return_data = 1; head.m_command = SWAP32LE(command); head.m_return_code = SWAP32LE(0); head.m_flags = SWAP32LE(LEVIN_PACKET_REQUEST); @@ -179,7 +179,7 @@ inline bucket_head2 head = {0}; head.m_signature = SWAP64LE(LEVIN_SIGNATURE); head.m_cb = SWAP64LE(in_buff.size()); - head.m_have_to_return_data = false; + head.m_have_to_return_data = 0; head.m_command = SWAP32LE(command); head.m_return_code = SWAP32LE(0); head.m_flags = SWAP32LE(LEVIN_PACKET_REQUEST); diff --git a/contrib/epee/include/net/levin_client_async.h b/contrib/epee/include/net/levin_client_async.h index ed92f4b95..067707edf 100644 --- a/contrib/epee/include/net/levin_client_async.h +++ b/contrib/epee/include/net/levin_client_async.h @@ -242,7 +242,7 @@ namespace levin bucket_head head = {0}; head.m_signature = LEVIN_SIGNATURE; head.m_cb = in_buff.size(); - head.m_have_to_return_data = true; + head.m_have_to_return_data = 1; head.m_id = target; #ifdef TRACE_LEVIN_PACKETS_BY_GUIDS ::UuidCreate(&head.m_id); @@ -320,7 +320,7 @@ namespace levin bucket_head head = {0}; head.m_signature = LEVIN_SIGNATURE; head.m_cb = in_buff.size(); - head.m_have_to_return_data = false; + head.m_have_to_return_data = 0; head.m_id = target; #ifdef TRACE_LEVIN_PACKETS_BY_GUIDS ::UuidCreate(&head.m_id); @@ -510,7 +510,7 @@ namespace levin head.m_cb = return_buff.size(); - head.m_have_to_return_data = false; + head.m_have_to_return_data = 0; head.m_protocol_version = LEVIN_PROTOCOL_VER_1; head.m_flags = LEVIN_PACKET_RESPONSE; diff --git a/contrib/epee/include/net/levin_helper.h b/contrib/epee/include/net/levin_helper.h index da926a914..541e0948d 100644 --- a/contrib/epee/include/net/levin_helper.h +++ b/contrib/epee/include/net/levin_helper.h @@ -46,7 +46,7 @@ namespace levin levin::bucket_head& head = *(levin::bucket_head*)(&buff[0]); head.m_signature = SWAP64LE(LEVIN_SIGNATURE); head.m_cb = 0; - head.m_have_to_return_data = true; + head.m_have_to_return_data = 1; head.m_command = SWAP32LE(command_id); head.m_return_code = SWAP32LE(1); head.m_reservedA = rand(); //probably some flags in future @@ -68,7 +68,7 @@ namespace levin levin::bucket_head& head = *(levin::bucket_head*)(&buff[0]); head.m_signature = SWAP64LE(LEVIN_SIGNATURE); head.m_cb = 0; - head.m_have_to_return_data = true; + head.m_have_to_return_data = 1; head.m_command = SWAP32LE(command_id); head.m_return_code = SWAP32LE(1); head.m_reservedA = rand(); //probably some flags in future diff --git a/contrib/epee/include/net/levin_protocol_handler.h b/contrib/epee/include/net/levin_protocol_handler.h index c510cfd79..fa7d1a5ab 100644 --- a/contrib/epee/include/net/levin_protocol_handler.h +++ b/contrib/epee/include/net/levin_protocol_handler.h @@ -156,7 +156,7 @@ namespace levin std::string return_buff; m_current_head.m_return_code = m_config.m_pcommands_handler->invoke(m_current_head.m_command, buff_to_invoke, return_buff, m_conn_context); m_current_head.m_cb = return_buff.size(); - m_current_head.m_have_to_return_data = false; + m_current_head.m_have_to_return_data = 0; return_buff.insert(0, (const char*)&m_current_head, sizeof(m_current_head)); if(!m_psnd_hndlr->do_send(byte_slice{std::move(return_buff)})) diff --git a/contrib/epee/include/storages/portable_storage_from_bin.h b/contrib/epee/include/storages/portable_storage_from_bin.h index 9e7b6ec34..6f081dbc7 100644 --- a/contrib/epee/include/storages/portable_storage_from_bin.h +++ b/contrib/epee/include/storages/portable_storage_from_bin.h @@ -157,6 +157,18 @@ namespace epee pod_val = CONVERT_POD(pod_val); } + template<> + void throwable_buffer_reader::read<bool>(bool& pod_val) + { + RECURSION_LIMITATION(); + static_assert(std::is_pod<bool>::value, "POD type expected"); + static_assert(sizeof(bool) == sizeof(uint8_t), "We really shouldn't use bool directly in serialization code. Replace it with uint8_t if this assert triggers!"); + uint8_t t; + read(&t, sizeof(t)); + CHECK_AND_ASSERT_THROW_MES(t <= 1, "Invalid bool value " << t); + pod_val = (t != 0); + } + template<class t_type> t_type throwable_buffer_reader::read() { |