Skip to content

Commit

Permalink
Remove remaining Linux C-style casts & fix const correctness
Browse files Browse the repository at this point in the history
Many C style casts remain after 181f076 ("clang-tidy: Apply fixes
"google-readability-casting" (project-chip#3034)").

The reason they were not updated is typically because they are casting
away const qualifiers. Fix these cases or add a const_cast<> if
appropriate.
  • Loading branch information
mspang committed Oct 6, 2020
1 parent fdff9ed commit 16c921f
Show file tree
Hide file tree
Showing 34 changed files with 148 additions and 141 deletions.
8 changes: 4 additions & 4 deletions examples/shell/shell_common/cmd_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ static CHIP_ERROR ConfigGetDeviceCert(bool printHeader)
streamer_printf(sout, "DeviceCert: ");
}
// Determine the length of the device certificate.
error = ConfigurationMgr().GetDeviceCertificate((uint8_t *) nullptr, 0, certLen);
error = ConfigurationMgr().GetDeviceCertificate(nullptr, 0, certLen);
SuccessOrExit(error);

// Fail if no certificate has been configured.
Expand Down Expand Up @@ -213,7 +213,7 @@ static CHIP_ERROR ConfigGetDeviceCaCerts(bool printHeader)
streamer_printf(sout, "DeviceCaCerts: ");
}
// Determine the length of the device certificate.
error = ConfigurationMgr().GetDeviceIntermediateCACerts((uint8_t *) nullptr, 0, certLen);
error = ConfigurationMgr().GetDeviceIntermediateCACerts(nullptr, 0, certLen);
SuccessOrExit(error);

// Fail if no certificate has been configured.
Expand Down Expand Up @@ -266,7 +266,7 @@ static CHIP_ERROR ConfigGetManufacturerDeviceCert(bool printHeader)
streamer_printf(sout, "MfrDeviceCert: ");
}
// Determine the length of the device certificate.
error = ConfigurationMgr().GetManufacturerDeviceCertificate((uint8_t *) nullptr, 0, certLen);
error = ConfigurationMgr().GetManufacturerDeviceCertificate(nullptr, 0, certLen);
SuccessOrExit(error);

// Fail if no certificate has been configured.
Expand Down Expand Up @@ -302,7 +302,7 @@ static CHIP_ERROR ConfigGetManufacturerDeviceCaCerts(bool printHeader)
streamer_printf(sout, "MfgDeviceCaCerts:");
}
// Determine the length of the device certificate.
error = ConfigurationMgr().GetManufacturerDeviceIntermediateCACerts((uint8_t *) nullptr, 0, certLen);
error = ConfigurationMgr().GetManufacturerDeviceIntermediateCACerts(nullptr, 0, certLen);
SuccessOrExit(error);

// Fail if no certificate has been configured.
Expand Down
2 changes: 1 addition & 1 deletion src/ble/BLEEndPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ BLE_ERROR BLEEndPoint::Init(BleLayer * bleLayer, BLE_CONNECTION_OBJECT connObj,
//
// Beware this line should we ever use virtuals in this class or its
// super(s). See similar lines in chip::System::Layer end points.
memset((void *) this, 0, sizeof(*this));
memset(this, 0, sizeof(*this));

// If end point plays peripheral role, expect ack for indication sent as last step of BTP handshake.
// If central, periperal's handshake indication 'ack's write sent by central to kick off the BTP handshake.
Expand Down
3 changes: 0 additions & 3 deletions src/ble/BtpEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ class BtpEngine

public:
// Public functions:
BtpEngine() {}
~BtpEngine() {}

BLE_ERROR Init(void * an_app_state, bool expect_first_ack);

inline void SetTxFragmentSize(uint8_t size) { mTxFragmentSize = size; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ bool DeviceController_BlePlatformDelegate::SubscribeCharacteristic(BLE_CONNECTIO

if (subscribeCB && svcId && charId)
{
return subscribeCB(connObj, (void *) svcId->bytes, (void *) charId->bytes, subscribe);
return subscribeCB(connObj, static_cast<const void *>(svcId->bytes), static_cast<const void *>(charId->bytes), subscribe);
}

return false;
Expand All @@ -52,7 +52,7 @@ bool DeviceController_BlePlatformDelegate::UnsubscribeCharacteristic(BLE_CONNECT

if (subscribeCB && svcId && charId)
{
return subscribeCB(connObj, (void *) svcId->bytes, (void *) charId->bytes, !subscribe);
return subscribeCB(connObj, static_cast<const void *>(svcId->bytes), static_cast<const void *>(charId->bytes), !subscribe);
}

return false;
Expand Down Expand Up @@ -94,7 +94,8 @@ bool DeviceController_BlePlatformDelegate::SendWriteRequest(BLE_CONNECTION_OBJEC

if (writeCB && svcId && charId && pBuf)
{
ret = writeCB(connObj, (void *) svcId->bytes, (void *) charId->bytes, (void *) pBuf->Start(), pBuf->DataLength());
ret = writeCB(connObj, static_cast<const void *>(svcId->bytes), static_cast<const void *>(charId->bytes),
static_cast<void *>(pBuf->Start()), pBuf->DataLength());
}

// Release delegate's reference to pBuf. pBuf will be freed when both platform delegate and Chip stack free their references to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
#include <ble/BleLayer.h>
#include <ble/BlePlatformDelegate.h>

typedef bool (*WriteBleCharacteristicCBFunct)(void * connObj, void * svcId, void * charId, void * buffer, uint16_t length);
typedef bool (*SubscribeBleCharacteristicCBFunct)(void * connObj, void * svcId, void * charId, bool subscribe);
typedef bool (*WriteBleCharacteristicCBFunct)(void * connObj, const void * svcId, const void * charId, const void * buffer,
uint16_t length);
typedef bool (*SubscribeBleCharacteristicCBFunct)(void * connObj, const void * svcId, const void * charId, bool subscribe);
typedef bool (*CloseBleCBFunct)(void * connObj);

class DeviceController_BlePlatformDelegate : public chip::Ble::BlePlatformDelegate
Expand Down
9 changes: 6 additions & 3 deletions src/crypto/CHIPCryptoPAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ class ECPKey
public:
virtual SupportedECPKeyTypes Type() const = 0;
virtual size_t Length() const = 0;
virtual operator uint8_t *() const = 0;
virtual operator const uint8_t *() const = 0;
virtual operator uint8_t *() = 0;

virtual CHIP_ERROR ECDSA_validate_msg_signature(const uint8_t * msg, const size_t msg_length, const Sig & signature) const
{
Expand Down Expand Up @@ -143,7 +144,8 @@ class CapacityBoundBuffer

/** @brief Returns buffer pointer
**/
operator uint8_t *() const { return (uint8_t *) bytes; }
operator uint8_t *() { return bytes; }
operator const uint8_t *() const { return bytes; }

private:
uint8_t bytes[Cap];
Expand All @@ -159,7 +161,8 @@ class P256PublicKey : public ECPKey<P256ECDSASignature>
public:
SupportedECPKeyTypes Type() const override { return SupportedECPKeyTypes::ECP256R1; }
size_t Length() const override { return kP256_PublicKey_Length; }
operator uint8_t *() const override { return (uint8_t *) bytes; }
operator uint8_t *() override { return bytes; }
operator const uint8_t *() const override { return bytes; }

CHIP_ERROR ECDSA_validate_msg_signature(const uint8_t * msg, const size_t msg_length,
const P256ECDSASignature & signature) const override;
Expand Down
29 changes: 15 additions & 14 deletions src/crypto/CHIPCryptoPALOpenSSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ CHIP_ERROR AES_CCM_decrypt(const uint8_t * ciphertext, size_t ciphertext_length,

// Pass in expected tag
VerifyOrExit(CanCastTo<int>(tag_length), error = CHIP_ERROR_INVALID_ARGUMENT);
result = EVP_CIPHER_CTX_ctrl(context, EVP_CTRL_CCM_SET_TAG, static_cast<int>(tag_length), (void *) tag);
result = EVP_CIPHER_CTX_ctrl(context, EVP_CTRL_CCM_SET_TAG, static_cast<int>(tag_length),
const_cast<void *>(reinterpret_cast<const void *>(tag)));
VerifyOrExit(result == 1, error = CHIP_ERROR_INTERNAL);

// Pass in key + iv
Expand Down Expand Up @@ -902,7 +903,7 @@ CHIP_ERROR P256Keypair::Deserialize(P256SerializedKeypair & input)
const uint8_t * privkey = Uint8::to_const_uchar(input) + mPublicKey.Length();

VerifyOrExit(input.Length() == mPublicKey.Length() + kP256_PrivateKey_Length, error = CHIP_ERROR_INVALID_ARGUMENT);
bbuf.Put((const uint8_t *) input, mPublicKey.Length());
bbuf.Put(input, mPublicKey.Length());
VerifyOrExit(bbuf.Fit(), error = CHIP_ERROR_NO_MEMORY);

nid = _nidForCurve(curve);
Expand Down Expand Up @@ -1062,7 +1063,7 @@ CHIP_ERROR P256Keypair::NewCertificateSigningRequest(uint8_t * out_csr, size_t &
{ \
if (_point_ != nullptr) \
{ \
EC_POINT_clear_free((EC_POINT *) _point_); \
EC_POINT_clear_free(static_cast<EC_POINT *>(_point_)); \
} \
} while (0)

Expand All @@ -1071,7 +1072,7 @@ CHIP_ERROR P256Keypair::NewCertificateSigningRequest(uint8_t * out_csr, size_t &
{ \
if (_bn_ != nullptr) \
{ \
BN_clear_free((BIGNUM *) _bn_); \
BN_clear_free(static_cast<BIGNUM *>(_bn_)); \
} \
} while (0)

Expand Down Expand Up @@ -1102,7 +1103,7 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::InitInternal()
context->curve = EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1);
VerifyOrExit(context->curve != nullptr, error = CHIP_ERROR_INTERNAL);

G = (void *) EC_GROUP_get0_generator(context->curve);
G = const_cast<void *>(reinterpret_cast<const void *>(EC_GROUP_get0_generator(context->curve)));
VerifyOrExit(G != nullptr, error = CHIP_ERROR_INTERNAL);

context->bn_ctx = BN_CTX_secure_new();
Expand Down Expand Up @@ -1229,7 +1230,7 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::FEWrite(const void * fe, uint8_t * out
CHIP_ERROR error = CHIP_ERROR_INTERNAL;
int bn_out_len;
VerifyOrExit(CanCastTo<int>(out_len), error = CHIP_ERROR_INTERNAL);
bn_out_len = BN_bn2binpad((BIGNUM *) fe, Uint8::to_uchar(out), static_cast<int>(out_len));
bn_out_len = BN_bn2binpad(static_cast<const BIGNUM *>(fe), Uint8::to_uchar(out), static_cast<int>(out_len));

VerifyOrExit(bn_out_len == static_cast<int>(out_len), error = CHIP_ERROR_INTERNAL);

Expand Down Expand Up @@ -1258,8 +1259,8 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::FEMul(void * fer, const void * fe1, co

Spake2p_Context * context = to_inner_spake2p_context(&mSpake2pContext);

error_openssl =
BN_mod_mul(static_cast<BIGNUM *>(fer), (BIGNUM *) fe1, (BIGNUM *) fe2, static_cast<BIGNUM *>(order), context->bn_ctx);
error_openssl = BN_mod_mul(static_cast<BIGNUM *>(fer), static_cast<const BIGNUM *>(fe1), static_cast<const BIGNUM *>(fe2),
static_cast<BIGNUM *>(order), context->bn_ctx);
VerifyOrExit(error_openssl == 1, error = CHIP_ERROR_INTERNAL);

error = CHIP_NO_ERROR;
Expand Down Expand Up @@ -1288,8 +1289,8 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::PointWrite(const void * R, uint8_t * o
CHIP_ERROR error = CHIP_ERROR_INTERNAL;
Spake2p_Context * context = to_inner_spake2p_context(&mSpake2pContext);

size_t ec_out_len = EC_POINT_point2oct(context->curve, (EC_POINT *) R, POINT_CONVERSION_UNCOMPRESSED, Uint8::to_uchar(out),
out_len, context->bn_ctx);
size_t ec_out_len = EC_POINT_point2oct(context->curve, static_cast<const EC_POINT *>(R), POINT_CONVERSION_UNCOMPRESSED,
Uint8::to_uchar(out), out_len, context->bn_ctx);
VerifyOrExit(ec_out_len == out_len, error = CHIP_ERROR_INTERNAL);

error = CHIP_NO_ERROR;
Expand All @@ -1304,8 +1305,8 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::PointMul(void * R, const void * P1, co

Spake2p_Context * context = to_inner_spake2p_context(&mSpake2pContext);

error_openssl =
EC_POINT_mul(context->curve, static_cast<EC_POINT *>(R), nullptr, (EC_POINT *) P1, (BIGNUM *) fe1, context->bn_ctx);
error_openssl = EC_POINT_mul(context->curve, static_cast<EC_POINT *>(R), nullptr, static_cast<const EC_POINT *>(P1),
static_cast<const BIGNUM *>(fe1), context->bn_ctx);
VerifyOrExit(error_openssl == 1, error = CHIP_ERROR_INTERNAL);

error = CHIP_NO_ERROR;
Expand All @@ -1331,8 +1332,8 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::PointAddMul(void * R, const void * P1,
error = PointMul(R, P2, fe2);
VerifyOrExit(error == CHIP_NO_ERROR, error = CHIP_ERROR_INTERNAL);

error_openssl = EC_POINT_add(context->curve, static_cast<EC_POINT *>(R), static_cast<EC_POINT *>(R), (const EC_POINT *) scratch,
context->bn_ctx);
error_openssl = EC_POINT_add(context->curve, static_cast<EC_POINT *>(R), static_cast<EC_POINT *>(R),
static_cast<const EC_POINT *>(scratch), context->bn_ctx);
VerifyOrExit(error_openssl == 1, error = CHIP_ERROR_INTERNAL);

error = CHIP_NO_ERROR;
Expand Down
6 changes: 3 additions & 3 deletions src/include/platform/internal/BLEManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class BLEManager
CHIP_ERROR SetDeviceName(const char * deviceName);
uint16_t NumConnections();
void OnPlatformEvent(const ChipDeviceEvent * event);
chip::Ble::BleLayer * GetBleLayer() const;
chip::Ble::BleLayer * GetBleLayer();

protected:
// Construction/destruction limited to subclasses.
Expand Down Expand Up @@ -171,9 +171,9 @@ inline void BLEManager::OnPlatformEvent(const ChipDeviceEvent * event)
return static_cast<ImplClass *>(this)->_OnPlatformEvent(event);
}

inline chip::Ble::BleLayer * BLEManager::GetBleLayer() const
inline chip::Ble::BleLayer * BLEManager::GetBleLayer()
{
return static_cast<const ImplClass *>(this)->_GetBleLayer();
return static_cast<ImplClass *>(this)->_GetBleLayer();
}

} // namespace Internal
Expand Down
5 changes: 3 additions & 2 deletions src/inet/IPAddress-StringFuncts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ char * IPAddress::ToString(char * buf, uint32_t bufSize) const
#if INET_CONFIG_ENABLE_IPV4
if (IsIPv4())
{
buf = const_cast<char *>(inet_ntop(AF_INET, (const void *) &Addr[3], buf, static_cast<socklen_t>(bufSize)));
buf =
const_cast<char *>(inet_ntop(AF_INET, reinterpret_cast<const void *>(&Addr[3]), buf, static_cast<socklen_t>(bufSize)));
}
else
#endif // INET_CONFIG_ENABLE_IPV4
{
buf = const_cast<char *>(inet_ntop(AF_INET6, (const void *) Addr, buf, static_cast<socklen_t>(bufSize)));
buf = const_cast<char *>(inet_ntop(AF_INET6, reinterpret_cast<const void *>(Addr), buf, static_cast<socklen_t>(bufSize)));
}
#endif // !CHIP_SYSTEM_CONFIG_USE_LWIP

Expand Down
11 changes: 7 additions & 4 deletions src/inet/IPAddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ lwip_ip_addr_type IPAddress::ToLwIPAddrType(IPAddressType typ)
#if INET_CONFIG_ENABLE_IPV4
ip4_addr_t IPAddress::ToIPv4() const
{
return *(ip4_addr_t *) &Addr[3];
return *reinterpret_cast<ip4_addr_t *>(&Addr[3]);
}

IPAddress IPAddress::FromIPv4(const ip4_addr_t & ipv4Addr)
Expand Down Expand Up @@ -203,7 +203,10 @@ IPAddress IPAddress::FromIPv4(const struct in_addr & ipv4Addr)

struct in6_addr IPAddress::ToIPv6() const
{
return *(struct in6_addr *) &Addr;
in6_addr addr;
static_assert(sizeof(addr) == sizeof(Addr), "in6_addr size mismatch");
memcpy(&addr, Addr, sizeof(addr));
return addr;
}

IPAddress IPAddress::FromIPv6(const struct in6_addr & ipv6Addr)
Expand All @@ -225,10 +228,10 @@ IPAddress IPAddress::FromSockAddr(const struct sockaddr & sockaddr)
{
#if INET_CONFIG_ENABLE_IPV4
if (sockaddr.sa_family == AF_INET)
return FromIPv4(((sockaddr_in *) &sockaddr)->sin_addr);
return FromIPv4(reinterpret_cast<const sockaddr_in *>(&sockaddr)->sin_addr);
#endif // INET_CONFIG_ENABLE_IPV4
if (sockaddr.sa_family == AF_INET6)
return FromIPv6(((sockaddr_in6 *) &sockaddr)->sin6_addr);
return FromIPv6(reinterpret_cast<const sockaddr_in6 *>(&sockaddr)->sin6_addr);
return Any;
}

Expand Down
10 changes: 5 additions & 5 deletions src/inet/IPEndPointBasis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -969,11 +969,11 @@ INET_ERROR IPEndPointBasis::GetSocket(IPAddressType aAddressType, int aType, int
// logic up to check for implementations of these options and
// to provide appropriate HAVE_xxxxx definitions accordingly.

res = setsockopt(mSocket, SOL_SOCKET, SO_REUSEADDR, (void *) &one, sizeof(one));
res = setsockopt(mSocket, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<const void *>(&one), sizeof(one));
static_cast<void>(res);

#ifdef SO_REUSEPORT
res = setsockopt(mSocket, SOL_SOCKET, SO_REUSEPORT, (void *) &one, sizeof(one));
res = setsockopt(mSocket, SOL_SOCKET, SO_REUSEPORT, reinterpret_cast<const void *>(&one), sizeof(one));
if (res != 0)
{
ChipLogError(Inet, "SO_REUSEPORT failed: %d", errno);
Expand All @@ -987,7 +987,7 @@ INET_ERROR IPEndPointBasis::GetSocket(IPAddressType aAddressType, int aType, int
#ifdef IPV6_V6ONLY
if (aAddressType == kIPAddressType_IPv6)
{
res = setsockopt(mSocket, IPPROTO_IPV6, IPV6_V6ONLY, (void *) &one, sizeof(one));
res = setsockopt(mSocket, IPPROTO_IPV6, IPV6_V6ONLY, reinterpret_cast<const void *>(&one), sizeof(one));
if (res != 0)
{
ChipLogError(Inet, "IPV6_V6ONLY failed: %d", errno);
Expand All @@ -999,7 +999,7 @@ INET_ERROR IPEndPointBasis::GetSocket(IPAddressType aAddressType, int aType, int
#ifdef IP_PKTINFO
if (aAddressType == kIPAddressType_IPv4)
{
res = setsockopt(mSocket, IPPROTO_IP, IP_PKTINFO, (void *) &one, sizeof(one));
res = setsockopt(mSocket, IPPROTO_IP, IP_PKTINFO, reinterpret_cast<const void *>(&one), sizeof(one));
if (res != 0)
{
ChipLogError(Inet, "IP_PKTINFO failed: %d", errno);
Expand All @@ -1011,7 +1011,7 @@ INET_ERROR IPEndPointBasis::GetSocket(IPAddressType aAddressType, int aType, int
#ifdef IPV6_RECVPKTINFO
if (aAddressType == kIPAddressType_IPv6)
{
res = setsockopt(mSocket, IPPROTO_IPV6, IPV6_RECVPKTINFO, (void *) &one, sizeof(one));
res = setsockopt(mSocket, IPPROTO_IPV6, IPV6_RECVPKTINFO, reinterpret_cast<const void *>(&one), sizeof(one));
if (res != 0)
{
ChipLogError(Inet, "IPV6_PKTINFO failed: %d", errno);
Expand Down
4 changes: 2 additions & 2 deletions src/inet/TCPEndPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ INET_ERROR TCPEndPoint::Connect(IPAddress addr, uint16_t port, InterfaceId intfI
// If the permission is denied(EACCES) because CHIP is running in a context
// that does not have privileged access, choose a source address on the
// interface to bind the connetion to.
int r = setsockopt(mSocket, SOL_SOCKET, SO_BINDTODEVICE, (void *) &ifr, sizeof(ifr));
int r = setsockopt(mSocket, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr));
if (r < 0 && errno != EACCES)
{
return res = chip::System::MapErrorPOSIX(errno);
Expand Down Expand Up @@ -2227,7 +2227,7 @@ INET_ERROR TCPEndPoint::GetSocket(IPAddressType addrType)
if (family == PF_INET6)
{
int one = 1;
setsockopt(mSocket, IPPROTO_IPV6, IPV6_V6ONLY, (void *) &one, sizeof(one));
setsockopt(mSocket, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(one));
}
#endif // defined(IPV6_V6ONLY)

Expand Down
6 changes: 3 additions & 3 deletions src/inet/tests/TestInetAddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1234,22 +1234,22 @@ void CheckFromSocket(nlTestSuite * inSuite, void * inContext)
memset(&sock_v4, 0, sizeof(struct sockaddr_in));
sock_v4.sin_family = AF_INET;
memcpy(&sock_v4.sin_addr.s_addr, &addr[3], sizeof(struct in_addr));
test_addr_2 = IPAddress::FromSockAddr((struct sockaddr &) sock_v4);
test_addr_2 = IPAddress::FromSockAddr(reinterpret_cast<struct sockaddr &>(sock_v4));
break;
#endif // INET_CONFIG_ENABLE_IPV4

case kIPAddressType_IPv6:
memset(&sock_v6, 0, sizeof(struct sockaddr_in6));
sock_v6.sin6_family = AF_INET6;
memcpy(&sock_v6.sin6_addr.s6_addr, addr, sizeof(struct in6_addr));
test_addr_2 = IPAddress::FromSockAddr((struct sockaddr &) sock_v6);
test_addr_2 = IPAddress::FromSockAddr(reinterpret_cast<struct sockaddr &>(sock_v6));
break;

case kIPAddressType_Any:
memset(&sock_v6, 0, sizeof(struct sockaddr_in6));
sock_v6.sin6_family = 0;
memcpy(&sock_v6.sin6_addr.s6_addr, addr, sizeof(struct in6_addr));
test_addr_2 = IPAddress::FromSockAddr((struct sockaddr &) sock_v6);
test_addr_2 = IPAddress::FromSockAddr(reinterpret_cast<struct sockaddr &>(sock_v6));
break;

default:
Expand Down
Loading

0 comments on commit 16c921f

Please sign in to comment.