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>
|
2003-10-10 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
* aclocal.m4 (WGET_WITH_NLS): First check for gettext in libintl,
|
* aclocal.m4 (WGET_WITH_NLS): First check for gettext in libintl,
|
||||||
|
@ -157,9 +157,14 @@ AC_TYPE_SIZE_T
|
|||||||
AC_TYPE_PID_T
|
AC_TYPE_PID_T
|
||||||
AC_C_BIGENDIAN
|
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)
|
||||||
AC_CHECK_SIZEOF(long long)
|
AC_CHECK_SIZEOF(long long)
|
||||||
|
AC_CHECK_TYPES(int32_t)
|
||||||
|
AC_CHECK_TYPES(u_int32_t)
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl Checks for headers
|
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>
|
2003-10-11 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
* ftp-basic.c (ftp_epsv): Use socklen_t * as the third argument to
|
* ftp-basic.c (ftp_epsv): Use socklen_t * as the third argument to
|
||||||
|
@ -80,6 +80,9 @@ char *alloca ();
|
|||||||
significant byte first). */
|
significant byte first). */
|
||||||
#undef WORDS_BIGENDIAN
|
#undef WORDS_BIGENDIAN
|
||||||
|
|
||||||
|
/* Define to the length of int. */
|
||||||
|
#undef SIZEOF_INT
|
||||||
|
|
||||||
/* Define to the length of long. */
|
/* Define to the length of long. */
|
||||||
#undef SIZEOF_LONG
|
#undef SIZEOF_LONG
|
||||||
|
|
||||||
@ -271,9 +274,15 @@ char *alloca ();
|
|||||||
/* Define if you want to enable the IPv6 support. */
|
/* Define if you want to enable the IPv6 support. */
|
||||||
#undef ENABLE_IPV6
|
#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
|
#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
|
/* First a gambit to see whether we're on Solaris. We'll
|
||||||
need it below. */
|
need it below. */
|
||||||
#ifdef __sun
|
#ifdef __sun
|
||||||
|
18
src/host.c
18
src/host.c
@ -601,7 +601,7 @@ struct address_list *
|
|||||||
lookup_host (const char *host, int silent)
|
lookup_host (const char *host, int silent)
|
||||||
{
|
{
|
||||||
struct address_list *al = NULL;
|
struct address_list *al = NULL;
|
||||||
unsigned long addr_ipv4; /* #### use a 32-bit type here. */
|
u_int32_t addr_ipv4;
|
||||||
ip_address addr;
|
ip_address addr;
|
||||||
|
|
||||||
/* First, try to check whether the address is already a numeric
|
/* 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);
|
return address_list_from_single (&addr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
addr_ipv4 = (unsigned long)inet_addr (host);
|
addr_ipv4 = (u_int32_t)inet_addr (host);
|
||||||
if ((int)addr_ipv4 != -1)
|
if (addr_ipv4 != (u_int32_t)-1)
|
||||||
{
|
{
|
||||||
/* ADDR is defined to be in network byte order, which is what
|
/* ADDR is defined to be in network byte order, which is what
|
||||||
this returns, so we can just copy it to STORE_IP. However,
|
this returns, so we can just copy it to STORE_IP. */
|
||||||
on big endian 64-bit architectures the value will be stored
|
map_ipv4_to_ip ((ip4_address *)&addr_ipv4, &addr);
|
||||||
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);
|
|
||||||
return address_list_from_single (&addr);
|
return address_list_from_single (&addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (host_name_addresses_map)
|
if (host_name_addresses_map)
|
||||||
{
|
{
|
||||||
al = hash_table_get (host_name_addresses_map, host);
|
al = hash_table_get (host_name_addresses_map, host);
|
||||||
|
|
||||||
if (al)
|
if (al)
|
||||||
{
|
{
|
||||||
DEBUGP (("Found %s in host_name_addresses_map (%p)\n", host, 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 ();
|
int fnmatch ();
|
||||||
#endif
|
#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 */
|
#endif /* SYSDEP_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user