mirror of
https://github.com/curl/curl.git
synced 2026-08-02 09:30:29 +03:00
lib: use (u)int64_t instead of long long
Remove config-plan9.h because it does not support 64 bit, meaning it has not been working for years. Closes #20233
This commit is contained in:
parent
8806035344
commit
0159100f4f
16 changed files with 30 additions and 277 deletions
|
|
@ -28,9 +28,9 @@ include Makefile.inc
|
|||
|
||||
CMAKE_DIST = CMakeLists.txt curl_config-cmake.h.in
|
||||
|
||||
EXTRA_DIST = config-mac.h config-os400.h config-plan9.h config-riscos.h \
|
||||
config-win32.h curl_config.h.in $(LIB_RCFILES) libcurl.def \
|
||||
$(CMAKE_DIST) Makefile.soname optiontable.pl
|
||||
EXTRA_DIST = config-mac.h config-os400.h config-riscos.h config-win32.h \
|
||||
curl_config.h.in $(LIB_RCFILES) libcurl.def $(CMAKE_DIST) Makefile.soname \
|
||||
optiontable.pl
|
||||
|
||||
lib_LTLIBRARIES = libcurl.la
|
||||
|
||||
|
|
|
|||
|
|
@ -35,9 +35,6 @@
|
|||
#endif
|
||||
|
||||
#include <ConditionalMacros.h>
|
||||
#if TYPE_LONGLONG
|
||||
#define HAVE_LONGLONG 1
|
||||
#endif
|
||||
|
||||
/* Define if you want the built-in manual */
|
||||
#define USE_MANUAL 1
|
||||
|
|
@ -69,11 +66,7 @@
|
|||
#define SIZEOF_INT 4
|
||||
#define SIZEOF_LONG 4
|
||||
#define SIZEOF_SIZE_T 4
|
||||
#ifdef HAVE_LONGLONG
|
||||
#define SIZEOF_CURL_OFF_T 8
|
||||
#else
|
||||
#define SIZEOF_CURL_OFF_T 4
|
||||
#endif
|
||||
|
||||
#define HAVE_RECV 1
|
||||
#define RECV_TYPE_ARG1 int
|
||||
|
|
|
|||
|
|
@ -187,12 +187,6 @@
|
|||
/* The size of `int', as computed by sizeof. */
|
||||
#define SIZEOF_INT 4
|
||||
|
||||
/* Define if the compiler supports the 'long long' data type. */
|
||||
#define HAVE_LONGLONG
|
||||
|
||||
/* The size of a `long long', as computed by sizeof. */
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
|
||||
/* The size of `long', as computed by sizeof. */
|
||||
#define SIZEOF_LONG 4
|
||||
|
||||
|
|
|
|||
|
|
@ -1,135 +0,0 @@
|
|||
#ifndef HEADER_CURL_CONFIG_PLAN9_H
|
||||
#define HEADER_CURL_CONFIG_PLAN9_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#define BUILDING_LIBCURL 1
|
||||
#define CURL_CA_BUNDLE "/sys/lib/tls/ca.pem"
|
||||
#define CURL_CA_PATH "/sys/lib/tls"
|
||||
#define CURL_STATICLIB 1
|
||||
#define USE_IPV6 1
|
||||
#define CURL_DISABLE_LDAP 1
|
||||
|
||||
#define NEED_REENTRANT 1
|
||||
#ifndef CURL_OS
|
||||
#define CURL_OS "plan9"
|
||||
#endif
|
||||
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
#ifdef _BITS64
|
||||
#error not implement
|
||||
#else
|
||||
#define SIZEOF_INT 4
|
||||
#define SIZEOF_LONG 4
|
||||
#define SIZEOF_OFF_T 8
|
||||
#define SIZEOF_CURL_OFF_T 4 /* curl_off_t = timediff_t = int */
|
||||
#define SIZEOF_SIZE_T 4
|
||||
#define SIZEOF_TIME_T 4
|
||||
#endif
|
||||
|
||||
#define HAVE_RECV 1
|
||||
#define RECV_TYPE_ARG1 int
|
||||
#define RECV_TYPE_ARG2 void *
|
||||
#define RECV_TYPE_ARG3 int
|
||||
#define RECV_TYPE_ARG4 int
|
||||
#define RECV_TYPE_RETV int
|
||||
|
||||
#define HAVE_SELECT 1
|
||||
|
||||
#define HAVE_SEND 1
|
||||
#define SEND_TYPE_ARG1 int
|
||||
#define SEND_TYPE_ARG2 void *
|
||||
#define SEND_QUAL_ARG2
|
||||
#define SEND_TYPE_ARG3 int
|
||||
#define SEND_TYPE_ARG4 int
|
||||
#define SEND_TYPE_RETV int
|
||||
|
||||
#define HAVE_ALARM 1
|
||||
#define HAVE_ARPA_INET_H 1
|
||||
#define HAVE_BASENAME 1
|
||||
#define HAVE_BOOL_T 1
|
||||
#define HAVE_FCNTL 1
|
||||
#define HAVE_FCNTL_H 1
|
||||
#define HAVE_FREEADDRINFO 1
|
||||
#define HAVE_FTRUNCATE 1
|
||||
#define HAVE_GETADDRINFO 1
|
||||
#define HAVE_GETEUID 1
|
||||
#define HAVE_GETHOSTNAME 1
|
||||
#define HAVE_GETPPID 1
|
||||
#define HAVE_GETPWUID 1
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
#define HAVE_GMTIME_R 1
|
||||
#define HAVE_INET_NTOP 1
|
||||
#define HAVE_INET_PTON 1
|
||||
#define HAVE_LIBGEN_H 1
|
||||
#define HAVE_LIBZ 1
|
||||
#define HAVE_LOCALE_H 1
|
||||
#define HAVE_LOCALTIME_R 1
|
||||
#define HAVE_LONGLONG 1
|
||||
#define HAVE_NETDB_H 1
|
||||
#define HAVE_NETINET_IN_H 1
|
||||
#define HAVE_NETINET_TCP_H 1
|
||||
#define HAVE_PWD_H 1
|
||||
#define HAVE_SYS_SELECT_H 1
|
||||
|
||||
#define USE_OPENSSL 1
|
||||
|
||||
#define HAVE_PIPE 1
|
||||
#define HAVE_POLL 1
|
||||
#define HAVE_POLL_H 1
|
||||
#define HAVE_PTHREAD_H 1
|
||||
#define HAVE_SETLOCALE 1
|
||||
|
||||
#define HAVE_SIGACTION 1
|
||||
#define HAVE_SIGNAL 1
|
||||
#define HAVE_SIGSETJMP 1
|
||||
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
|
||||
#define HAVE_SOCKET 1
|
||||
#define HAVE_STDBOOL_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_STRCASECMP 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRUCT_TIMEVAL 1
|
||||
#define HAVE_SYS_IOCTL_H 1
|
||||
#define HAVE_SYS_PARAM_H 1
|
||||
#define HAVE_SYS_RESOURCE_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_SYS_UN_H 1
|
||||
#define HAVE_TERMIOS_H 1
|
||||
#define HAVE_UNISTD_H 1
|
||||
#define HAVE_UTIME 1
|
||||
#define HAVE_UTIME_H 1
|
||||
|
||||
#define HAVE_POSIX_STRERROR_R 1
|
||||
#define HAVE_STRERROR_R 1
|
||||
#define USE_MANUAL 1
|
||||
|
||||
#define __attribute__(x)
|
||||
|
||||
#ifndef __cplusplus
|
||||
#undef inline
|
||||
#endif
|
||||
|
||||
#endif /* HEADER_CURL_CONFIG_PLAN9_H */
|
||||
|
|
@ -162,9 +162,6 @@
|
|||
/* The size of `int', as computed by sizeof. */
|
||||
#define SIZEOF_INT 4
|
||||
|
||||
/* The size of `long long', as computed by sizeof. */
|
||||
#undef SIZEOF_LONG_LONG
|
||||
|
||||
/* The size of `size_t', as computed by sizeof. */
|
||||
#define SIZEOF_SIZE_T 4
|
||||
|
||||
|
|
|
|||
|
|
@ -282,11 +282,6 @@
|
|||
/* COMPILER SPECIFIC */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Define if the compiler supports the 'long long' data type. */
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
#define HAVE_LONGLONG 1
|
||||
#endif
|
||||
|
||||
/* Default to 64-bit time_t unless _USE_32BIT_TIME_T is defined */
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
# ifndef _USE_32BIT_TIME_T
|
||||
|
|
|
|||
|
|
@ -394,9 +394,6 @@
|
|||
/* Define to 1 if you have a working localtime_r function. */
|
||||
#cmakedefine HAVE_LOCALTIME_R 1
|
||||
|
||||
/* Define to 1 if the compiler supports the 'long long' data type. */
|
||||
#cmakedefine HAVE_LONGLONG 1
|
||||
|
||||
/* Define to 1 if you have the 'suseconds_t' data type. */
|
||||
#cmakedefine HAVE_SUSECONDS_T 1
|
||||
|
||||
|
|
@ -640,9 +637,6 @@ ${SIZEOF_INT_CODE}
|
|||
/* The size of `long', as computed by sizeof. */
|
||||
${SIZEOF_LONG_CODE}
|
||||
|
||||
/* The size of `long long', as computed by sizeof. */
|
||||
${SIZEOF_LONG_LONG_CODE}
|
||||
|
||||
/* The size of `off_t', as computed by sizeof. */
|
||||
${SIZEOF_OFF_T_CODE}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,29 +27,6 @@
|
|||
#include "curl_printf.h"
|
||||
#include "curlx/strparse.h"
|
||||
|
||||
#ifdef HAVE_LONGLONG
|
||||
# define LONG_LONG_TYPE long long
|
||||
# define HAVE_LONG_LONG_TYPE
|
||||
#elif defined(_MSC_VER)
|
||||
# define LONG_LONG_TYPE __int64
|
||||
# define HAVE_LONG_LONG_TYPE
|
||||
#else
|
||||
# undef LONG_LONG_TYPE
|
||||
# undef HAVE_LONG_LONG_TYPE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Max integer data types that mprintf.c is capable
|
||||
*/
|
||||
|
||||
#ifdef HAVE_LONG_LONG_TYPE
|
||||
# define mp_intmax_t LONG_LONG_TYPE
|
||||
# define mp_uintmax_t unsigned LONG_LONG_TYPE
|
||||
#else
|
||||
# define mp_intmax_t long
|
||||
# define mp_uintmax_t unsigned long
|
||||
#endif
|
||||
|
||||
#define BUFFSIZE 326 /* buffer for long-to-str and float-to-str calcs, should
|
||||
fit negative DBL_MAX (317 letters) */
|
||||
#define MAX_PARAMETERS 128 /* number of input arguments */
|
||||
|
|
@ -128,8 +105,8 @@ struct va_input {
|
|||
union {
|
||||
const char *str;
|
||||
void *ptr;
|
||||
mp_intmax_t nums; /* signed */
|
||||
mp_uintmax_t numu; /* unsigned */
|
||||
int64_t nums; /* signed */
|
||||
uint64_t numu; /* unsigned */
|
||||
double dnum;
|
||||
} val;
|
||||
};
|
||||
|
|
@ -582,29 +559,29 @@ static int parsefmt(const char *format,
|
|||
break;
|
||||
|
||||
case FORMAT_LONGLONGU:
|
||||
iptr->val.numu = (mp_uintmax_t)va_arg(arglist, mp_uintmax_t);
|
||||
iptr->val.numu = va_arg(arglist, uint64_t);
|
||||
break;
|
||||
|
||||
case FORMAT_LONGLONG:
|
||||
iptr->val.nums = (mp_intmax_t)va_arg(arglist, mp_intmax_t);
|
||||
iptr->val.nums = va_arg(arglist, int64_t);
|
||||
break;
|
||||
|
||||
case FORMAT_LONGU:
|
||||
iptr->val.numu = (mp_uintmax_t)va_arg(arglist, unsigned long);
|
||||
iptr->val.numu = va_arg(arglist, unsigned long);
|
||||
break;
|
||||
|
||||
case FORMAT_LONG:
|
||||
iptr->val.nums = (mp_intmax_t)va_arg(arglist, long);
|
||||
iptr->val.nums = va_arg(arglist, long);
|
||||
break;
|
||||
|
||||
case FORMAT_INTU:
|
||||
iptr->val.numu = (mp_uintmax_t)va_arg(arglist, unsigned int);
|
||||
iptr->val.numu = va_arg(arglist, unsigned int);
|
||||
break;
|
||||
|
||||
case FORMAT_INT:
|
||||
case FORMAT_WIDTH:
|
||||
case FORMAT_PRECISION:
|
||||
iptr->val.nums = (mp_intmax_t)va_arg(arglist, int);
|
||||
iptr->val.nums = va_arg(arglist, int);
|
||||
break;
|
||||
|
||||
case FORMAT_DOUBLE:
|
||||
|
|
@ -730,8 +707,8 @@ static bool out_double(void *userp,
|
|||
static bool out_number(void *userp,
|
||||
int (*stream)(unsigned char, void *),
|
||||
struct mproperty *p,
|
||||
mp_uintmax_t num,
|
||||
mp_intmax_t nums,
|
||||
uint64_t num,
|
||||
int64_t nums,
|
||||
char *work, int *donep)
|
||||
{
|
||||
const unsigned char *digits = Curl_ldigits;
|
||||
|
|
@ -777,11 +754,11 @@ static bool out_number(void *userp,
|
|||
is_neg = (nums < 0);
|
||||
if(is_neg) {
|
||||
/* signed_num might fail to hold absolute negative minimum by 1 */
|
||||
mp_intmax_t signed_num; /* Used to convert negative in positive. */
|
||||
signed_num = nums + (mp_intmax_t)1;
|
||||
int64_t signed_num; /* Used to convert negative in positive. */
|
||||
signed_num = nums + (int64_t)1;
|
||||
signed_num = -signed_num;
|
||||
num = (mp_uintmax_t)signed_num;
|
||||
num += (mp_uintmax_t)1;
|
||||
num = (uint64_t)signed_num;
|
||||
num += (uint64_t)1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1070,11 +1047,9 @@ static int formatf(void *userp, /* untouched by format(), just sent to the
|
|||
|
||||
case FORMAT_INTPTR:
|
||||
/* Answer the count of characters written. */
|
||||
#ifdef HAVE_LONG_LONG_TYPE
|
||||
if(p.flags & FLAGS_LONGLONG)
|
||||
*(LONG_LONG_TYPE *)iptr->val.ptr = (LONG_LONG_TYPE)done;
|
||||
*(int64_t *)iptr->val.ptr = (int64_t)done;
|
||||
else
|
||||
#endif
|
||||
if(p.flags & FLAGS_LONG)
|
||||
*(long *)iptr->val.ptr = (long)done;
|
||||
else if(!(p.flags & FLAGS_SHORT))
|
||||
|
|
|
|||
36
lib/sha256.c
36
lib/sha256.c
|
|
@ -246,38 +246,20 @@ static void my_sha256_final(unsigned char *digest, void *in)
|
|||
(a)[3] = (unsigned char) (((unsigned long)(val)) & 0xff); \
|
||||
} while(0)
|
||||
|
||||
#ifdef HAVE_LONGLONG
|
||||
#define WPA_PUT_BE64(a, val) \
|
||||
do { \
|
||||
(a)[0] = (unsigned char)(((unsigned long long)(val)) >> 56); \
|
||||
(a)[1] = (unsigned char)(((unsigned long long)(val)) >> 48); \
|
||||
(a)[2] = (unsigned char)(((unsigned long long)(val)) >> 40); \
|
||||
(a)[3] = (unsigned char)(((unsigned long long)(val)) >> 32); \
|
||||
(a)[4] = (unsigned char)(((unsigned long long)(val)) >> 24); \
|
||||
(a)[5] = (unsigned char)(((unsigned long long)(val)) >> 16); \
|
||||
(a)[6] = (unsigned char)(((unsigned long long)(val)) >> 8); \
|
||||
(a)[7] = (unsigned char)(((unsigned long long)(val)) & 0xff); \
|
||||
(a)[0] = (unsigned char)(((uint64_t)(val)) >> 56); \
|
||||
(a)[1] = (unsigned char)(((uint64_t)(val)) >> 48); \
|
||||
(a)[2] = (unsigned char)(((uint64_t)(val)) >> 40); \
|
||||
(a)[3] = (unsigned char)(((uint64_t)(val)) >> 32); \
|
||||
(a)[4] = (unsigned char)(((uint64_t)(val)) >> 24); \
|
||||
(a)[5] = (unsigned char)(((uint64_t)(val)) >> 16); \
|
||||
(a)[6] = (unsigned char)(((uint64_t)(val)) >> 8); \
|
||||
(a)[7] = (unsigned char)(((uint64_t)(val)) & 0xff); \
|
||||
} while(0)
|
||||
#else
|
||||
#define WPA_PUT_BE64(a, val) \
|
||||
do { \
|
||||
(a)[0] = (unsigned char)(((unsigned __int64)(val)) >> 56); \
|
||||
(a)[1] = (unsigned char)(((unsigned __int64)(val)) >> 48); \
|
||||
(a)[2] = (unsigned char)(((unsigned __int64)(val)) >> 40); \
|
||||
(a)[3] = (unsigned char)(((unsigned __int64)(val)) >> 32); \
|
||||
(a)[4] = (unsigned char)(((unsigned __int64)(val)) >> 24); \
|
||||
(a)[5] = (unsigned char)(((unsigned __int64)(val)) >> 16); \
|
||||
(a)[6] = (unsigned char)(((unsigned __int64)(val)) >> 8); \
|
||||
(a)[7] = (unsigned char)(((unsigned __int64)(val)) & 0xff); \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
struct sha256_state {
|
||||
#ifdef HAVE_LONGLONG
|
||||
unsigned long long length;
|
||||
#else
|
||||
unsigned __int64 length;
|
||||
#endif
|
||||
uint64_t length;
|
||||
unsigned long state[8], curlen;
|
||||
unsigned char buf[64];
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue