From c81651f4c18c03fa62ca3ea953b914fdd85073e2 Mon Sep 17 00:00:00 2001 From: hniksic Date: Sat, 25 Oct 2003 18:41:56 -0700 Subject: [PATCH] [svn] Change u_int32_t to uint32_t. --- ChangeLog | 6 ++++++ configure.in | 3 ++- src/ChangeLog | 6 ++++++ src/config.h.in | 18 +++++------------- src/host.c | 6 +++--- src/sysdep.h | 18 +++++++++++------- windows/config.h.bor | 4 ++-- windows/config.h.mingw | 4 ++-- windows/config.h.ms | 4 ++-- 9 files changed, 39 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index a077ab18..e25a3a6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-10-26 Hrvoje Niksic + + * configure.in: Switch from u_int32_t to uint32_t. Check for + inttypes.h so it's used to get the definition of uint32_t where + available. + 2003-10-26 Hrvoje Niksic * windows/Makefile.src.watcom (OBJS): Use convert.c. diff --git a/configure.in b/configure.in index 3f1417c9..9c026dd6 100644 --- a/configure.in +++ b/configure.in @@ -164,7 +164,8 @@ AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) -AC_CHECK_TYPES(u_int32_t) +AC_CHECK_HEADERS(inttypes.h) +AC_CHECK_TYPES(uint32_t) dnl dnl Checks for headers diff --git a/src/ChangeLog b/src/ChangeLog index 97eca1fa..af970331 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2003-10-26 Hrvoje Niksic + + * sysdep.h: Include inttypes.h where available. + + * host.c: Switch from u_int32_t to uint32_t. + 2003-10-26 Hrvoje Niksic * netrc.c (parse_netrc): Reset the QUOTE flag after the closing diff --git a/src/config.h.in b/src/config.h.in index 455f2c8d..c4da0f71 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -110,6 +110,9 @@ char *alloca (); /* Define if you can safely include both and . */ #undef TIME_WITH_SYS_TIME +/* Define if you have inttypes.h header. */ +#undef HAVE_INTTYPES_H + /* Define if you have struct utimbuf. */ #undef HAVE_STRUCT_UTIMBUF @@ -275,8 +278,8 @@ char *alloca (); /* Defined to int or size_t on systems without socklen_t. */ #undef socklen_t -/* Define if you have u_int32_t. */ -#undef HAVE_U_INT32_T +/* Define if you have uint32_t. */ +#undef HAVE_UINT32_T /* Some autoconf-unrelated preprocessor magic that cannot be in sysdep.h because it must be done before including the system @@ -290,17 +293,6 @@ char *alloca (); # endif #endif -/* Under Ultrix, u_int32_t is only defined when is - included. Therefore, configure doesn't pick it up, but files that - include (or ) fail to compile because it includes - bitypes.h. This magic define causes netdb.h/resolv.h not to include - bitypes.h under Ultrix. */ - -#ifdef __ultrix -# define BSD 199306 -#endif - - /* The following several lines can be very dangerous; they can cripple the header files and break compilation in _verY_ non-obvious ways. Because of that, we define them only on architectures we know diff --git a/src/host.c b/src/host.c index d0ec7675..5297d0f3 100644 --- a/src/host.c +++ b/src/host.c @@ -601,7 +601,7 @@ struct address_list * lookup_host (const char *host, int silent) { struct address_list *al = NULL; - u_int32_t addr_ipv4; + uint32_t addr_ipv4; ip_address addr; /* First, try to check whether the address is already a numeric @@ -612,8 +612,8 @@ lookup_host (const char *host, int silent) return address_list_from_single (&addr); #endif - addr_ipv4 = (u_int32_t)inet_addr (host); - if (addr_ipv4 != (u_int32_t)-1) + addr_ipv4 = (uint32_t)inet_addr (host); + if (addr_ipv4 != (uint32_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. */ diff --git a/src/sysdep.h b/src/sysdep.h index 7854eafa..f2fecc51 100644 --- a/src/sysdep.h +++ b/src/sysdep.h @@ -48,6 +48,10 @@ so, delete this exception statement from your version. */ #include #include +#ifdef HAVE_INTTYPES_H +# include +#endif + #ifdef WINDOWS /* Windows doesn't have some functions. Include mswindows.h so we get their declarations, as well as some additional declarations and @@ -245,23 +249,23 @@ void *memcpy (); int fnmatch (); #endif -/* Provide u_int32_t on the platforms that don't define it. Although +/* Provide uint32_t on the platforms that don't define it. Although most code should be agnostic about integer sizes, some code really - does need a 32-bit integral type. Such code should use u_int32_t. + does need a 32-bit integral type. Such code should use uint32_t. (The exception is gnu-md5.[ch], which uses its own detection for portability across platforms.) */ -#ifndef HAVE_U_INT32_T +#ifndef HAVE_UINT32_T # if SIZEOF_INT == 4 -typedef unsigned int u_int32_t; +typedef unsigned int uint32_t; # else # if SIZEOF_LONG == 4 -typedef unsigned long u_int32_t; +typedef unsigned long uint32_t; # else # if SIZEOF_SHORT == 4 -typedef unsigned short u_int32_t; +typedef unsigned short uint32_t; # else - #error "Cannot determine a 32-bit type" + #error "Cannot determine a 32-bit unsigned integer type" # endif # endif # endif diff --git a/windows/config.h.bor b/windows/config.h.bor index f5153dca..2778c109 100644 --- a/windows/config.h.bor +++ b/windows/config.h.bor @@ -197,7 +197,7 @@ /* Defined to int or size_t on systems without socklen_t. */ #define socklen_t int -/* Define if you have u_int32_t. */ -/* #undef HAVE_U_INT32_T */ +/* Define if you have uint32_t. */ +#define HAVE_UINT32_T */ #endif /* CONFIG_H */ diff --git a/windows/config.h.mingw b/windows/config.h.mingw index caf07ae1..1db10b24 100644 --- a/windows/config.h.mingw +++ b/windows/config.h.mingw @@ -257,7 +257,7 @@ so, delete this exception statement from your version. */ /* Defined to int or size_t on systems without socklen_t. */ #define socklen_t int -/* Define if you have u_int32_t. */ -/* #undef HAVE_U_INT32_T */ +/* Define if you have uint32_t. */ +#undef HAVE_UINT32_T #endif /* CONFIG_H */ diff --git a/windows/config.h.ms b/windows/config.h.ms index 15a880ac..f57069e2 100644 --- a/windows/config.h.ms +++ b/windows/config.h.ms @@ -199,7 +199,7 @@ /* Defined to int or size_t on systems without socklen_t. */ #define socklen_t int -/* Define if you have u_int32_t. */ -#undef HAVE_U_INT32_T +/* Define if you have uint32_t. */ +#define HAVE_UINT32_T #endif /* CONFIG_H */