mirror of
https://github.com/mirror/wget.git
synced 2025-02-14 22:00:35 +08:00
Remove portability handling code for wgint
Gnulib's stdint.h module promises a C99 compliant stdint.h file on all platforms. Thus allowing us to directly use the fixed wodth integer type, int64_t wihout needing to resort to all the checks being performed. * src/wget.h: Assume that int64_t is always available and use it * src/mswindows.h: Remove portability code since gnulib handles it * configure.ac: Remove sizeof checks for integer types that are no longer used
This commit is contained in:
parent
dd2d960ba1
commit
8b1aeab783
@ -319,11 +319,7 @@ dnl Check sizes of integer types. These are used to find n-bit
|
|||||||
dnl integral types on older systems that fail to provide intN_t and
|
dnl integral types on older systems that fail to provide intN_t and
|
||||||
dnl uintN_t typedefs.
|
dnl uintN_t typedefs.
|
||||||
dnl
|
dnl
|
||||||
AC_CHECK_SIZEOF([short])
|
|
||||||
AC_CHECK_SIZEOF([int])
|
|
||||||
AC_CHECK_SIZEOF([long])
|
AC_CHECK_SIZEOF([long])
|
||||||
AC_CHECK_SIZEOF([long long])
|
|
||||||
AC_CHECK_SIZEOF([void *])
|
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl Checks for non-universal or system-specific types.
|
dnl Checks for non-universal or system-specific types.
|
||||||
|
@ -69,22 +69,6 @@ as that of the covered work. */
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/* Define a wgint type under Windows. */
|
|
||||||
typedef __int64 wgint;
|
|
||||||
#define SIZEOF_WGINT 8
|
|
||||||
|
|
||||||
/* str_to_wgint is a function with the semantics of strtol[l], but
|
|
||||||
which works on wgint. */
|
|
||||||
#if defined HAVE_STRTOLL
|
|
||||||
# define str_to_wgint strtoll
|
|
||||||
#elif defined HAVE__STRTOI64
|
|
||||||
# define str_to_wgint _strtoi64
|
|
||||||
#else
|
|
||||||
# define str_to_wgint strtoll
|
|
||||||
# define NEED_STRTOLL
|
|
||||||
# define strtoll_type __int64
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PATH_SEPARATOR '\\'
|
#define PATH_SEPARATOR '\\'
|
||||||
|
|
||||||
/* ioctl needed by set_windows_fd_as_blocking_socket() */
|
/* ioctl needed by set_windows_fd_as_blocking_socket() */
|
||||||
|
56
src/wget.h
56
src/wget.h
@ -135,59 +135,27 @@ as that of the covered work. */
|
|||||||
don't necessarily want to tie having a 64-bit type for internal
|
don't necessarily want to tie having a 64-bit type for internal
|
||||||
calculations to having LFS support. */
|
calculations to having LFS support. */
|
||||||
|
|
||||||
#ifdef WINDOWS
|
/* Gnulib's stdint.h module essentially guarantees the existence of int64_t.
|
||||||
/* nothing to do, see mswindows.h */
|
* Thus we can simply assume it always exists and use it.
|
||||||
#elif SIZEOF_LONG >= 8
|
* However, just as a defensive tactic, a fallback has been implemented here
|
||||||
/* long is large enough, so use it. */
|
* with a compile time warning.
|
||||||
typedef long wgint;
|
*/
|
||||||
# define SIZEOF_WGINT SIZEOF_LONG
|
#ifndef HAVE_INT64_T
|
||||||
#elif SIZEOF_LONG_LONG >= 8
|
# warning "int64_t not defined. Our portability layer should have caught this"
|
||||||
/* long long is large enough and available, use that */
|
|
||||||
typedef long long wgint;
|
|
||||||
# define SIZEOF_WGINT SIZEOF_LONG_LONG
|
|
||||||
#elif HAVE_INT64_T
|
|
||||||
typedef int64_t wgint;
|
|
||||||
# define SIZEOF_WGINT 8
|
|
||||||
#elif SIZEOF_OFF_T >= 8
|
|
||||||
/* In case off_t is typedeffed to a large non-standard type that our
|
|
||||||
tests don't find. */
|
|
||||||
typedef off_t wgint;
|
|
||||||
# define SIZEOF_WGINT SIZEOF_OFF_T
|
|
||||||
#else
|
|
||||||
/* Fall back to using long, which is always available and in most
|
/* Fall back to using long, which is always available and in most
|
||||||
cases large enough. */
|
cases large enough. */
|
||||||
typedef long wgint;
|
typedef long wgint;
|
||||||
# define SIZEOF_WGINT SIZEOF_LONG
|
# define SIZEOF_WGINT SIZEOF_LONG
|
||||||
#endif
|
typedef int64_t wgint;
|
||||||
|
# define SIZEOF_WGINT 8
|
||||||
/* Pick a strtol-compatible function that will work with wgint. The
|
|
||||||
choices are strtol, strtoll, or our own implementation of strtoll
|
|
||||||
in cmpt.c, activated with NEED_STRTOLL. */
|
|
||||||
|
|
||||||
#ifdef WINDOWS
|
|
||||||
/* nothing to do, see mswindows.h */
|
|
||||||
#elif SIZEOF_WGINT == SIZEOF_LONG
|
|
||||||
# define str_to_wgint strtol
|
|
||||||
#elif SIZEOF_WGINT == SIZEOF_LONG_LONG
|
|
||||||
# define str_to_wgint strtoll
|
|
||||||
# ifndef HAVE_STRTOLL
|
|
||||||
# define NEED_STRTOLL
|
|
||||||
# define strtoll_type long long
|
|
||||||
# endif
|
|
||||||
#else
|
#else
|
||||||
/* wgint has a strange size; synthesize strtoll and use it. */
|
|
||||||
# define str_to_wgint strtoll
|
|
||||||
# define NEED_STRTOLL
|
|
||||||
# define strtoll_type wgint
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define str_to_wgint strtol
|
||||||
|
|
||||||
#define WGINT_MAX TYPE_MAXIMUM (wgint)
|
#define WGINT_MAX TYPE_MAXIMUM (wgint)
|
||||||
|
|
||||||
/* Declare our strtoll replacement. */
|
|
||||||
#ifdef NEED_STRTOLL
|
|
||||||
strtoll_type strtoll (const char *, char **, int);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Now define a large numeric type useful for storing sizes of *sums*
|
/* Now define a large numeric type useful for storing sizes of *sums*
|
||||||
of downloads, such as the value of the --quota option. This should
|
of downloads, such as the value of the --quota option. This should
|
||||||
be a type able to hold 2G+ values even on systems without large
|
be a type able to hold 2G+ values even on systems without large
|
||||||
|
Loading…
Reference in New Issue
Block a user