* types.h: Prefer using uint64_t when creating a 64-bit unsigned type.

This avoids a warning on compilers that support but complain about
unsigned long long.

* util.h (ascii_isspace): New variation on isspace() that is immune from
locale changes.

* util.h: Make sure that only ascii is passed to isfoo functions. (From
Werner on stable branch).
This commit is contained in:
David Shaw 2003-07-10 12:13:53 +00:00
parent adab7b0a63
commit d8a6bd3b84
3 changed files with 27 additions and 5 deletions

View File

@ -1,3 +1,15 @@
2003-07-10 David Shaw <dshaw@jabberwocky.com>
* types.h: Prefer using uint64_t when creating a 64-bit unsigned
type. This avoids a warning on compilers that support but complain
about unsigned long long.
* util.h (ascii_isspace): New variation on isspace() that is
immune from locale changes.
* util.h: Make sure that only ascii is passed to isfoo
functions. (From Werner on stable branch).
2003-05-24 David Shaw <dshaw@jabberwocky.com>
* cipher.h, i18n.h, iobuf.h, memory.h, mpi.h, types.h, util.h:

View File

@ -101,7 +101,11 @@ typedef unsigned long u32;
*/
#ifndef HAVE_U64_TYPEDEF
#undef u64 /* maybe there is a macro with this name */
#if SIZEOF_UNSIGNED_INT == 8
#if SIZEOF_UINT64_T == 8
typedef uint64_t u64;
#define U64_C(c) (UINT64_C(c))
#define HAVE_U64_TYPEDEF
#elif SIZEOF_UNSIGNED_INT == 8
typedef unsigned int u64;
#define U64_C(c) (c ## U)
#define HAVE_U64_TYPEDEF
@ -113,10 +117,6 @@ typedef unsigned long u64;
typedef unsigned long long u64;
#define U64_C(c) (c ## ULL)
#define HAVE_U64_TYPEDEF
#elif SIZEOF_UINT64_T == 8
typedef uint64_t u64;
#define U64_C(c) (UINT64_C(c))
#define HAVE_U64_TYPEDEF
#endif
#endif

View File

@ -264,6 +264,16 @@ int vasprintf ( char **result, const char *format, va_list args);
#define wipememory2(_ptr,_set,_len) do { volatile char *_vptr=(volatile char *)(_ptr); size_t _vlen=(_len); while(_vlen) { *_vptr=(_set); _vptr++; _vlen--; } } while(0)
#define wipememory(_ptr,_len) wipememory2(_ptr,0,_len)
/*-- macros to replace ctype ones and avoid locale problems --*/
#define spacep(p) (*(p) == ' ' || *(p) == '\t')
#define digitp(p) (*(p) >= '0' && *(p) <= '9')
#define hexdigitp(a) (digitp (a) \
|| (*(a) >= 'A' && *(a) <= 'F') \
|| (*(a) >= 'a' && *(a) <= 'f'))
/* Note this isn't identical to a C locale isspace() without \f and
\v, but works for the purposes used here. */
#define ascii_isspace(a) ((a)==' ' || (a)=='\n' || (a)=='\r' || (a)=='\t')
/******* RISC OS stuff ***********/
#ifdef __riscos__
/* needed for strcasecmp() */