From: Viktor Szakats Date: Wed, 12 Mar 2025 14:36:47 +0000 (+0100) Subject: build: replace Curl_ prefix with curlx_ for functions used in servers X-Git-Tag: curl-8_13_0~158 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ee73d553edf181c1f2673e61d1754365d98380c6;p=thirdparty%2Fcurl.git build: replace Curl_ prefix with curlx_ for functions used in servers Closes #16689 --- diff --git a/lib/altsvc.c b/lib/altsvc.c index d478a874d1..c4dca59f3d 100644 --- a/lib/altsvc.c +++ b/lib/altsvc.c @@ -261,11 +261,11 @@ static CURLcode altsvc_out(struct altsvc *as, FILE *fp) #ifdef USE_IPV6 else { char ipv6_unused[16]; - if(1 == Curl_inet_pton(AF_INET6, as->dst.host, ipv6_unused)) { + if(1 == curlx_inet_pton(AF_INET6, as->dst.host, ipv6_unused)) { dst6_pre = "["; dst6_post = "]"; } - if(1 == Curl_inet_pton(AF_INET6, as->src.host, ipv6_unused)) { + if(1 == curlx_inet_pton(AF_INET6, as->src.host, ipv6_unused)) { src6_pre = "["; src6_post = "]"; } diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c index b15b3e197f..08de7341c3 100644 --- a/lib/asyn-ares.c +++ b/lib/asyn-ares.c @@ -932,7 +932,7 @@ CURLcode Curl_set_dns_local_ip4(struct Curl_easy *data, a4.s_addr = 0; /* disabled: do not bind to a specific address */ } else { - if(Curl_inet_pton(AF_INET, local_ip4, &a4) != 1) { + if(curlx_inet_pton(AF_INET, local_ip4, &a4) != 1) { DEBUGF(infof(data, "bad DNS IPv4 address")); return CURLE_BAD_FUNCTION_ARGUMENT; } @@ -960,7 +960,7 @@ CURLcode Curl_set_dns_local_ip6(struct Curl_easy *data, memset(a6, 0, sizeof(a6)); } else { - if(Curl_inet_pton(AF_INET6, local_ip6, a6) != 1) { + if(curlx_inet_pton(AF_INET6, local_ip6, a6) != 1) { DEBUGF(infof(data, "bad DNS IPv6 address")); return CURLE_BAD_FUNCTION_ARGUMENT; } diff --git a/lib/cf-socket.c b/lib/cf-socket.c index 4fe0315bc9..260b52333d 100644 --- a/lib/cf-socket.c +++ b/lib/cf-socket.c @@ -721,7 +721,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn, if(scope_ptr) *(scope_ptr++) = '\0'; #endif - if(Curl_inet_pton(AF_INET6, myhost, &si6->sin6_addr) > 0) { + if(curlx_inet_pton(AF_INET6, myhost, &si6->sin6_addr) > 0) { si6->sin6_family = AF_INET6; si6->sin6_port = htons(port); #ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID @@ -744,7 +744,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn, #endif /* IPv4 address */ if((af == AF_INET) && - (Curl_inet_pton(AF_INET, myhost, &si4->sin_addr) > 0)) { + (curlx_inet_pton(AF_INET, myhost, &si4->sin_addr) > 0)) { si4->sin_family = AF_INET; si4->sin_port = htons(port); sizeof_sa = sizeof(struct sockaddr_in); diff --git a/lib/connect.c b/lib/connect.c index 076e67c579..327a6c36d8 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -254,7 +254,7 @@ addr_next_match(const struct Curl_addrinfo *addr, int family) } /* retrieves ip address and port from a sockaddr structure. - note it calls Curl_inet_ntop which sets errno on fail, not SOCKERRNO. */ + note it calls curlx_inet_ntop which sets errno on fail, not SOCKERRNO. */ bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen, char *addr, int *port) { @@ -271,8 +271,8 @@ bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen, switch(sa->sa_family) { case AF_INET: si = (struct sockaddr_in *)(void *) sa; - if(Curl_inet_ntop(sa->sa_family, &si->sin_addr, - addr, MAX_IPADR_LEN)) { + if(curlx_inet_ntop(sa->sa_family, &si->sin_addr, + addr, MAX_IPADR_LEN)) { unsigned short us_port = ntohs(si->sin_port); *port = us_port; return TRUE; @@ -281,8 +281,8 @@ bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen, #ifdef USE_IPV6 case AF_INET6: si6 = (struct sockaddr_in6 *)(void *) sa; - if(Curl_inet_ntop(sa->sa_family, &si6->sin6_addr, - addr, MAX_IPADR_LEN)) { + if(curlx_inet_ntop(sa->sa_family, &si6->sin6_addr, + addr, MAX_IPADR_LEN)) { unsigned short us_port = ntohs(si6->sin6_port); *port = us_port; return TRUE; diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 39cff02f3c..d7b98f468c 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -430,13 +430,13 @@ Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port) struct Curl_addrinfo *Curl_str2addr(char *address, int port) { struct in_addr in; - if(Curl_inet_pton(AF_INET, address, &in) > 0) + if(curlx_inet_pton(AF_INET, address, &in) > 0) /* This is a dotted IP address 123.123.123.123-style */ return Curl_ip2addr(AF_INET, &in, address, port); #ifdef USE_IPV6 { struct in6_addr in6; - if(Curl_inet_pton(AF_INET6, address, &in6) > 0) + if(curlx_inet_pton(AF_INET6, address, &in6) > 0) /* This is a dotted IPv6 address ::1-style */ return Curl_ip2addr(AF_INET6, &in6, address, port); } diff --git a/lib/curl_setup.h b/lib/curl_setup.h index f9c062b060..86c8cb07b6 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -469,9 +469,9 @@ #endif #ifdef _WIN32 -#define Curl_getpid() GetCurrentProcessId() +#define curlx_getpid() GetCurrentProcessId() #else -#define Curl_getpid() getpid() +#define curlx_getpid() getpid() #endif /* diff --git a/lib/ftp.c b/lib/ftp.c index b13d4c0a3f..849254f451 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -913,7 +913,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data, /* either ipv6 or (ipv4|domain|interface):port(-range) */ addrlen = ip_end - string_ftpport; #ifdef USE_IPV6 - if(Curl_inet_pton(AF_INET6, string_ftpport, &sa6->sin6_addr) == 1) { + if(curlx_inet_pton(AF_INET6, string_ftpport, &sa6->sin6_addr) == 1) { /* ipv6 */ port_min = port_max = 0; ip_end = NULL; /* this got no port ! */ @@ -999,11 +999,11 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data, switch(sa->sa_family) { #ifdef USE_IPV6 case AF_INET6: - r = Curl_inet_ntop(sa->sa_family, &sa6->sin6_addr, hbuf, sizeof(hbuf)); + r = curlx_inet_ntop(sa->sa_family, &sa6->sin6_addr, hbuf, sizeof(hbuf)); break; #endif default: - r = Curl_inet_ntop(sa->sa_family, &sa4->sin_addr, hbuf, sizeof(hbuf)); + r = curlx_inet_ntop(sa->sa_family, &sa4->sin_addr, hbuf, sizeof(hbuf)); break; } if(!r) { diff --git a/lib/hostip.c b/lib/hostip.c index d92999a650..26b2057479 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -145,14 +145,14 @@ void Curl_printable_address(const struct Curl_addrinfo *ai, char *buf, case AF_INET: { const struct sockaddr_in *sa4 = (const void *)ai->ai_addr; const struct in_addr *ipaddr4 = &sa4->sin_addr; - (void)Curl_inet_ntop(ai->ai_family, (const void *)ipaddr4, buf, bufsize); + (void)curlx_inet_ntop(ai->ai_family, (const void *)ipaddr4, buf, bufsize); break; } #ifdef USE_IPV6 case AF_INET6: { const struct sockaddr_in6 *sa6 = (const void *)ai->ai_addr; const struct in6_addr *ipaddr6 = &sa6->sin6_addr; - (void)Curl_inet_ntop(ai->ai_family, (const void *)ipaddr6, buf, bufsize); + (void)curlx_inet_ntop(ai->ai_family, (const void *)ipaddr6, buf, bufsize); break; } #endif @@ -549,7 +549,7 @@ static struct Curl_addrinfo *get_localhost6(int port, const char *name) sa6.sin6_scope_id = 0; #endif - (void)Curl_inet_pton(AF_INET6, "::1", ipv6); + (void)curlx_inet_pton(AF_INET6, "::1", ipv6); memcpy(&sa6.sin6_addr, ipv6, sizeof(ipv6)); ca->ai_flags = 0; @@ -583,7 +583,7 @@ static struct Curl_addrinfo *get_localhost(int port, const char *name) memset(&sa, 0, sizeof(sa)); sa.sin_family = AF_INET; sa.sin_port = htons(port16); - if(Curl_inet_pton(AF_INET, "127.0.0.1", (char *)&ipv4) < 1) + if(curlx_inet_pton(AF_INET, "127.0.0.1", (char *)&ipv4) < 1) return NULL; memcpy(&sa.sin_addr, &ipv4, sizeof(ipv4)); @@ -651,9 +651,9 @@ bool Curl_host_is_ipnum(const char *hostname) #ifdef USE_IPV6 struct in6_addr in6; #endif - if(Curl_inet_pton(AF_INET, hostname, &in) > 0 + if(curlx_inet_pton(AF_INET, hostname, &in) > 0 #ifdef USE_IPV6 - || Curl_inet_pton(AF_INET6, hostname, &in6) > 0 + || curlx_inet_pton(AF_INET6, hostname, &in6) > 0 #endif ) return TRUE; @@ -761,7 +761,7 @@ enum resolve_t Curl_resolv(struct Curl_easy *data, #ifndef USE_RESOLVE_ON_IPS /* First check if this is an IPv4 address string */ - if(Curl_inet_pton(AF_INET, hostname, &in) > 0) { + if(curlx_inet_pton(AF_INET, hostname, &in) > 0) { /* This is a dotted IP address 123.123.123.123-style */ addr = Curl_ip2addr(AF_INET, &in, hostname, port); if(!addr) @@ -771,7 +771,7 @@ enum resolve_t Curl_resolv(struct Curl_easy *data, else { struct in6_addr in6; /* check if this is an IPv6 address string */ - if(Curl_inet_pton(AF_INET6, hostname, &in6) > 0) { + if(curlx_inet_pton(AF_INET6, hostname, &in6) > 0) { /* This is an IPv6 address literal */ addr = Curl_ip2addr(AF_INET6, &in6, hostname, port); if(!addr) @@ -783,14 +783,14 @@ enum resolve_t Curl_resolv(struct Curl_easy *data, #else /* if USE_RESOLVE_ON_IPS */ #ifndef CURL_DISABLE_DOH /* First check if this is an IPv4 address string */ - if(Curl_inet_pton(AF_INET, hostname, &in) > 0) + if(curlx_inet_pton(AF_INET, hostname, &in) > 0) /* This is a dotted IP address 123.123.123.123-style */ ipnum = TRUE; #ifdef USE_IPV6 else { struct in6_addr in6; /* check if this is an IPv6 address string */ - if(Curl_inet_pton(AF_INET6, hostname, &in6) > 0) + if(curlx_inet_pton(AF_INET6, hostname, &in6) > 0) /* This is an IPv6 address literal */ ipnum = TRUE; } diff --git a/lib/hostip6.c b/lib/hostip6.c index c16ddfe58d..7c68c40c9c 100644 --- a/lib/hostip6.c +++ b/lib/hostip6.c @@ -126,8 +126,8 @@ struct Curl_addrinfo *Curl_getaddrinfo(struct Curl_easy *data, * The AI_NUMERICHOST must not be set to get synthesized IPv6 address from * an IPv4 address on iOS and macOS. */ - if((1 == Curl_inet_pton(AF_INET, hostname, addrbuf)) || - (1 == Curl_inet_pton(AF_INET6, hostname, addrbuf))) { + if((1 == curlx_inet_pton(AF_INET, hostname, addrbuf)) || + (1 == curlx_inet_pton(AF_INET6, hostname, addrbuf))) { /* the given address is numerical only, prevent a reverse lookup */ hints.ai_flags = AI_NUMERICHOST; } diff --git a/lib/if2ip.c b/lib/if2ip.c index 5b1f2d209c..7792fa6c4b 100644 --- a/lib/if2ip.c +++ b/lib/if2ip.c @@ -162,7 +162,7 @@ if2ip_result_t Curl_if2ip(int af, addr = &((struct sockaddr_in *)(void *)iface->ifa_addr)->sin_addr; res = IF2IP_FOUND; - ip = Curl_inet_ntop(af, addr, ipstr, sizeof(ipstr)); + ip = curlx_inet_ntop(af, addr, ipstr, sizeof(ipstr)); msnprintf(buf, buf_size, "%s%s", ip, scope); break; } @@ -235,7 +235,7 @@ if2ip_result_t Curl_if2ip(int af, s = (struct sockaddr_in *)(void *)&req.ifr_addr; memcpy(&in, &s->sin_addr, sizeof(in)); - r = Curl_inet_ntop(s->sin_family, &in, buf, buf_size); + r = curlx_inet_ntop(s->sin_family, &in, buf, buf_size); sclose(dummy); if(!r) diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c index f666f55c88..51126ce9c4 100644 --- a/lib/inet_ntop.c +++ b/lib/inet_ntop.c @@ -189,7 +189,7 @@ static char *inet_ntop6(const unsigned char *src, char *dst, size_t size) * code. This is to avoid losing the actual last Winsock error. When this * function returns NULL, check errno not SOCKERRNO. */ -char *Curl_inet_ntop(int af, const void *src, char *buf, size_t size) +char *curlx_inet_ntop(int af, const void *src, char *buf, size_t size) { switch(af) { case AF_INET: diff --git a/lib/inet_ntop.h b/lib/inet_ntop.h index 84e5eb277a..97d5adedb5 100644 --- a/lib/inet_ntop.h +++ b/lib/inet_ntop.h @@ -26,7 +26,7 @@ #include "curl_setup.h" -char *Curl_inet_ntop(int af, const void *addr, char *buf, size_t size); +char *curlx_inet_ntop(int af, const void *addr, char *buf, size_t size); #ifdef HAVE_INET_NTOP #ifdef HAVE_NETINET_IN_H @@ -39,11 +39,11 @@ char *Curl_inet_ntop(int af, const void *addr, char *buf, size_t size); #include #endif #ifdef __AMIGA__ -#define Curl_inet_ntop(af,addr,buf,size) \ +#define curlx_inet_ntop(af,addr,buf,size) \ (char *)inet_ntop(af, CURL_UNCONST(addr), (unsigned char *)buf, \ (curl_socklen_t)(size)) #else -#define Curl_inet_ntop(af,addr,buf,size) \ +#define curlx_inet_ntop(af,addr,buf,size) \ inet_ntop(af, addr, buf, (curl_socklen_t)(size)) #endif #endif diff --git a/lib/inet_pton.c b/lib/inet_pton.c index ad9fe4da0b..7531f719c7 100644 --- a/lib/inet_pton.c +++ b/lib/inet_pton.c @@ -72,7 +72,7 @@ static int inet_pton6(const char *src, unsigned char *dst); * Paul Vixie, 1996. */ int -Curl_inet_pton(int af, const char *src, void *dst) +curlx_inet_pton(int af, const char *src, void *dst) { switch(af) { case AF_INET: diff --git a/lib/inet_pton.h b/lib/inet_pton.h index 9d78ce9ecf..fa6ee7a0ba 100644 --- a/lib/inet_pton.h +++ b/lib/inet_pton.h @@ -26,7 +26,7 @@ #include "curl_setup.h" -int Curl_inet_pton(int, const char *, void *); +int curlx_inet_pton(int, const char *, void *); #ifdef HAVE_INET_PTON #ifdef HAVE_NETINET_IN_H @@ -39,9 +39,9 @@ int Curl_inet_pton(int, const char *, void *); #include #endif #ifdef __AMIGA__ -#define Curl_inet_pton(x,y,z) inet_pton(x,(unsigned char *)CURL_UNCONST(y),z) +#define curlx_inet_pton(x,y,z) inet_pton(x,(unsigned char *)CURL_UNCONST(y),z) #else -#define Curl_inet_pton(x,y,z) inet_pton(x,y,z) +#define curlx_inet_pton(x,y,z) inet_pton(x,y,z) #endif #endif diff --git a/lib/noproxy.c b/lib/noproxy.c index d8cf1ddd74..e0838b8762 100644 --- a/lib/noproxy.c +++ b/lib/noproxy.c @@ -54,9 +54,9 @@ UNITTEST bool Curl_cidr4_match(const char *ipv4, /* 1.2.3.4 address */ /* strange input */ return FALSE; - if(1 != Curl_inet_pton(AF_INET, ipv4, &address)) + if(1 != curlx_inet_pton(AF_INET, ipv4, &address)) return FALSE; - if(1 != Curl_inet_pton(AF_INET, network, &check)) + if(1 != curlx_inet_pton(AF_INET, network, &check)) return FALSE; if(bits && (bits != 32)) { @@ -92,9 +92,9 @@ UNITTEST bool Curl_cidr6_match(const char *ipv6, rest = bits & 0x07; if((bytes > 16) || ((bytes == 16) && rest)) return FALSE; - if(1 != Curl_inet_pton(AF_INET6, ipv6, address)) + if(1 != curlx_inet_pton(AF_INET6, ipv6, address)) return FALSE; - if(1 != Curl_inet_pton(AF_INET6, network, check)) + if(1 != curlx_inet_pton(AF_INET6, network, check)) return FALSE; if(bytes && memcmp(address, check, bytes)) return FALSE; @@ -163,7 +163,7 @@ bool Curl_check_noproxy(const char *name, const char *no_proxy) else { unsigned int address; namelen = strlen(name); - if(1 == Curl_inet_pton(AF_INET, name, &address)) + if(1 == curlx_inet_pton(AF_INET, name, &address)) type = TYPE_IPV4; else { /* ignore trailing dots in the hostname */ diff --git a/lib/smb.c b/lib/smb.c index 35fd93401e..164b7951d8 100644 --- a/lib/smb.c +++ b/lib/smb.c @@ -544,7 +544,7 @@ static void smb_format_message(struct Curl_easy *data, struct smb_header *h, h->flags2 = smb_swap16(SMB_FLAGS2_IS_LONG_NAME | SMB_FLAGS2_KNOWS_LONG_NAME); h->uid = smb_swap16(smbc->uid); h->tid = smb_swap16(req->tid); - pid = (unsigned int)Curl_getpid(); + pid = (unsigned int)curlx_getpid(); h->pid_high = smb_swap16((unsigned short)(pid >> 16)); h->pid = smb_swap16((unsigned short) pid); } diff --git a/lib/socks.c b/lib/socks.c index 0ef6b140ae..3a88f0b386 100644 --- a/lib/socks.c +++ b/lib/socks.c @@ -911,7 +911,7 @@ CONNECT_RESOLVE_REMOTE: #ifdef USE_IPV6 if(conn->bits.ipv6_ip) { char ip6[16]; - if(1 != Curl_inet_pton(AF_INET6, sx->hostname, ip6)) + if(1 != curlx_inet_pton(AF_INET6, sx->hostname, ip6)) return CURLPX_BAD_ADDRESS_TYPE; socksreq[len++] = 4; memcpy(&socksreq[len], ip6, sizeof(ip6)); @@ -919,7 +919,7 @@ CONNECT_RESOLVE_REMOTE: } else #endif - if(1 == Curl_inet_pton(AF_INET, sx->hostname, ip4)) { + if(1 == curlx_inet_pton(AF_INET, sx->hostname, ip4)) { socksreq[len++] = 1; memcpy(&socksreq[len], ip4, sizeof(ip4)); len += sizeof(ip4); diff --git a/lib/strerror.c b/lib/strerror.c index 6f07101873..abbdb857e3 100644 --- a/lib/strerror.c +++ b/lib/strerror.c @@ -829,7 +829,7 @@ get_winapi_error(int err, char *buf, size_t buflen) * * It may be more correct to call one of the variant functions instead: * Call Curl_sspi_strerror if the error code is definitely Windows SSPI. - * Call Curl_winapi_strerror if the error code is definitely Windows API. + * Call curlx_winapi_strerror if the error code is definitely Windows API. */ const char *Curl_strerror(int err, char *buf, size_t buflen) { @@ -922,11 +922,11 @@ const char *Curl_strerror(int err, char *buf, size_t buflen) } /* - * Curl_winapi_strerror: + * curlx_winapi_strerror: * Variant of Curl_strerror if the error code is definitely Windows API. */ #ifdef _WIN32 -const char *Curl_winapi_strerror(DWORD err, char *buf, size_t buflen) +const char *curlx_winapi_strerror(DWORD err, char *buf, size_t buflen) { #ifdef PRESERVE_WINDOWS_ERROR_CODE DWORD old_win_err = GetLastError(); diff --git a/lib/strerror.h b/lib/strerror.h index 069acfc2ab..3dd382b96a 100644 --- a/lib/strerror.h +++ b/lib/strerror.h @@ -30,7 +30,7 @@ const char *Curl_strerror(int err, char *buf, size_t buflen); #ifdef _WIN32 -const char *Curl_winapi_strerror(DWORD err, char *buf, size_t buflen); +const char *curlx_winapi_strerror(DWORD err, char *buf, size_t buflen); #endif #ifdef USE_WINDOWS_SSPI const char *Curl_sspi_strerror(int err, char *buf, size_t buflen); diff --git a/lib/urlapi.c b/lib/urlapi.c index c8db06b123..e4266a59f0 100644 --- a/lib/urlapi.c +++ b/lib/urlapi.c @@ -513,9 +513,9 @@ static CURLUcode ipv6_parse(struct Curl_URL *u, char *hostname, { char dest[16]; /* fits a binary IPv6 address */ hostname[hlen] = 0; /* end the address there */ - if(1 != Curl_inet_pton(AF_INET6, hostname, dest)) + if(1 != curlx_inet_pton(AF_INET6, hostname, dest)) return CURLUE_BAD_IPV6; - if(Curl_inet_ntop(AF_INET6, dest, hostname, hlen)) { + if(curlx_inet_ntop(AF_INET6, dest, hostname, hlen)) { hlen = strlen(hostname); /* might be shorter now */ hostname[hlen + 1] = 0; } diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c index 7f807ae9b4..6924140299 100644 --- a/lib/vtls/gtls.c +++ b/lib/vtls/gtls.c @@ -1589,10 +1589,10 @@ Curl_gtls_verifyserver(struct Curl_easy *data, unsigned char addrbuf[sizeof(struct use_addr)]; size_t addrlen = 0; - if(Curl_inet_pton(AF_INET, peer->hostname, addrbuf) > 0) + if(curlx_inet_pton(AF_INET, peer->hostname, addrbuf) > 0) addrlen = 4; #ifdef USE_IPV6 - else if(Curl_inet_pton(AF_INET6, peer->hostname, addrbuf) > 0) + else if(curlx_inet_pton(AF_INET6, peer->hostname, addrbuf) > 0) addrlen = 16; #endif diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index 7fdf667cba..1beda3133a 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -2218,14 +2218,14 @@ static CURLcode ossl_verifyhost(struct Curl_easy *data, hostlen = strlen(peer->hostname); switch(peer->type) { case CURL_SSL_PEER_IPV4: - if(!Curl_inet_pton(AF_INET, peer->hostname, &addr)) + if(!curlx_inet_pton(AF_INET, peer->hostname, &addr)) return CURLE_PEER_FAILED_VERIFICATION; target = GEN_IPADD; addrlen = sizeof(struct in_addr); break; #ifdef USE_IPV6 case CURL_SSL_PEER_IPV6: - if(!Curl_inet_pton(AF_INET6, peer->hostname, &addr)) + if(!curlx_inet_pton(AF_INET6, peer->hostname, &addr)) return CURLE_PEER_FAILED_VERIFICATION; target = GEN_IPADD; addrlen = sizeof(struct in6_addr); diff --git a/lib/vtls/schannel_verify.c b/lib/vtls/schannel_verify.c index ff7f505926..3b9f786f1d 100644 --- a/lib/vtls/schannel_verify.c +++ b/lib/vtls/schannel_verify.c @@ -179,7 +179,7 @@ static CURLcode add_certs_data_to_store(HCERTSTORE trust_store, "schannel: failed to extract certificate from CA file " "'%s': %s", ca_file_text, - Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer))); + curlx_winapi_strerror(GetLastError(), buffer, sizeof(buffer))); result = CURLE_SSL_CACERT_BADFILE; more_certs = 0; } @@ -208,8 +208,8 @@ static CURLcode add_certs_data_to_store(HCERTSTORE trust_store, "schannel: failed to add certificate from CA file '%s' " "to certificate store: %s", ca_file_text, - Curl_winapi_strerror(GetLastError(), buffer, - sizeof(buffer))); + curlx_winapi_strerror(GetLastError(), buffer, + sizeof(buffer))); result = CURLE_SSL_CACERT_BADFILE; more_certs = 0; } @@ -255,7 +255,7 @@ static CURLcode add_certs_file_to_store(HCERTSTORE trust_store, failf(data, "schannel: invalid path name for CA file '%s': %s", ca_file, - Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer))); + curlx_winapi_strerror(GetLastError(), buffer, sizeof(buffer))); result = CURLE_SSL_CACERT_BADFILE; goto cleanup; } @@ -277,7 +277,7 @@ static CURLcode add_certs_file_to_store(HCERTSTORE trust_store, failf(data, "schannel: failed to open CA file '%s': %s", ca_file, - Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer))); + curlx_winapi_strerror(GetLastError(), buffer, sizeof(buffer))); result = CURLE_SSL_CACERT_BADFILE; goto cleanup; } @@ -287,7 +287,7 @@ static CURLcode add_certs_file_to_store(HCERTSTORE trust_store, failf(data, "schannel: failed to determine size of CA file '%s': %s", ca_file, - Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer))); + curlx_winapi_strerror(GetLastError(), buffer, sizeof(buffer))); result = CURLE_SSL_CACERT_BADFILE; goto cleanup; } @@ -317,7 +317,7 @@ static CURLcode add_certs_file_to_store(HCERTSTORE trust_store, failf(data, "schannel: failed to read from CA file '%s': %s", ca_file, - Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer))); + curlx_winapi_strerror(GetLastError(), buffer, sizeof(buffer))); result = CURLE_SSL_CACERT_BADFILE; goto cleanup; } @@ -461,14 +461,14 @@ static bool get_num_host_info(struct num_ip_data *ip_blob, struct in6_addr ia6; bool result = FALSE; - int res = Curl_inet_pton(AF_INET, hostname, &ia); + int res = curlx_inet_pton(AF_INET, hostname, &ia); if(res) { ip_blob->size = sizeof(struct in_addr); memcpy(&ip_blob->bData.ia, &ia, sizeof(struct in_addr)); result = TRUE; } else { - res = Curl_inet_pton(AF_INET6, hostname, &ia6); + res = curlx_inet_pton(AF_INET6, hostname, &ia6); if(res) { ip_blob->size = sizeof(struct in6_addr); memcpy(&ip_blob->bData.ia6, &ia6, sizeof(struct in6_addr)); @@ -805,7 +805,7 @@ CURLcode Curl_verify_certificate(struct Curl_cfilter *cf, if(!trust_store) { char buffer[STRERROR_LEN]; failf(data, "schannel: failed to create certificate store: %s", - Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer))); + curlx_winapi_strerror(GetLastError(), buffer, sizeof(buffer))); result = CURLE_SSL_CACERT_BADFILE; } else { @@ -853,7 +853,7 @@ CURLcode Curl_verify_certificate(struct Curl_cfilter *cf, char buffer[STRERROR_LEN]; failf(data, "schannel: failed to create certificate chain engine: %s", - Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer))); + curlx_winapi_strerror(GetLastError(), buffer, sizeof(buffer))); result = CURLE_SSL_CACERT_BADFILE; } } @@ -877,7 +877,7 @@ CURLcode Curl_verify_certificate(struct Curl_cfilter *cf, &pChainContext)) { char buffer[STRERROR_LEN]; failf(data, "schannel: CertGetCertificateChain failed: %s", - Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer))); + curlx_winapi_strerror(GetLastError(), buffer, sizeof(buffer))); pChainContext = NULL; result = CURLE_PEER_FAILED_VERIFICATION; } diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c index 2ba9165c11..b44b76473d 100644 --- a/lib/vtls/vtls.c +++ b/lib/vtls/vtls.c @@ -1191,10 +1191,10 @@ static ssl_peer_type get_peer_type(const char *hostname) #else struct in_addr addr; #endif - if(Curl_inet_pton(AF_INET, hostname, &addr)) + if(curlx_inet_pton(AF_INET, hostname, &addr)) return CURL_SSL_PEER_IPV4; #ifdef USE_IPV6 - else if(Curl_inet_pton(AF_INET6, hostname, &addr)) { + else if(curlx_inet_pton(AF_INET6, hostname, &addr)) { return CURL_SSL_PEER_IPV6; } #endif diff --git a/tests/libtest/lib1960.c b/tests/libtest/lib1960.c index 15096f2265..33947a71d6 100644 --- a/tests/libtest/lib1960.c +++ b/tests/libtest/lib1960.c @@ -90,7 +90,7 @@ CURLcode test(char *URL) serv_addr.sin_family = AF_INET; serv_addr.sin_port = htons(port); - if(Curl_inet_pton(AF_INET, libtest_arg2, &serv_addr.sin_addr) <= 0) { + if(curlx_inet_pton(AF_INET, libtest_arg2, &serv_addr.sin_addr) <= 0) { fprintf(stderr, "inet_pton failed\n"); goto test_cleanup; } diff --git a/tests/server/getpart.c b/tests/server/getpart.c index 6bf6cc5d6d..67ac0865a4 100644 --- a/tests/server/getpart.c +++ b/tests/server/getpart.c @@ -231,14 +231,14 @@ static int decodedata(char **buf, /* dest buffer */ return GPE_OK; /* base64 decode the given buffer */ - error = Curl_base64_decode(*buf, &buf64, &src_len); + error = curlx_base64_decode(*buf, &buf64, &src_len); if(error) return GPE_OUT_OF_MEMORY; if(!src_len) { /* ** currently there is no way to tell apart an OOM condition in - ** Curl_base64_decode() from zero length decoded data. For now, + ** curlx_base64_decode() from zero length decoded data. For now, ** let's just assume it is an OOM condition, currently we have ** no input for this function that decodes to zero length data. */ diff --git a/tests/server/rtspd.c b/tests/server/rtspd.c index b8a066c43b..81ecf04119 100644 --- a/tests/server/rtspd.c +++ b/tests/server/rtspd.c @@ -1352,7 +1352,7 @@ server_cleanup: if(got_exit_signal) { logmsg("========> %s rtspd (port: %d pid: %ld) exits with signal (%d)", - ipv_inuse, (int)port, (long)Curl_getpid(), exit_signal); + ipv_inuse, (int)port, (long)curlx_getpid(), exit_signal); /* * To properly set the return status of the process we * must raise the same signal SIGINT or SIGTERM that we diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c index 305065c10e..6dfd52b82b 100644 --- a/tests/server/sockfilt.c +++ b/tests/server/sockfilt.c @@ -1526,7 +1526,7 @@ int main(int argc, char *argv[]) me.sa4.sin_addr.s_addr = INADDR_ANY; if(!addr) addr = "127.0.0.1"; - Curl_inet_pton(AF_INET, addr, &me.sa4.sin_addr); + curlx_inet_pton(AF_INET, addr, &me.sa4.sin_addr); rc = connect(sock, &me.sa, sizeof(me.sa4)); #ifdef USE_IPV6 @@ -1537,7 +1537,7 @@ int main(int argc, char *argv[]) me.sa6.sin6_port = htons(server_connectport); if(!addr) addr = "::1"; - Curl_inet_pton(AF_INET6, addr, &me.sa6.sin6_addr); + curlx_inet_pton(AF_INET6, addr, &me.sa6.sin6_addr); rc = connect(sock, &me.sa, sizeof(me.sa6)); } diff --git a/tests/server/socksd.c b/tests/server/socksd.c index ffa2e6eb9e..5d529f60d1 100644 --- a/tests/server/socksd.c +++ b/tests/server/socksd.c @@ -231,7 +231,7 @@ static curl_socket_t socksconnect(unsigned short connectport, me.sa4.sin_family = AF_INET; me.sa4.sin_port = htons(connectport); me.sa4.sin_addr.s_addr = INADDR_ANY; - Curl_inet_pton(AF_INET, connectaddr, &me.sa4.sin_addr); + curlx_inet_pton(AF_INET, connectaddr, &me.sa4.sin_addr); rc = connect(sock, &me.sa, sizeof(me.sa4)); diff --git a/tests/server/sws.c b/tests/server/sws.c index 5a1d46a07b..19a287f0ae 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -1300,7 +1300,7 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port) memset(&serveraddr.sa4, 0, sizeof(serveraddr.sa4)); serveraddr.sa4.sin_family = AF_INET; serveraddr.sa4.sin_port = htons(port); - if(Curl_inet_pton(AF_INET, ipaddr, &serveraddr.sa4.sin_addr) < 1) { + if(curlx_inet_pton(AF_INET, ipaddr, &serveraddr.sa4.sin_addr) < 1) { logmsg("Error inet_pton failed AF_INET conversion of '%s'", ipaddr); sclose(serverfd); return CURL_SOCKET_BAD; @@ -1313,7 +1313,7 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port) memset(&serveraddr.sa6, 0, sizeof(serveraddr.sa6)); serveraddr.sa6.sin6_family = AF_INET6; serveraddr.sa6.sin6_port = htons(port); - if(Curl_inet_pton(AF_INET6, ipaddr, &serveraddr.sa6.sin6_addr) < 1) { + if(curlx_inet_pton(AF_INET6, ipaddr, &serveraddr.sa6.sin6_addr) < 1) { logmsg("Error inet_pton failed AF_INET6 conversion of '%s'", ipaddr); sclose(serverfd); return CURL_SOCKET_BAD; @@ -2509,7 +2509,7 @@ sws_cleanup: if(got_exit_signal) { logmsg("========> %s sws (%s pid: %ld) exits with signal (%d)", - socket_type, location_str, (long)Curl_getpid(), exit_signal); + socket_type, location_str, (long)curlx_getpid(), exit_signal); /* * To properly set the return status of the process we * must raise the same signal SIGINT or SIGTERM that we diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c index ed81e98899..8fca655990 100644 --- a/tests/server/tftpd.c +++ b/tests/server/tftpd.c @@ -858,7 +858,7 @@ tftpd_cleanup: if(got_exit_signal) { logmsg("========> %s tftpd (port: %d pid: %ld) exits with signal (%d)", - ipv_inuse, (int)port, (long)Curl_getpid(), exit_signal); + ipv_inuse, (int)port, (long)curlx_getpid(), exit_signal); /* * To properly set the return status of the process we * must raise the same signal SIGINT or SIGTERM that we diff --git a/tests/server/util.c b/tests/server/util.c index 26ecafd448..79b64c39af 100644 --- a/tests/server/util.c +++ b/tests/server/util.c @@ -173,7 +173,7 @@ static void win32_perror(const char *msg) { char buf[512]; int err = SOCKERRNO; - Curl_winapi_strerror(err, buf, sizeof(buf)); + curlx_winapi_strerror(err, buf, sizeof(buf)); if(msg) fprintf(stderr, "%s: ", msg); fprintf(stderr, "%s\n", buf); @@ -224,7 +224,7 @@ int win32_init(void) const char *sstrerror(int err) { static char buf[512]; - return Curl_winapi_strerror(err, buf, sizeof(buf)); + return curlx_winapi_strerror(err, buf, sizeof(buf)); } #endif /* _WIN32 */ @@ -299,7 +299,7 @@ curl_off_t our_getpid(void) { curl_off_t pid; - pid = (curl_off_t)Curl_getpid(); + pid = (curl_off_t)curlx_getpid(); #ifdef _WIN32 /* store pid + MAX_PID to avoid conflict with Cygwin/msys PIDs, see also: * - 2019-01-31: https://cygwin.com/git/?p=newlib-cygwin.git;a=commit; ↵