mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Provide the support for int32_t and u_int32_t.
This commit is contained in:
parent
5155384340
commit
f58c6774e4
@ -1,3 +1,8 @@
|
||||
2003-10-11 Hrvoje Niksic <hniksic@xemacs.org>
|
||||
|
||||
* configure.in: Check for int32_t and u_int32_t. Check for
|
||||
SIZEOF_INT.
|
||||
|
||||
2003-10-10 Hrvoje Niksic <hniksic@xemacs.org>
|
||||
|
||||
* aclocal.m4 (WGET_WITH_NLS): First check for gettext in libintl,
|
||||
|
@ -157,9 +157,14 @@ AC_TYPE_SIZE_T
|
||||
AC_TYPE_PID_T
|
||||
AC_C_BIGENDIAN
|
||||
|
||||
# Check size of long.
|
||||
dnl
|
||||
dnl Check integral type sizes.
|
||||
dnl
|
||||
AC_CHECK_SIZEOF(int)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
AC_CHECK_SIZEOF(long long)
|
||||
AC_CHECK_TYPES(int32_t)
|
||||
AC_CHECK_TYPES(u_int32_t)
|
||||
|
||||
dnl
|
||||
dnl Checks for headers
|
||||
|
@ -1,3 +1,11 @@
|
||||
2003-10-11 Hrvoje Niksic <hniksic@xemacs.org>
|
||||
|
||||
* host.c (lookup_host): Use u_int32_t to store the result of
|
||||
inet_addr(). That removes the need for offset fiddling, caring
|
||||
about endian-ness, etc.
|
||||
|
||||
* sysdep.h: Define int32_t and u_int32_t if not available.
|
||||
|
||||
2003-10-11 Hrvoje Niksic <hniksic@xemacs.org>
|
||||
|
||||
* ftp-basic.c (ftp_epsv): Use socklen_t * as the third argument to
|
||||
|
@ -80,6 +80,9 @@ char *alloca ();
|
||||
significant byte first). */
|
||||
#undef WORDS_BIGENDIAN
|
||||
|
||||
/* Define to the length of int. */
|
||||
#undef SIZEOF_INT
|
||||
|
||||
/* Define to the length of long. */
|
||||
#undef SIZEOF_LONG
|
||||
|
||||
@ -271,9 +274,15 @@ char *alloca ();
|
||||
/* Define if you want to enable the IPv6 support. */
|
||||
#undef ENABLE_IPV6
|
||||
|
||||
/* Define if you don't have socklen_t. */
|
||||
/* Defined to int or size_t on systems without socklen_t. */
|
||||
#undef socklen_t
|
||||
|
||||
/* Define if you have int32_t. */
|
||||
#undef HAVE_INT32_T
|
||||
|
||||
/* Define if you have u_int32_t. */
|
||||
#undef HAVE_U_INT32_T
|
||||
|
||||
/* First a gambit to see whether we're on Solaris. We'll
|
||||
need it below. */
|
||||
#ifdef __sun
|
||||
|
18
src/host.c
18
src/host.c
@ -601,7 +601,7 @@ struct address_list *
|
||||
lookup_host (const char *host, int silent)
|
||||
{
|
||||
struct address_list *al = NULL;
|
||||
unsigned long addr_ipv4; /* #### use a 32-bit type here. */
|
||||
u_int32_t addr_ipv4;
|
||||
ip_address addr;
|
||||
|
||||
/* First, try to check whether the address is already a numeric
|
||||
@ -612,26 +612,18 @@ lookup_host (const char *host, int silent)
|
||||
return address_list_from_single (&addr);
|
||||
#endif
|
||||
|
||||
addr_ipv4 = (unsigned long)inet_addr (host);
|
||||
if ((int)addr_ipv4 != -1)
|
||||
addr_ipv4 = (u_int32_t)inet_addr (host);
|
||||
if (addr_ipv4 != (u_int32_t)-1)
|
||||
{
|
||||
/* ADDR is defined to be in network byte order, which is what
|
||||
this returns, so we can just copy it to STORE_IP. However,
|
||||
on big endian 64-bit architectures the value will be stored
|
||||
in the *last*, not first four bytes. OFFSET makes sure that
|
||||
we copy the correct four bytes. */
|
||||
int offset = 0;
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
offset = sizeof (unsigned long) - sizeof (ip4_address);
|
||||
#endif
|
||||
map_ipv4_to_ip ((ip4_address *)((char *)&addr_ipv4 + offset), &addr);
|
||||
this returns, so we can just copy it to STORE_IP. */
|
||||
map_ipv4_to_ip ((ip4_address *)&addr_ipv4, &addr);
|
||||
return address_list_from_single (&addr);
|
||||
}
|
||||
|
||||
if (host_name_addresses_map)
|
||||
{
|
||||
al = hash_table_get (host_name_addresses_map, host);
|
||||
|
||||
if (al)
|
||||
{
|
||||
DEBUGP (("Found %s in host_name_addresses_map (%p)\n", host, al));
|
||||
|
26
src/sysdep.h
26
src/sysdep.h
@ -243,4 +243,30 @@ void *memcpy ();
|
||||
int fnmatch ();
|
||||
#endif
|
||||
|
||||
/* Provide 32-bit types for the code that really needs it. */
|
||||
|
||||
#ifndef HAVE_INT32_T
|
||||
# if SIZEOF_INT == 4
|
||||
typedef int int32_t;
|
||||
# else
|
||||
# if SIZEOF_LONG == 4
|
||||
typedef long int32_t;
|
||||
# else
|
||||
"Cannot determine a 32-bit type"
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_U_INT32_T
|
||||
# if SIZEOF_INT == 4
|
||||
typedef unsigned int u_int32_t;
|
||||
# else
|
||||
# if SIZEOF_LONG == 4
|
||||
typedef unsigned long u_int32_t;
|
||||
# else
|
||||
"Cannot determine a 32-bit type"
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* SYSDEP_H */
|
||||
|
Loading…
Reference in New Issue
Block a user