2009-11-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Copied in_addr instead of just casting from char* which might
	violate strict aliasing rules.
	* src/AsyncNameResolver.cc
pull/1/head
Tatsuhiro Tsujikawa 2009-11-15 13:27:46 +00:00
parent 7b63e121c7
commit 928de09345
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2009-11-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Copied in_addr instead of just casting from char* which might
violate strict aliasing rules.
* src/AsyncNameResolver.cc
2009-11-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use dynamic_pointer_cast

View File

@ -56,8 +56,9 @@ void callback(void* arg, int status, struct hostent* host)
return;
}
for(char** ap = host->h_addr_list; *ap; ++ap) {
resolverPtr->_resolvedAddresses.push_back
(inet_ntoa(*reinterpret_cast<struct in_addr*>(*ap)));
struct in_addr addr;
memcpy(&addr, *ap, sizeof(in_addr));
resolverPtr->_resolvedAddresses.push_back(inet_ntoa(addr));
}
resolverPtr->status = AsyncNameResolver::STATUS_SUCCESS;
}