1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

Make hostcache_fixoffset() take a long for offset, to fully work with 64bit

archs, also no longer typecast pointers to ints as that is a nono on 64bit
systems.
This commit is contained in:
Daniel Stenberg 2004-02-12 16:02:55 +00:00
parent d8a1415646
commit 4674f3f115

View File

@ -777,7 +777,7 @@ static Curl_addrinfo *my_getaddrinfo(struct connectdata *conn,
#else /* following code is IPv4-only */ #else /* following code is IPv4-only */
#if !defined(HAVE_GETHOSTBYNAME_R) || defined(USE_ARES) #if !defined(HAVE_GETHOSTBYNAME_R) || defined(USE_ARES)
static void hostcache_fixoffset(struct hostent *h, int offset); static void hostcache_fixoffset(struct hostent *h, long offset);
/* /*
* Performs a "deep" copy of a hostent into a buffer (returns a pointer to the * Performs a "deep" copy of a hostent into a buffer (returns a pointer to the
* copy). Make absolutely sure the destination buffer is big enough! * copy). Make absolutely sure the destination buffer is big enough!
@ -856,11 +856,11 @@ static struct hostent* pack_hostent(char** buf, struct hostent* orig)
/* now, shrink the allocated buffer to the size we actually need, which /* now, shrink the allocated buffer to the size we actually need, which
most often is only a fraction of the original alloc */ most often is only a fraction of the original alloc */
newbuf=(char *)realloc(*buf, (int)bufptr-(int)(*buf)); newbuf=(char *)realloc(*buf, (long)bufptr-(long)(*buf));
/* if the alloc moved, we need to adjust things again */ /* if the alloc moved, we need to adjust things again */
if(newbuf != *buf) if(newbuf != *buf)
hostcache_fixoffset((struct hostent*)newbuf, (int)newbuf-(int)*buf); hostcache_fixoffset((struct hostent*)newbuf, (long)newbuf-(long)*buf);
/* setup the return */ /* setup the return */
*buf = newbuf; *buf = newbuf;
@ -870,7 +870,7 @@ static struct hostent* pack_hostent(char** buf, struct hostent* orig)
} }
#endif #endif
static void hostcache_fixoffset(struct hostent *h, int offset) static void hostcache_fixoffset(struct hostent *h, long offset)
{ {
int i=0; int i=0;