diff --git a/lib/hostip.c b/lib/hostip.c index 7146bb2bf6d4d01aa2cae18cb6d2b8142e42d4f7..2deab34e40ef1069a02892537bdd1e83fa43b8f6 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -552,9 +552,9 @@ struct curl_hash *Curl_mk_dnscache(void) * returns a pointer to the malloc()ed copy. You need to call free() on the * returned buffer when you're done with it. */ -Curl_addrinfo *Curl_addrinfo_copy(void *org, int port) +Curl_addrinfo *Curl_addrinfo_copy(const void *org, int port) { - struct hostent *orig = org; + const struct hostent *orig = org; return Curl_he2ai(orig, port); } diff --git a/lib/hostip.h b/lib/hostip.h index bd3b28dc5476ff8f8b9fa50f8d640fe9fb48ed05..72906ab3227757154be76b511484b723cde21462 100644 --- a/lib/hostip.h +++ b/lib/hostip.h @@ -224,13 +224,13 @@ Curl_addrinfo *Curl_ip2addr(in_addr_t num, const char *hostname, int port); /* [ipv4 only] Curl_he2ai() converts a struct hostent to a Curl_addrinfo chain and returns it */ -Curl_addrinfo *Curl_he2ai(struct hostent *, int port); +Curl_addrinfo *Curl_he2ai(const struct hostent *, int port); /* relocate a hostent struct */ void Curl_hostent_relocate(struct hostent *h, long offset); /* Clone a Curl_addrinfo struct, works protocol independently */ -Curl_addrinfo *Curl_addrinfo_copy(void *orig, int port); +Curl_addrinfo *Curl_addrinfo_copy(const void *orig, int port); /* * Curl_printable_address() returns a printable version of the 1st address diff --git a/lib/hostip4.c b/lib/hostip4.c index 627b0783a287d7e33d351bf865299b3070c92e4d..c56f08a4e3202bb0528a2751b97c4ba767ab4220 100644 --- a/lib/hostip4.c +++ b/lib/hostip4.c @@ -400,7 +400,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, * #define h_addr h_addr_list[0] */ -Curl_addrinfo *Curl_he2ai(struct hostent *he, int port) +Curl_addrinfo *Curl_he2ai(const struct hostent *he, int port) { Curl_addrinfo *ai; Curl_addrinfo *prevai = NULL; diff --git a/lib/hostip6.c b/lib/hostip6.c index 3d80166c17f788e2f038f80b1ec81a6e1aec8d3c..7c17a15764073ec25ee41c8eb10c38e93b7d9e31 100644 --- a/lib/hostip6.c +++ b/lib/hostip6.c @@ -104,10 +104,10 @@ void Curl_freeaddrinfo(Curl_addrinfo *p) * address. But this is an ipv6 build and then we don't copy the address, we * just return the same pointer! */ -Curl_addrinfo *Curl_addrinfo_copy(void *source, int port) +Curl_addrinfo *Curl_addrinfo_copy(const void *orig, int port) { (void) port; - return source; + return (Curl_addrinfo*)orig; } #endif