mirror of
https://github.com/oe7drt/YSFClients.git
synced 2025-12-06 05:32:02 +01:00
Fix nullptr instead of NULL argument usage in getaddrinfo().
Bump version.
This commit is contained in:
parent
00873b6cea
commit
f4b985d165
|
|
@ -94,7 +94,7 @@ int CUDPSocket::lookup(const std::string& hostname, unsigned short port, sockadd
|
||||||
/* Port is always digits, no needs to lookup service */
|
/* Port is always digits, no needs to lookup service */
|
||||||
hints.ai_flags |= AI_NUMERICSERV;
|
hints.ai_flags |= AI_NUMERICSERV;
|
||||||
|
|
||||||
int err = ::getaddrinfo(hostname.empty() ? nullptr : hostname.c_str(), portstr.c_str(), &hints, &res);
|
int err = ::getaddrinfo(hostname.empty() ? NULL : hostname.c_str(), portstr.c_str(), &hints, &res);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
sockaddr_in* paddr = (sockaddr_in*)&addr;
|
sockaddr_in* paddr = (sockaddr_in*)&addr;
|
||||||
::memset(paddr, 0x00U, address_length = sizeof(sockaddr_in));
|
::memset(paddr, 0x00U, address_length = sizeof(sockaddr_in));
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,6 @@
|
||||||
#if !defined(VERSION_H)
|
#if !defined(VERSION_H)
|
||||||
#define VERSION_H
|
#define VERSION_H
|
||||||
|
|
||||||
const char* VERSION = "20250319";
|
const char* VERSION = "20250607";
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ int CUDPSocket::lookup(const std::string& hostname, unsigned short port, sockadd
|
||||||
/* Port is always digits, no needs to lookup service */
|
/* Port is always digits, no needs to lookup service */
|
||||||
hints.ai_flags |= AI_NUMERICSERV;
|
hints.ai_flags |= AI_NUMERICSERV;
|
||||||
|
|
||||||
int err = ::getaddrinfo(hostname.empty() ? nullptr : hostname.c_str(), portstr.c_str(), &hints, &res);
|
int err = ::getaddrinfo(hostname.empty() ? NULL : hostname.c_str(), portstr.c_str(), &hints, &res);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
sockaddr_in* paddr = (sockaddr_in*)&addr;
|
sockaddr_in* paddr = (sockaddr_in*)&addr;
|
||||||
::memset(paddr, 0x00U, address_length = sizeof(sockaddr_in));
|
::memset(paddr, 0x00U, address_length = sizeof(sockaddr_in));
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,6 @@
|
||||||
#if !defined(VERSION_H)
|
#if !defined(VERSION_H)
|
||||||
#define VERSION_H
|
#define VERSION_H
|
||||||
|
|
||||||
const char* VERSION = "20250319";
|
const char* VERSION = "20250607";
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ int CUDPSocket::lookup(const std::string& hostname, unsigned short port, sockadd
|
||||||
/* Port is always digits, no needs to lookup service */
|
/* Port is always digits, no needs to lookup service */
|
||||||
hints.ai_flags |= AI_NUMERICSERV;
|
hints.ai_flags |= AI_NUMERICSERV;
|
||||||
|
|
||||||
int err = ::getaddrinfo(hostname.empty() ? nullptr : hostname.c_str(), portstr.c_str(), &hints, &res);
|
int err = ::getaddrinfo(hostname.empty() ? NULL : hostname.c_str(), portstr.c_str(), &hints, &res);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
sockaddr_in* paddr = (sockaddr_in*)&addr;
|
sockaddr_in* paddr = (sockaddr_in*)&addr;
|
||||||
::memset(paddr, 0x00U, address_length = sizeof(sockaddr_in));
|
::memset(paddr, 0x00U, address_length = sizeof(sockaddr_in));
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,6 @@
|
||||||
#if !defined(VERSION_H)
|
#if !defined(VERSION_H)
|
||||||
#define VERSION_H
|
#define VERSION_H
|
||||||
|
|
||||||
const char* VERSION = "20250319";
|
const char* VERSION = "20250607";
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue