1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +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

@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.51 2000/03/01 05:39:20 inoue Exp $
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.52 2000/03/17 02:36:00 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1193,7 +1193,7 @@ gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t)
char *datum = (((char *) t) + sizeof(IndexTupleData));
/* if new entry fits in index tuple, copy it in */
if (entry.bytes < IndexTupleSize(t) - sizeof(IndexTupleData))
if ((Size) entry.bytes < IndexTupleSize(t) - sizeof(IndexTupleData))
{
memcpy(datum, entry.pred, entry.bytes);
/* clear out old size */

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashinsert.c,v 1.19 2000/01/26 05:55:55 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashinsert.c,v 1.20 2000/03/17 02:36:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -112,7 +112,7 @@ _hash_insertonpg(Relation rel,
Page page;
BlockNumber itup_blkno;
OffsetNumber itup_off;
int itemsz;
Size itemsz;
HashPageOpaque pageopaque;
bool do_expand = false;
Buffer ovflbuf;

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.26 2000/01/26 05:55:55 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.27 2000/03/17 02:36:02 tgl Exp $
*
* NOTES
* Overflow pages look like ordinary relation pages.
@@ -171,7 +171,7 @@ _hash_getovfladdr(Relation rel, Buffer *metabufp)
}
/* Check if we need to allocate a new bitmap page */
if (free_bit == BMPGSZ_BIT(metap) - 1)
if (free_bit == (uint32) (BMPGSZ_BIT(metap) - 1))
{
/* won't be needing old map page */
@@ -478,7 +478,7 @@ _hash_squeezebucket(Relation rel,
OffsetNumber woffnum;
OffsetNumber roffnum;
HashItem hitem;
int itemsz;
Size itemsz;
/* elog(DEBUG, "_hash_squeezebucket: squeezing bucket %d", bucket); */

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.26 2000/01/26 05:55:55 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.27 2000/03/17 02:36:02 tgl Exp $
*
* NOTES
* Postgres hash pages look like ordinary relation pages. The opaque
@@ -464,7 +464,7 @@ _hash_splitpage(Relation rel,
HashPageOpaque nopaque;
HashMetaPage metap;
IndexTuple itup;
int itemsz;
Size itemsz;
OffsetNumber ooffnum;
OffsetNumber noffnum;
OffsetNumber omaxoffnum;

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.22 2000/01/26 05:55:55 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.23 2000/03/17 02:36:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -351,7 +351,7 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir, Buffer metabuf)
opaque = (HashPageOpaque) PageGetSpecialPointer(page);
Assert(opaque->hasho_bucket == bucket);
while (PageIsEmpty(page) &&
BlockNumberIsValid(opaque->hasho_nextblkno))
BlockNumberIsValid(opaque->hasho_nextblkno))
_hash_readnext(rel, &buf, &page, &opaque);
maxoff = PageGetMaxOffsetNumber(page);
offnum = FirstOffsetNumber;

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Id: hio.c,v 1.29 2000/01/26 05:55:56 momjian Exp $
* $Id: hio.c,v 1.30 2000/03/17 02:36:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,7 +39,7 @@ RelationPutHeapTuple(Relation relation,
{
Page pageHeader;
OffsetNumber offnum;
unsigned int len;
Size len;
ItemId itemId;
Item item;
@@ -51,8 +51,8 @@ RelationPutHeapTuple(Relation relation,
IncrHeapAccessStat(global_RelationPutHeapTuple);
pageHeader = (Page) BufferGetPage(buffer);
len = (unsigned) MAXALIGN(tuple->t_len); /* be conservative */
Assert((int) len <= PageGetFreeSpace(pageHeader));
len = MAXALIGN(tuple->t_len); /* be conservative */
Assert(len <= PageGetFreeSpace(pageHeader));
offnum = PageAddItem((Page) pageHeader, (Item) tuple->t_data,
tuple->t_len, InvalidOffsetNumber, LP_USED);
@@ -104,18 +104,18 @@ RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple)
Page pageHeader;
BlockNumber lastblock;
OffsetNumber offnum;
unsigned int len;
Size len;
ItemId itemId;
Item item;
len = (unsigned) MAXALIGN(tuple->t_len); /* be conservative */
len = MAXALIGN(tuple->t_len); /* be conservative */
/*
* If we're gonna fail for oversize tuple, do it right away...
* this code should go away eventually.
*/
if (len > MaxTupleSize)
elog(ERROR, "Tuple is too big: size %d, max size %ld",
elog(ERROR, "Tuple is too big: size %u, max size %ld",
len, MaxTupleSize);
/*
@@ -175,7 +175,7 @@ RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple)
* test at the top of the routine, and the whole deal should
* go away when we implement tuple splitting anyway...
*/
elog(ERROR, "Tuple is too big: size %d", len);
elog(ERROR, "Tuple is too big: size %u", len);
}
}

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.55 2000/02/18 06:32:33 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.56 2000/03/17 02:36:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -257,7 +257,7 @@ _bt_insertonpg(Relation rel,
BlockNumber itup_blkno;
OffsetNumber itup_off;
OffsetNumber firstright = InvalidOffsetNumber;
int itemsz;
Size itemsz;
bool do_split = false;
bool keys_equal = false;
@@ -279,7 +279,7 @@ _bt_insertonpg(Relation rel,
* Note that at this point, itemsz doesn't include the ItemId.
*/
if (itemsz > (PageGetPageSize(page)-sizeof(PageHeaderData)-MAXALIGN(sizeof(BTPageOpaqueData)))/3 - sizeof(ItemIdData))
elog(ERROR, "btree: index item size %d exceeds maximum %ld",
elog(ERROR, "btree: index item size %u exceeds maximum %lu",
itemsz,
(PageGetPageSize(page)-sizeof(PageHeaderData)-MAXALIGN(sizeof(BTPageOpaqueData)))/3 - sizeof(ItemIdData));
@@ -1374,7 +1374,7 @@ _bt_tuplecompare(Relation rel,
tupDes = RelationGetDescr(rel);
for (i = 1; i <= keysz; i++)
for (i = 1; i <= (int) keysz; i++)
{
ScanKey entry = &scankey[i - 1];
Datum attrDatum1,

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.57 2000/02/18 06:32:39 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.58 2000/03/17 02:36:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -272,7 +272,7 @@ _bt_skeycmp(Relation rel,
tupDes = RelationGetDescr(rel);
for (i = 1; i <= keysz; i++)
for (i = 1; i <= (int) keysz; i++)
{
ScanKey entry = &scankey[i - 1];
Datum attrDatum;
@@ -658,7 +658,7 @@ _bt_next(IndexScanDesc scan, ScanDirection dir)
}
} while (keysok >= so->numberOfFirstKeys ||
(keysok == -1 && ScanDirectionIsBackward(dir)));
(keysok == ((Size) -1) && ScanDirectionIsBackward(dir)));
ItemPointerSetInvalid(current);
so->btso_curbuf = InvalidBuffer;
@@ -1026,7 +1026,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
so->btso_curbuf = buf;
return _bt_next(scan, dir);
}
else if (keysok == -1 && ScanDirectionIsBackward(dir))
else if (keysok == ((Size) -1) && ScanDirectionIsBackward(dir))
{
so->btso_curbuf = buf;
return _bt_next(scan, dir);
@@ -1501,7 +1501,7 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
so->btso_curbuf = buf;
return _bt_next(scan, dir);
}
else if (keysok == -1 && ScanDirectionIsBackward(dir))
else if (keysok == ((Size) -1) && ScanDirectionIsBackward(dir))
{
so->btso_curbuf = buf;
return _bt_next(scan, dir);

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.61 2000/02/18 09:30:20 inoue Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.62 2000/03/17 02:36:05 tgl Exp $
*
* NOTES
* Transaction aborts can now occur two ways:
@@ -190,6 +190,7 @@ static void StartTransaction(void);
TransactionStateData CurrentTransactionStateData = {
0, /* transaction id */
FirstCommandId, /* command id */
0, /* scan command id */
0x0, /* start time */
TRANS_DEFAULT, /* transaction state */
TBLOCK_DEFAULT /* transaction block state */