mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-01 10:20:04 +02:00
clang-tidy nullptr
This commit is contained in:
parent
74d67261a9
commit
55f482f915
@ -20,7 +20,7 @@ ClientSocket::ClientSocket(std::string stype, const std::string &host,
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_flags |= AI_CANONNAME;
|
||||
|
||||
if (getaddrinfo(host.c_str(), NULL, &hints, &result) != 0) {
|
||||
if (getaddrinfo(host.c_str(), nullptr, &hints, &result) != 0) {
|
||||
std::string msg = "ClientSocket cannot decode host:" + host +
|
||||
" on port " + std::to_string(port) + "\n";
|
||||
throw SocketError(msg);
|
||||
|
@ -108,7 +108,7 @@ ConvertHostnameToInternetAddress(const std::string &hostname) {
|
||||
hints.ai_flags |= AI_CANONNAME;
|
||||
|
||||
struct sockaddr_in serverAddr {};
|
||||
if (getaddrinfo(hostname.c_str(), NULL, &hints, &result) != 0) {
|
||||
if (getaddrinfo(hostname.c_str(), nullptr, &hints, &result) != 0) {
|
||||
freeaddrinfo(result);
|
||||
std::string msg = "ClientSocket cannot decode host:" + hostname + "\n";
|
||||
throw SocketError(msg);
|
||||
@ -129,13 +129,13 @@ int ConvertHostnameToInternetAddress(const char *const hostname,
|
||||
hints.ai_family = AF_INET;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
// get host info into res
|
||||
int errcode = getaddrinfo(hostname, NULL, &hints, res);
|
||||
int errcode = getaddrinfo(hostname, nullptr, &hints, res);
|
||||
if (errcode != 0) {
|
||||
FILE_LOG(logERROR) << "Could not convert hostname (" << hostname
|
||||
<< ") to internet address (zmq):"
|
||||
<< gai_strerror(errcode);
|
||||
} else {
|
||||
if (*res == NULL) {
|
||||
if (*res == nullptr) {
|
||||
FILE_LOG(logERROR) << "Could not converthostname (" << hostname
|
||||
<< ") to internet address (zmq):"
|
||||
"gettaddrinfo returned null";
|
||||
@ -160,7 +160,7 @@ int ConvertInternetAddresstoIpString(struct ::addrinfo *res, char *ip,
|
||||
const int ipsize) {
|
||||
if (inet_ntop(res->ai_family,
|
||||
&((struct sockaddr_in *)res->ai_addr)->sin_addr, ip,
|
||||
ipsize) != NULL) {
|
||||
ipsize) != nullptr) {
|
||||
::freeaddrinfo(res);
|
||||
return 0;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ uint32_t HostnameToIp(const char *hostname) {
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = AF_INET;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
if (getaddrinfo(hostname, NULL, &hints, &result)) {
|
||||
if (getaddrinfo(hostname, nullptr, &hints, &result)) {
|
||||
freeaddrinfo(result);
|
||||
throw RuntimeError("Could not convert hostname to ip");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user