fixup commit for branch 'OTIS_TEST_BRANCH' OTIS_TEST_BRANCH OTIS_TEST_BASE
authorcvs2hg
Fri, 19 Oct 2001 14:06:29 +0000
branchOTIS_TEST_BRANCH
changeset 2172 b4c20512a0ec6eaec0584270c6448bbc12de0aef
parent 2042 2c223b79cacfcb4a5abe9b9fe316ca270e442877
child 2173 b2a5f6e25984d204a39ce33e5e3d4e6d0b4a71fa
child 2199 7b0505c91cbbe93cd3ed5437e809481377b7dd5a
push idunknown
push userunknown
push dateunknown
fixup commit for branch 'OTIS_TEST_BRANCH'
dbm/include/cdefs.h
dbm/include/hash.h
dbm/include/mcom_db.h
dbm/include/nsres.h
dbm/macbuild/DBMConfig.h
dbm/src/Makefile.win
dbm/src/h_bigkey.c
dbm/src/h_page.c
dbm/src/hash.c
dbm/src/snprintf.c
--- a/dbm/include/cdefs.h
+++ b/dbm/include/cdefs.h
@@ -72,47 +72,37 @@
  * SUCH DAMAGE.
  *
  *	@(#)cdefs.h	8.7 (Berkeley) 1/21/94
  */
 
 #ifndef	_CDEFS_H_
 #define	_CDEFS_H_
 
-#ifdef __BEGIN_DECLS
-#undef __BEGIN_DECLS
-#endif
-#ifdef __END_DECLS
-#undef __END_DECLS
-#endif
-
 #if defined(__cplusplus)
 #define	__BEGIN_DECLS	extern "C" {
 #define	__END_DECLS	}
 #else
 #define	__BEGIN_DECLS
 #define	__END_DECLS
 #endif
 
 /*
  * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
  * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
  * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
  * in between its arguments.  __CONCAT can also concatenate double-quoted
  * strings produced by the __STRING macro, but this only works with ANSI C.
  */
-#undef __P
-#undef __CONCAT
-#undef __STRING
-
 #if defined(__STDC__) || defined(__cplusplus) || defined(_WINDOWS) || defined(XP_OS2)
 #define	__P(protos)	protos		/* full-blown ANSI C */
 #define	__CONCAT(x,y)	x ## y
 #define	__STRING(x)	#x
 
+/* On HP-UX 11.00, <sys/stdsyms.h> defines __const. */
 #ifndef __const
 #define	__const		const		/* define reserved names to standard */
 #endif  /* __const */
 #define	__signed	signed
 #define	__volatile	volatile
 #ifndef _WINDOWS
 #if defined(__cplusplus)
 #define	__inline	inline		/* convert to C++ keyword */
@@ -167,16 +157,9 @@
 #endif
 
 /* Delete pseudo-keywords wherever they are not available or needed. */
 #ifndef __dead
 #define	__dead
 #define	__pure
 #endif
 
-#ifdef AIXV3
-/* Wont compile without const. Need a cleaner way to handle this. */
-#ifdef const
-#undef const
-#endif
-#endif
-
 #endif /* !_CDEFS_H_ */
--- a/dbm/include/hash.h
+++ b/dbm/include/hash.h
@@ -88,17 +88,17 @@ typedef struct hashhdr {		/* Disk reside
 	int32		last_freed;	/* Last overflow page freed */
 	int32		max_bucket;	/* ID of Maximum bucket in use */
 	int32		high_mask;	/* Mask to modulo into entire table */
 	int32		low_mask;	/* Mask to modulo into lower half of 
 					 * table */
 	int32		ffactor;	/* Fill factor */
 	int32		nkeys;		/* Number of keys in hash table */
 	int32		hdrpages;	/* Size of table header */
-	int32		h_charkey;	/* value of hash(CHARKEY) */
+	uint32		h_charkey;	/* value of hash(CHARKEY) */
 #define NCACHED	32			/* number of bit maps and spare 
 					 * points */
 	int32		spares[NCACHED];/* spare pages for overflow */
 	uint16		bitmaps[NCACHED];	/* address of overflow page 
 						 * bitmaps */
 } HASHHDR;
 
 typedef struct htab	 {		/* Memory resident data structure */
@@ -126,17 +126,17 @@ typedef struct htab	 {		/* Memory reside
 	uint32		*mapp[NCACHED];	/* Pointers to page maps */
 	int		nmaps;		/* Initial number of bitmaps */
 	int		nbufs;		/* Number of buffers left to 
 					 * allocate */
 	BUFHEAD 	bufhead;	/* Header of buffer lru list */
 	SEGMENT 	*dir;		/* Hash Bucket directory */
 	off_t		file_size;	/* in bytes */
 	char		is_temp;	/* unlink file on close */
-	char		updateEOF;	/* close and reopen on flush */
+	char		updateEOF;	/* force EOF update on flush */
 } HTAB;
 
 /*
  * Constants
  */
 #define DATABASE_CORRUPTED_ERROR -999   /* big ugly abort, delete database */
 #define	OLD_MAX_BSIZE		65536		/* 2^16 */
 #define MAX_BSIZE       	32l*1024l         /* 2^15 */
--- a/dbm/include/mcom_db.h
+++ b/dbm/include/mcom_db.h
@@ -69,42 +69,48 @@
  * SUCH DAMAGE.
  *
  *	@(#)db.h	8.7 (Berkeley) 6/16/94
  */
 
 #ifndef _DB_H_
 #define	_DB_H_
 
-#ifndef HAVE_SYS_CDEFS_H
-#include "cdefs.h"
-#else
-#include <cdefs.h>
+#ifndef macintosh
+#include <sys/types.h>
 #endif
 #include "prtypes.h"
 
+#include <limits.h>
+
+#ifdef __DBINTERFACE_PRIVATE
+
+#ifdef HAVE_SYS_CDEFS_H
+#include <sys/cdefs.h>
+#else
+#include "cdefs.h"
+#endif
+
 #ifdef HAVE_SYS_BYTEORDER_H
-#include <sys/types.h>
 #include <sys/byteorder.h>
 #endif
 
 #if defined(__linux) || defined(__BEOS__)
 #include <endian.h>
 #ifndef BYTE_ORDER
 #define BYTE_ORDER    __BYTE_ORDER
 #define BIG_ENDIAN    __BIG_ENDIAN
 #define LITTLE_ENDIAN __LITTLE_ENDIAN
 #endif
 #endif /* __linux */
 
 #ifdef __sgi
 #define BYTE_ORDER BIG_ENDIAN
 #define BIG_ENDIAN      4321
 #define LITTLE_ENDIAN   1234            /* LSB first: i386, vax, all NT risc */
-#define	__BIT_TYPES_DEFINED__
 #endif
 
 #ifdef __sun
 #define BIG_ENDIAN      4321
 #define LITTLE_ENDIAN   1234            /* LSB first: i386, vax, all NT risc */
 
 #ifdef HAVE_COMPAT_H
 #include <compat.h>
@@ -131,48 +137,90 @@
 #define BYTE_ORDER BIG_ENDIAN
 #else
 #define BYTE_ORDER LITTLE_ENDIAN
 #endif
 
 #endif /* !BYTE_ORDER */
 #endif /* __sun */
 
+#if defined(__hpux) || defined(__hppa)
+#define BYTE_ORDER BIG_ENDIAN
+#define BIG_ENDIAN      4321
+#define LITTLE_ENDIAN   1234            /* LSB first: i386, vax, all NT risc */
+#endif
+
+#if defined(AIXV3) || defined(AIX)
+/* BYTE_ORDER, LITTLE_ENDIAN, BIG_ENDIAN are all defined here */
+#include <sys/machine.h>
+#endif
+
+/* Digital Unix */
+#ifdef __osf__
+#include <machine/endian.h>
+#endif
+
+#ifdef __alpha
+#ifndef WIN32
+#else
+/* Alpha NT */
+#define BYTE_ORDER LITTLE_ENDIAN
+#define BIG_ENDIAN      4321
+#define LITTLE_ENDIAN   1234 
+#endif
+#endif
+
 #ifdef NCR
 #include <sys/endian.h>
 #endif
 
 #ifdef __QNX__
 #define LITTLE_ENDIAN	1234
 #define BIG_ENDIAN	4321
 #define BYTE_ORDER	LITTLE_ENDIAN
 #endif
 
-#ifdef SCO
-#include <sys/bitypes.h>
-#define MAXPATHLEN 	1024              
-#endif
-
 #ifdef SNI
 /* #include <sys/hetero.h> */
 #define BYTE_ORDER BIG_ENDIAN
 #define BIG_ENDIAN      4321
 #define LITTLE_ENDIAN   1234
 #endif
 
+#if defined(_WINDOWS) || defined(XP_OS2)
+#ifdef BYTE_ORDER
+#undef BYTE_ORDER
+#endif
+
+#define BYTE_ORDER LITTLE_ENDIAN
+#define LITTLE_ENDIAN   1234            /* LSB first: i386, vax, all NT risc */
+#define BIG_ENDIAN      4321
+#endif
+
+#ifdef macintosh
+#define BIG_ENDIAN 4321
+#define LITTLE_ENDIAN 1234
+#define BYTE_ORDER BIG_ENDIAN
+#endif
+
+#endif  /* __DBINTERFACE_PRIVATE */
+
+#ifdef SCO
+#define MAXPATHLEN 	1024              
+#endif
+
 #ifdef macintosh
 #include <unix.h>
 #else
 #include <fcntl.h>
 #endif
 
 #if defined(_WINDOWS) || defined(XP_OS2)
 #include <stdio.h>
 #include <io.h>
-#include <limits.h>
 
 #ifndef XP_OS2 
 #define MAXPATHLEN 	1024               
 #else
 #include <dirent.h>
 #endif
 
 #define	EFTYPE		EINVAL		/* POSIX 1003.1 format errno. */
@@ -181,93 +229,53 @@
 #define	STDIN_FILENO	0		/* ANSI C #defines */
 #define	STDOUT_FILENO	1
 #define	STDERR_FILENO	2
 #endif
 
 #ifndef O_ACCMODE			/* POSIX 1003.1 access mode mask. */
 #define	O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
 #endif
-
-#ifdef BYTE_ORDER
-#undef BYTE_ORDER
 #endif
 
-#define BYTE_ORDER LITTLE_ENDIAN
-#define LITTLE_ENDIAN   1234            /* LSB first: i386, vax, all NT risc */
-#define BIG_ENDIAN      4321
-#endif
-
-#if defined(_WINDOWS) && !defined(_WIN32)
-/* 16 bit windows defines */
-#define	MAX_PAGE_NUMBER	0xffffffff	/* >= # of pages in a file */
-#endif
-
-
 #ifdef macintosh
 #include <stdio.h>
 #include "xp_mcom.h"
-#define BIG_ENDIAN 4321
-#define LITTLE_ENDIAN 1234
-#define BYTE_ORDER BIG_ENDIAN
 #define O_ACCMODE       3       /* Mask for file access modes */
 #define EFTYPE 2000
 XP_BEGIN_PROTOS
 int mkstemp(const char *path);
 XP_END_PROTOS
 #endif	/* MACINTOSH */
 
-#if defined(XP_OS2)
-/* #include <xp_mcom.h> */
-/* XP_BEGIN_PROTOS */
-/* int mkstemp(char *path); */
-/* XP_END_PROTOS */
-#endif
-
-#ifndef macintosh
-#include <sys/types.h>
-#endif
-
 #if !defined(_WINDOWS) && !defined(macintosh) && !defined(XP_OS2)
 #include <sys/stat.h>
 #include <errno.h>
 #endif
 
-#ifndef HAVE_SYS_CDEFS_H
-#include "cdefs.h"
-#endif
-
-#ifndef _WINDOWS  /* included above to prevent spurious warnings chouck 12-Sep-95 */
-#include <limits.h>
+/* define EFTYPE since most don't */
+#ifndef EFTYPE
+#define EFTYPE      EINVAL      /* POSIX 1003.1 format errno. */
 #endif
 
 #define	RET_ERROR	-1		/* Return values. */
 #define	RET_SUCCESS	 0
 #define	RET_SPECIAL	 1
 
-#if defined(__386BSD__) || defined(SCO)
-#define	__BIT_TYPES_DEFINED__
-#endif
-
 #define	MAX_PAGE_NUMBER	0xffffffff	/* >= # of pages in a file */
 
 #ifndef __sgi
 typedef uint32	pgno_t;
 #endif
 
 #define	MAX_PAGE_OFFSET	65535		/* >= # of bytes in a page */
 typedef uint16	indx_t;
 #define	MAX_REC_NUMBER	0xffffffff	/* >= # of records in a tree */
 typedef uint32	recno_t;
 
-/* define EFTYPE since most don't */
-#ifndef EFTYPE
-#define EFTYPE      EINVAL      /* POSIX 1003.1 format errno. */
-#endif
-
 /* Key/data structure -- a Data-Base Thang. */
 typedef struct {
 	void	*data;			/* data */
 	size_t	 size;			/* data length */
 } DBT;
 
 /* Routine flags. */
 #define	R_CURSOR	1		/* del, put, seq */
@@ -363,17 +371,17 @@ typedef struct {
 	uint	cachesize;	/* bytes to cache */
 	uint	psize;		/* page size */
 	int	lorder;		/* byte order */
 	size_t	reclen;		/* record length (fixed-length records) */
 	uint8	bval;		/* delimiting byte (variable-length records */
 	char	*bfname;	/* btree file name */ 
 } RECNOINFO;
 
-/* #ifdef __DBINTERFACE_PRIVATE */
+#ifdef __DBINTERFACE_PRIVATE
 /*
  * Little endian <==> big endian 32-bit swap macros.
  *	M_32_SWAP	swap a memory location
  *	P_32_SWAP	swap a referenced memory location
  *	P_32_COPY	swap from one location to another
  */
 #define	M_32_SWAP(a) {							\
 	uint32 _tmp = a;						\
@@ -411,59 +419,33 @@ typedef struct {
 	uint16 _tmp = *(uint16 *)a;				\
 	((char *)a)[0] = ((char *)&_tmp)[1];				\
 	((char *)a)[1] = ((char *)&_tmp)[0];				\
 }
 #define	P_16_COPY(a, b) {						\
 	((char *)&(b))[0] = ((char *)&(a))[1];				\
 	((char *)&(b))[1] = ((char *)&(a))[0];				\
 }
-/* #endif */
+#endif
 
-__BEGIN_DECLS
+PR_BEGIN_EXTERN_C
 #if defined(__WATCOMC__) || defined(__WATCOM_CPLUSPLUS__)
 extern DB *
 #else
 PR_EXTERN(DB *)
 #endif
 dbopen (const char *, int, int, DBTYPE, const void *);
 
 /* set or unset a global lock flag to disable the
  * opening of any DBM file
  */
 void dbSetOrClearDBLock(DBLockFlagEnum type);
 
-/* #ifdef __DBINTERFACE_PRIVATE */
+#ifdef __DBINTERFACE_PRIVATE
 DB	*__bt_open (const char *, int, int, const BTREEINFO *, int);
 DB	*__hash_open (const char *, int, int, const HASHINFO *, int);
 DB	*__rec_open (const char *, int, int, const RECNOINFO *, int);
 void	 __dbpanic (DB *dbp);
-/* #endif */
-
-__END_DECLS
-
-#if defined(__hpux) || defined(__hppa)
-#define BYTE_ORDER BIG_ENDIAN
-#define BIG_ENDIAN      4321
-#define LITTLE_ENDIAN   1234            /* LSB first: i386, vax, all NT risc */
-#endif
-
-#if defined(AIXV3) || defined(AIX)
-/* BYTE_ORDER, LITTLE_ENDIAN, BIG_ENDIAN are all defined here */
-#include <sys/machine.h>
 #endif
 
-/* Digital Unix */
-#ifdef __osf__
-#include <machine/endian.h>
-#endif
-
-#ifdef __alpha
-#ifndef WIN32
-#else
-/* Alpha NT */
-#define BYTE_ORDER LITTLE_ENDIAN
-#define BIG_ENDIAN      4321
-#define LITTLE_ENDIAN   1234 
-#endif
-#endif
+PR_END_EXTERN_C
 
 #endif /* !_DB_H_ */
--- a/dbm/include/nsres.h
+++ b/dbm/include/nsres.h
@@ -1,11 +1,10 @@
 #ifndef NSRES_H
 #define NSRES_H
-#include "cdefs.h"
 #include "mcom_db.h"
 
 __BEGIN_DECLS
 
 /* C version */
 #define NSRESHANDLE void *
 
 typedef void (*NSRESTHREADFUNC)(void *);
--- a/dbm/macbuild/DBMConfig.h
+++ b/dbm/macbuild/DBMConfig.h
@@ -15,9 +15,9 @@
  * The Initial Developer of the Original Code is Netscape
  * Communications Corporation.  Portions created by Netscape are
  * Copyright (C) 1998 Netscape Communications Corporation. All
  * Rights Reserved.
  *
  * Contributor(s): 
  */
 
-/* Nothing to do here. If you need DBM-specific defines, put them here */
+#define __DBINTERFACE_PRIVATE 1
--- a/dbm/src/Makefile.win
+++ b/dbm/src/Makefile.win
@@ -83,14 +83,14 @@ LINCS = -I..\include
 
 #//------------------------------------------------------------------------
 #//
 #// Include the common makefile rules
 #//
 #//------------------------------------------------------------------------
 include <$(DEPTH)/config/rules.mak>
 
-CFLAGS = $(CFLAGS) -DMOZILLA_CLIENT
+CFLAGS = $(CFLAGS) -DMOZILLA_CLIENT -D__DBINTERFACE_PRIVATE
 
 install:: $(LIBRARY)
     $(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
 
 
--- a/dbm/src/h_bigkey.c
+++ b/dbm/src/h_bigkey.c
@@ -424,17 +424,17 @@ extern int
 						hashp->cpage = NULL;
 					}
 				}
 			}
 			return (0);
 		}
 
 	val->size = collect_data(hashp, bufp, (int)len, set_current);
-	if ((val->size + 1) == 0) /* unsigned ints are not really negative */
+	if (val->size == (size_t)-1)
 		return (-1);
 	if (save_p->addr != save_addr) {
 		/* We are pretty short on buffers. */
 		errno = EINVAL;			/* OUT OF BUFFERS */
 		return (-1);
 	}
 	memmove(hashp->tmp_buf, (save_p->page) + off, len);
 	val->data = (uint8 *)hashp->tmp_buf;
@@ -510,17 +510,17 @@ collect_data(
 extern int
 __big_keydata(
 	HTAB *hashp, 
 	BUFHEAD *bufp, 
 	DBT *key, DBT *val,
 	int set)
 {
 	key->size = collect_key(hashp, bufp, 0, val, set);
-	if ((key->size + 1) == 0) /* same compile warning about comparing signed and unsigned */
+	if (key->size == (size_t)-1)
 		return (-1);
 	key->data = (uint8 *)hashp->tmp_key;
 	return (0);
 }
 
 /*
  * Count how big the total key size is by recursing through the pages.  Then
  * collect the data, allocate a buffer and copy the key as you recurse up.
--- a/dbm/src/h_page.c
+++ b/dbm/src/h_page.c
@@ -1161,17 +1161,17 @@ open_temp(HTAB *hashp)
 {
 #ifdef XP_OS2
  	hashp->fp = mkstemp(NULL);
 #else
 #if !defined(_WIN32) && !defined(_WINDOWS) && !defined(macintosh)
 	sigset_t set, oset;
 #endif
 	char * tmpdir;
-	int    len;
+	size_t len;
 	static const char namestr[] = "/_hashXXXXXX";
 	char filename[1024];
 	char last;
 
 #if !defined(_WIN32) && !defined(_WINDOWS) && !defined(macintosh)
 	/* Block signals; make sure file goes away at process exit. */
 	(void)sigfillset(&set);
 	(void)sigprocmask(SIG_BLOCK, &set, &oset);
--- a/dbm/src/hash.c
+++ b/dbm/src/hash.c
@@ -234,17 +234,17 @@ extern DB *
 			RETURN_ERROR(EFTYPE, error1);
 		/* Verify file type, versions and hash function */
 		if (hashp->MAGIC != HASHMAGIC)
 			RETURN_ERROR(EFTYPE, error1);
 #define	OLDHASHVERSION	1
 		if (hashp->VERSION != HASHVERSION &&
 		    hashp->VERSION != OLDHASHVERSION)
 			RETURN_ERROR(EFTYPE, error1);
-		if (hashp->hash(CHARKEY, sizeof(CHARKEY)) != (unsigned)hashp->H_CHARKEY)
+		if (hashp->hash(CHARKEY, sizeof(CHARKEY)) != hashp->H_CHARKEY)
 			RETURN_ERROR(EFTYPE, error1);
 		if (hashp->NKEYS < 0) {
 		    /*
 		    ** OOPS. Old bad database from previously busted
 		    ** code. Blow it away.
 		    */
 		    close(hashp->fp);
 		    if (remove(file) < 0) {
--- a/dbm/src/snprintf.c
+++ b/dbm/src/snprintf.c
@@ -1,19 +1,19 @@
 #ifndef HAVE_SNPRINTF
 
 #include "watcomfx.h"
 #include <sys/types.h>
 #include <stddef.h>
 #include <stdio.h>
 
-#if defined(_WINDOWS) || defined(SOLARIS) || defined(AIXV3) || defined(AIX) || defined(OSF1) || defined(NEC) || !defined(HAVE_SYS_CDEFS_H)
+#ifdef HAVE_SYS_CDEFS_H
+#include <sys/cdefs.h>
+#else
 #include "cdefs.h"
-#elif !defined(HPUX) && !defined(UNIXWARE) && !defined(SNI)
-#include <sys/cdefs.h>
 #endif
 
 #include "prtypes.h"
 
 #include <ncompat.h>
 
 /* The OS/2 VAC compiler doesn't appear to define __STDC__ and won't let us define it either */
 #if defined(__STDC__) || defined(XP_OS2_VACPP)