Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.straub-nv.de!feed.xsnews.nl!border-2.ams.xsnews.nl!multikabel.net!newsfeed20.multikabel.net!post1.tilbu1.nb.home.nl!cache1.tilbu1.nb.home.nl!not-for-mail From: "Skybuck Flying" Newsgroups: comp.databases.berkeley-db,comp.lang.c References: <3e9fb$4ed19745$5419acc3$27249@cache1.tilbu1.nb.home.nl> In-Reply-To: <3e9fb$4ed19745$5419acc3$27249@cache1.tilbu1.nb.home.nl> Subject: Re: error: conflicting declaration 'typedef int32_t ssize_t' (mingw versus berkeley db) Date: Sun, 27 Nov 2011 03:04:15 +0100 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0024_01CCACB1.3F103F40" X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Newsreader: Microsoft Windows Live Mail 15.4.3538.513 X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3538.513 Message-ID: <4e191$4ed19a95$5419acc3$29649@cache1.tilbu1.nb.home.nl> X-Complaints-To: abuse.home.news@prolocation.net Organization: @home Lines: 229 NNTP-Posting-Host: 84.25.172.195 (84.25.172.195) NNTP-Posting-Date: Sun, 27 Nov 2011 03:04:05 +0100 X-Trace: 4e1914ed19a95f1bc096629649 Xref: x330-a1.tempe.blueboxinc.net comp.databases.berkeley-db:4 comp.lang.c:13949 This is a multi-part message in MIME format. ------=_NextPart_000_0024_01CCACB1.3F103F40 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Also to help make sense of it here are the code sections which are = apparently conflicting: // *** Begin of Berkeley DB Snippet ***: // db.h: /* * Berkeley DB version information. */ #define DB_VERSION_MAJOR 4 #define DB_VERSION_MINOR 8 #define DB_VERSION_PATCH 30 #define DB_VERSION_STRING "Berkeley DB 4.8.30: (April 12, 2010)" /* * !!! * Berkeley DB uses specifically sized types. If they're not provided by * the system, typedef them here. * * We protect them against multiple inclusion using = __BIT_TYPES_DEFINED__, * as does BIND and Kerberos, since we don't know for sure what #include * files the user is using. * * !!! * We also provide the standard u_int, u_long etc., if they're not = provided * by the system. */ #ifndef __BIT_TYPES_DEFINED__ #define __BIT_TYPES_DEFINED__ typedef unsigned char u_int8_t; typedef short int16_t; typedef unsigned short u_int16_t; typedef int int32_t; typedef unsigned int u_int32_t; typedef __int64 int64_t; typedef unsigned __int64 u_int64_t; #endif #ifndef _WINSOCKAPI_ typedef unsigned char u_char; typedef unsigned int u_int; typedef unsigned long u_long; #endif typedef unsigned short u_short; /* * Missing ANSI types. * * uintmax_t -- * Largest unsigned type, used to align structures in memory. We don't = store * floating point types in structures, so integral types should be = sufficient * (and we don't have to worry about systems that store floats in other = than * power-of-2 numbers of bytes). Additionally this fixes compilers that = rewrite * structure assignments and ANSI C memcpy calls to be in-line = instructions * that happen to require alignment. * * uintptr_t -- * Unsigned type that's the same size as a pointer. There are places = where * DB modifies pointers by discarding the bottom bits to guarantee = alignment. * We can't use uintmax_t, it may be larger than the pointer, and = compilers * get upset about that. So far we haven't run on any machine where = there's * no unsigned type the same size as a pointer -- here's hoping. */ #if defined(_MSC_VER) && _MSC_VER < 1300 typedef u_int32_t uintmax_t; #else typedef u_int64_t uintmax_t; #endif #ifdef _WIN64 typedef u_int64_t uintptr_t; #else typedef u_int32_t uintptr_t; #endif /* * Windows defines off_t to long (i.e., 32 bits). We need to pass 64-bit * file offsets, so we declare our own. */ #define off_t __db_off_t typedef int64_t off_t; typedef int pid_t; #ifdef _WIN64 typedef int64_t ssize_t; #else typedef int32_t ssize_t; #endif // *** End of Berkeley DB Snippet *** // *** Begin of MingW Snippet ***: // types.h: #ifndef _SSIZE_T_ #define _SSIZE_T_ typedef long _ssize_t; #ifndef _NO_OLDNAMES typedef _ssize_t ssize_t; #endif #endif /* Not _SSIZE_T_ */=20 // *** End of MingW Snippet *** Please advise, Bye,=20 Skybuck. ------=_NextPart_000_0024_01CCACB1.3F103F40 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Also to help make sense of it here are the code sections which are=20 apparently conflicting:
 
// *** Begin of Berkeley DB Snippet ***:
 
// db.h:
 
/*
* Berkeley DB version information.
*/
#define = DB_VERSION_MAJOR=20 4
#define DB_VERSION_MINOR 8
#define DB_VERSION_PATCH = 30
#define=20 DB_VERSION_STRING "Berkeley DB 4.8.30: (April 12, 2010)"
 
/*
* !!!
* Berkeley DB uses specifically sized types.  = If=20 they're not provided by
* the system, typedef them here.
*
* We = protect=20 them against multiple inclusion using __BIT_TYPES_DEFINED__,
* as = does BIND=20 and Kerberos, since we don't know for sure what #include
* files the = user is=20 using.
*
* !!!
* We also provide the standard u_int, u_long = etc., if=20 they're not provided
* by the system.
*/
#ifndef=20 __BIT_TYPES_DEFINED__
#define __BIT_TYPES_DEFINED__
typedef = unsigned char=20 u_int8_t;
typedef short int16_t;
typedef unsigned short=20 u_int16_t;
typedef int int32_t;
typedef unsigned int = u_int32_t;
typedef=20 __int64 int64_t;
typedef unsigned __int64 u_int64_t;
#endif
 
#ifndef _WINSOCKAPI_
typedef unsigned char u_char;
typedef = unsigned=20 int u_int;
typedef unsigned long u_long;
#endif
typedef = unsigned short=20 u_short;
 
/*
* Missing ANSI types.
*
* uintmax_t --
* Largest = unsigned=20 type, used to align structures in memory.  We don't store
* = floating=20 point types in structures, so integral types should be sufficient
* = (and we=20 don't have to worry about systems that store floats in other than
*=20 power-of-2 numbers of bytes).  Additionally this fixes compilers = that=20 rewrite
* structure assignments and ANSI C memcpy calls to be in-line = instructions
* that happen to require alignment.
*
* uintptr_t = --
*=20 Unsigned type that's the same size as a pointer.  There are places=20 where
* DB modifies pointers by discarding the bottom bits to = guarantee=20 alignment.
* We can't use uintmax_t, it may be larger than the = pointer, and=20 compilers
* get upset about that.  So far we haven't run on any = machine=20 where there's
* no unsigned type the same size as a pointer -- here's = hoping.
*/
#if defined(_MSC_VER) && _MSC_VER < = 1300
typedef=20 u_int32_t uintmax_t;
#else
typedef u_int64_t=20 uintmax_t;
#endif
#ifdef _WIN64
typedef u_int64_t=20 uintptr_t;
#else
typedef u_int32_t uintptr_t;
#endif
 
/*
* Windows defines off_t to long (i.e., 32 bits).  We = need to=20 pass 64-bit
* file offsets, so we declare our own.
*/
#define = off_t=20 __db_off_t
typedef int64_t off_t;
typedef int pid_t;
#ifdef=20 _WIN64
typedef int64_t ssize_t;
#else
typedef int32_t=20 ssize_t;
#endif
// *** End of Berkeley DB Snippet ***
 
// *** Begin of MingW Snippet ***:
 
// types.h:
 
#ifndef _SSIZE_T_
#define _SSIZE_T_
typedef long = _ssize_t;
 
#ifndef _NO_OLDNAMES
typedef _ssize_t = ssize_t;
#endif
#endif /*=20 Not _SSIZE_T_ */
// *** End of MingW Snippet ***
 
Please advise,
 
Bye,
  Skybuck.
------=_NextPart_000_0024_01CCACB1.3F103F40--