From 704ed3a139c549ecb3ee53576e0b8df28b417cdf Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Mon, 16 May 2016 15:07:48 +1200 Subject: [PATCH] Use now we require C++11 --- xapian-core/common/internaltypes.h | 48 ++++++++------------------------------ 1 file changed, 10 insertions(+), 38 deletions(-) diff --git a/xapian-core/common/internaltypes.h b/xapian-core/common/internaltypes.h index 7f2d1570c..bcc628509 100644 --- a/xapian-core/common/internaltypes.h +++ b/xapian-core/common/internaltypes.h @@ -1,7 +1,7 @@ /** @file internaltypes.h * @brief Types used internally. */ -/* Copyright (C) 2009,2010,2014 Olly Betts +/* Copyright (C) 2009,2010,2014,2016 Olly Betts * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -22,45 +22,17 @@ #ifndef XAPIAN_INCLUDED_INTERNALTYPES_H #define XAPIAN_INCLUDED_INTERNALTYPES_H -#include +#include -/// Unsigned 8 bit type. -typedef unsigned char byte; +// The standard marks these types as optional, as an implementation may not +// directly support a type of the appropriate width. If there are platforms +// we care about which lack them, we could use wider types with some care +// around where we read and write them. -#ifndef SIZEOF_SHORT -# error SIZEOF_SHORT is not defined -#endif -#ifndef SIZEOF_INT -# error SIZEOF_INT is not defined -#endif -#ifndef SIZEOF_LONG -# error SIZEOF_LONG is not defined -#endif - -#if SIZEOF_SHORT * CHAR_BIT == 16 -typedef unsigned short uint2; -#else -# error Type short is more than 16 bits, which Xapian does not currently handle -#endif - -#if SIZEOF_INT * CHAR_BIT >= 32 -typedef unsigned int uint4; -#elif SIZEOF_LONG * CHAR_BIT >= 32 -typedef unsigned long uint4; -#else -# error Type long is less than 32 bits, which ISO does not allow! -#endif - -#if SIZEOF_LONG * CHAR_BIT >= 64 -typedef unsigned long uint8; -#else -/* C99 and C++11 actually standardised "long long", but it seems to be widely - * supported (e.g. GCC has supported it for ages, MSVC since at least 2003 it - * appears) and we've not had any reports of compilation failing due to lack of - * support for it. - */ -typedef unsigned long long uint8; -#endif +typedef uint8_t byte; +typedef uint16_t uint2; +typedef uint32_t uint4; +typedef uint64_t uint8; /// Integer type used to hold the total length of all documents in a database. typedef uint8 totlen_t; -- 2.11.4.GIT