diff options
author | Jack Lloyd <[email protected]> | 2017-10-03 00:38:15 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-10-03 00:38:15 -0400 |
commit | 04d64c3e0fe60a25b1f1a5c2eaf7e2986d2130dd (patch) | |
tree | 3dc2cc7e970fc5f1cdc94887b03704d82c37e07e /src/lib/utils/os_utils.cpp | |
parent | 180540de74c58a72492692f58b63f32647e80bd8 (diff) |
Add wrappers for reinterpret_cast between char* and uint8_t*
Generally speaking reinterpret_cast is sketchy stuff. But the
special case of char*/uint8_t* is both common and safe. By
isolating those, the remaining (likely sketchy) cases are easier
to grep for.
Diffstat (limited to 'src/lib/utils/os_utils.cpp')
-rw-r--r-- | src/lib/utils/os_utils.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/utils/os_utils.cpp b/src/lib/utils/os_utils.cpp index 3f7d3cfde..d516e7600 100644 --- a/src/lib/utils/os_utils.cpp +++ b/src/lib/utils/os_utils.cpp @@ -163,7 +163,7 @@ class Winsock_Socket final : public OS::Socket { const size_t left = len - sent_so_far; int sent = ::send(m_socket, - reinterpret_cast<const char*>(buf + sent_so_far), + cast_uint8_ptr_to_char(buf + sent_so_far), static_cast<int>(left), 0); @@ -178,7 +178,7 @@ class Winsock_Socket final : public OS::Socket size_t read(uint8_t buf[], size_t len) override { int got = ::recv(m_socket, - reinterpret_cast<char*>(buf), + cast_uint8_ptr_to_char(buf), static_cast<int>(len), 0); if(got == SOCKET_ERROR) |