mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-19 13:07:55 +00:00
Merge pull request #1799 from zerotier/cleanup/suggest-braces
Fix warning: suggest braces around initialization of subobject
This commit is contained in:
commit
a25da7f771
@ -573,7 +573,26 @@ namespace {
|
||||
return true;
|
||||
}
|
||||
|
||||
struct sockaddr_storage nullAddress = {0};
|
||||
//
|
||||
// was:
|
||||
// struct sockaddr_storage nullAddress = {0};
|
||||
//
|
||||
// but was getting this warning:
|
||||
// warning: suggest braces around initialization of subobject
|
||||
//
|
||||
// when building ZeroTierOne
|
||||
//
|
||||
struct sockaddr_storage nullAddress;
|
||||
|
||||
//
|
||||
// It is possible to assume knowledge about internals of sockaddr_storage and construct
|
||||
// correct 0-initializer, but it is simpler to just treat sockaddr_storage as opaque and
|
||||
// use memset here to fill with 0
|
||||
//
|
||||
// This is also done in InetAddress.hpp for InetAddress
|
||||
//
|
||||
memset(&nullAddress, 0, sizeof(sockaddr_storage));
|
||||
|
||||
jobject remoteAddressObj = NULL;
|
||||
|
||||
if(memcmp(remoteAddress, &nullAddress, sizeof(sockaddr_storage)) != 0)
|
||||
|
Loading…
Reference in New Issue
Block a user