1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-15 03:41:20 +03:00

Fix a bunch of minor portability problems and maybe-bugs revealed by

running gcc and HP's cc with warnings cranked way up.  Signed vs unsigned
comparisons, routines declared static and then defined not-static,
that kind of thing.  Tedious, but perhaps useful...
This commit is contained in:
Tom Lane
2000-03-17 02:36:41 +00:00
parent bc1f117094
commit 341b328b18
37 changed files with 118 additions and 116 deletions

View File

@@ -3,7 +3,7 @@
* out of its tuple
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.46 2000/03/15 23:42:14 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.47 2000/03/17 02:36:23 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -1555,21 +1555,21 @@ get_func_expr(Expr *expr, deparse_context *context)
*/
if (strcmp(proname, "bpchar") == 0)
{
if (coercedTypmod > VARHDRSZ)
if (coercedTypmod > (int32) VARHDRSZ)
appendStringInfo(buf, "char(%d)", coercedTypmod - VARHDRSZ);
else
appendStringInfo(buf, "char");
}
else if (strcmp(proname, "varchar") == 0)
{
if (coercedTypmod > VARHDRSZ)
if (coercedTypmod > (int32) VARHDRSZ)
appendStringInfo(buf, "varchar(%d)", coercedTypmod - VARHDRSZ);
else
appendStringInfo(buf, "varchar");
}
else if (strcmp(proname, "numeric") == 0)
{
if (coercedTypmod >= VARHDRSZ)
if (coercedTypmod >= (int32) VARHDRSZ)
appendStringInfo(buf, "numeric(%d,%d)",
((coercedTypmod - VARHDRSZ) >> 16) & 0xffff,
(coercedTypmod - VARHDRSZ) & 0xffff);

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.92 2000/03/09 05:00:25 inoue Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.93 2000/03/17 02:36:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1046,7 +1046,7 @@ formrdesc(char *relationName,
{
Relation relation;
Size len;
int i;
u_int i;
/* ----------------
* allocate new relation desc

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/hash/dynahash.c,v 1.29 2000/02/26 05:25:54 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/hash/dynahash.c,v 1.30 2000/03/17 02:36:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -701,7 +701,7 @@ hash_search(HTAB *hashp,
long *
hash_seq(HTAB *hashp)
{
static uint32 curBucket = 0;
static long curBucket = 0;
static BUCKET_INDEX curIndex;
ELEMENT *curElem;
long segment_num;
@@ -848,7 +848,7 @@ expand_table(HTAB *hashp)
{
chain = GET_BUCKET(hashp, chainIndex);
nextIndex = chain->next;
if (call_hash(hashp, (char *) &(chain->key)) == old_bucket)
if ((long) call_hash(hashp, (char *) &(chain->key)) == old_bucket)
{
*old = chainIndex;
old = &chain->next;

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/hash/hashfn.c,v 1.11 2000/01/26 05:57:24 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/hash/hashfn.c,v 1.12 2000/03/17 02:36:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -84,7 +84,7 @@ tag_hash(int *key, int keysize)
break;
default:
for (; keysize > (sizeof(int) - 1); keysize -= sizeof(int), key++)
for (; keysize >= (int) sizeof(int); keysize -= sizeof(int), key++)
h = h * PRIME1 ^ (*key);
/*

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.34 2000/01/31 04:35:53 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.35 2000/03/17 02:36:29 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -145,7 +145,7 @@ do { \
} while(0)
#define PortalHashTableDelete(PORTAL) \
{ \
do { \
PortalHashEnt *hentry; bool found; char key[MAX_PORTALNAME_LEN]; \
\
MemSet(key, 0, MAX_PORTALNAME_LEN); \

View File

@@ -64,7 +64,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/sort/logtape.c,v 1.3 2000/01/26 05:57:33 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/sort/logtape.c,v 1.4 2000/03/17 02:36:30 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -78,7 +78,7 @@
* Block indexes are "long"s, so we can fit this many per indirect block.
* NB: we assume this is an exact fit!
*/
#define BLOCKS_PER_INDIR_BLOCK (BLCKSZ / sizeof(long))
#define BLOCKS_PER_INDIR_BLOCK ((int) (BLCKSZ / sizeof(long)))
/*
* We use a struct like this for each active indirection level of each

View File

@@ -78,7 +78,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.7 2000/03/01 17:14:09 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.8 2000/03/17 02:36:31 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1751,7 +1751,7 @@ comparetup_index(Tuplesortstate *state, const void *a, const void *b)
IndexTuple tuple1 = (IndexTuple) a;
IndexTuple tuple2 = (IndexTuple) b;
Relation rel = state->indexRel;
Size keysz = RelationGetNumberOfAttributes(rel);
int keysz = RelationGetNumberOfAttributes(rel);
ScanKey scankey = state->indexScanKey;
TupleDesc tupDes;
int i;