Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit341b328

Browse files
committed
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 unsignedcomparisons, routines declared static and then defined not-static,that kind of thing. Tedious, but perhaps useful...
1 parentbc1f117 commit341b328

File tree

37 files changed

+118
-116
lines changed

37 files changed

+118
-116
lines changed

‎src/backend/access/gist/gist.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.51 2000/03/01 05:39:20 inoue Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.52 2000/03/17 02:36:00 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -1193,7 +1193,7 @@ gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t)
11931193
char*datum= (((char*)t)+sizeof(IndexTupleData));
11941194

11951195
/* if new entry fits in index tuple, copy it in */
1196-
if (entry.bytes<IndexTupleSize(t)-sizeof(IndexTupleData))
1196+
if ((Size)entry.bytes<IndexTupleSize(t)-sizeof(IndexTupleData))
11971197
{
11981198
memcpy(datum,entry.pred,entry.bytes);
11991199
/* clear out old size */

‎src/backend/access/hash/hashinsert.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashinsert.c,v 1.19 2000/01/26 05:55:55 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashinsert.c,v 1.20 2000/03/17 02:36:02 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -112,7 +112,7 @@ _hash_insertonpg(Relation rel,
112112
Pagepage;
113113
BlockNumberitup_blkno;
114114
OffsetNumberitup_off;
115-
intitemsz;
115+
Sizeitemsz;
116116
HashPageOpaquepageopaque;
117117
booldo_expand= false;
118118
Bufferovflbuf;

‎src/backend/access/hash/hashovfl.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.26 2000/01/26 05:55:55 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.27 2000/03/17 02:36:02 tgl Exp $
1212
*
1313
* NOTES
1414
* Overflow pages look like ordinary relation pages.
@@ -171,7 +171,7 @@ _hash_getovfladdr(Relation rel, Buffer *metabufp)
171171
}
172172

173173
/* Check if we need to allocate a new bitmap page */
174-
if (free_bit==BMPGSZ_BIT(metap)-1)
174+
if (free_bit==(uint32) (BMPGSZ_BIT(metap)-1))
175175
{
176176
/* won't be needing old map page */
177177

@@ -478,7 +478,7 @@ _hash_squeezebucket(Relation rel,
478478
OffsetNumberwoffnum;
479479
OffsetNumberroffnum;
480480
HashItemhitem;
481-
intitemsz;
481+
Sizeitemsz;
482482

483483
/* elog(DEBUG, "_hash_squeezebucket: squeezing bucket %d", bucket); */
484484

‎src/backend/access/hash/hashpage.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.26 2000/01/26 05:55:55 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.27 2000/03/17 02:36:02 tgl Exp $
1212
*
1313
* NOTES
1414
* Postgres hash pages look like ordinary relation pages. The opaque
@@ -464,7 +464,7 @@ _hash_splitpage(Relation rel,
464464
HashPageOpaquenopaque;
465465
HashMetaPagemetap;
466466
IndexTupleitup;
467-
intitemsz;
467+
Sizeitemsz;
468468
OffsetNumberooffnum;
469469
OffsetNumbernoffnum;
470470
OffsetNumberomaxoffnum;

‎src/backend/access/hash/hashsearch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.22 2000/01/26 05:55:55 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.23 2000/03/17 02:36:02 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -351,7 +351,7 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir, Buffer metabuf)
351351
opaque= (HashPageOpaque)PageGetSpecialPointer(page);
352352
Assert(opaque->hasho_bucket==bucket);
353353
while (PageIsEmpty(page)&&
354-
BlockNumberIsValid(opaque->hasho_nextblkno))
354+
BlockNumberIsValid(opaque->hasho_nextblkno))
355355
_hash_readnext(rel,&buf,&page,&opaque);
356356
maxoff=PageGetMaxOffsetNumber(page);
357357
offnum=FirstOffsetNumber;

‎src/backend/access/heap/hio.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Id: hio.c,v 1.29 2000/01/26 05:55:56 momjian Exp $
11+
* $Id: hio.c,v 1.30 2000/03/17 02:36:02 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -39,7 +39,7 @@ RelationPutHeapTuple(Relation relation,
3939
{
4040
PagepageHeader;
4141
OffsetNumberoffnum;
42-
unsignedintlen;
42+
Sizelen;
4343
ItemIditemId;
4444
Itemitem;
4545

@@ -51,8 +51,8 @@ RelationPutHeapTuple(Relation relation,
5151
IncrHeapAccessStat(global_RelationPutHeapTuple);
5252

5353
pageHeader= (Page)BufferGetPage(buffer);
54-
len=(unsigned)MAXALIGN(tuple->t_len);/* be conservative */
55-
Assert((int)len <=PageGetFreeSpace(pageHeader));
54+
len=MAXALIGN(tuple->t_len);/* be conservative */
55+
Assert(len <=PageGetFreeSpace(pageHeader));
5656

5757
offnum=PageAddItem((Page)pageHeader, (Item)tuple->t_data,
5858
tuple->t_len,InvalidOffsetNumber,LP_USED);
@@ -104,18 +104,18 @@ RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple)
104104
PagepageHeader;
105105
BlockNumberlastblock;
106106
OffsetNumberoffnum;
107-
unsignedintlen;
107+
Sizelen;
108108
ItemIditemId;
109109
Itemitem;
110110

111-
len=(unsigned)MAXALIGN(tuple->t_len);/* be conservative */
111+
len=MAXALIGN(tuple->t_len);/* be conservative */
112112

113113
/*
114114
* If we're gonna fail for oversize tuple, do it right away...
115115
* this code should go away eventually.
116116
*/
117117
if (len>MaxTupleSize)
118-
elog(ERROR,"Tuple is too big: size %d, max size %ld",
118+
elog(ERROR,"Tuple is too big: size %u, max size %ld",
119119
len,MaxTupleSize);
120120

121121
/*
@@ -175,7 +175,7 @@ RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple)
175175
* test at the top of the routine, and the whole deal should
176176
* go away when we implement tuple splitting anyway...
177177
*/
178-
elog(ERROR,"Tuple is too big: size %d",len);
178+
elog(ERROR,"Tuple is too big: size %u",len);
179179
}
180180
}
181181

‎src/backend/access/nbtree/nbtinsert.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.55 2000/02/18 06:32:33 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.56 2000/03/17 02:36:03 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -257,7 +257,7 @@ _bt_insertonpg(Relation rel,
257257
BlockNumberitup_blkno;
258258
OffsetNumberitup_off;
259259
OffsetNumberfirstright=InvalidOffsetNumber;
260-
intitemsz;
260+
Sizeitemsz;
261261
booldo_split= false;
262262
boolkeys_equal= false;
263263

@@ -279,7 +279,7 @@ _bt_insertonpg(Relation rel,
279279
* Note that at this point, itemsz doesn't include the ItemId.
280280
*/
281281
if (itemsz> (PageGetPageSize(page)-sizeof(PageHeaderData)-MAXALIGN(sizeof(BTPageOpaqueData)))/3-sizeof(ItemIdData))
282-
elog(ERROR,"btree: index item size %d exceeds maximum %ld",
282+
elog(ERROR,"btree: index item size %u exceeds maximum %lu",
283283
itemsz,
284284
(PageGetPageSize(page)-sizeof(PageHeaderData)-MAXALIGN(sizeof(BTPageOpaqueData)))/3-sizeof(ItemIdData));
285285

@@ -1374,7 +1374,7 @@ _bt_tuplecompare(Relation rel,
13741374

13751375
tupDes=RelationGetDescr(rel);
13761376

1377-
for (i=1;i <=keysz;i++)
1377+
for (i=1;i <=(int)keysz;i++)
13781378
{
13791379
ScanKeyentry=&scankey[i-1];
13801380
DatumattrDatum1,

‎src/backend/access/nbtree/nbtsearch.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.57 2000/02/18 06:32:39 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.58 2000/03/17 02:36:04 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -272,7 +272,7 @@ _bt_skeycmp(Relation rel,
272272

273273
tupDes=RelationGetDescr(rel);
274274

275-
for (i=1;i <=keysz;i++)
275+
for (i=1;i <=(int)keysz;i++)
276276
{
277277
ScanKeyentry=&scankey[i-1];
278278
DatumattrDatum;
@@ -658,7 +658,7 @@ _bt_next(IndexScanDesc scan, ScanDirection dir)
658658
}
659659

660660
}while (keysok >=so->numberOfFirstKeys||
661-
(keysok==-1&&ScanDirectionIsBackward(dir)));
661+
(keysok==((Size)-1)&&ScanDirectionIsBackward(dir)));
662662

663663
ItemPointerSetInvalid(current);
664664
so->btso_curbuf=InvalidBuffer;
@@ -1026,7 +1026,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
10261026
so->btso_curbuf=buf;
10271027
return_bt_next(scan,dir);
10281028
}
1029-
elseif (keysok==-1&&ScanDirectionIsBackward(dir))
1029+
elseif (keysok==((Size)-1)&&ScanDirectionIsBackward(dir))
10301030
{
10311031
so->btso_curbuf=buf;
10321032
return_bt_next(scan,dir);
@@ -1501,7 +1501,7 @@ _bt_endpoint(IndexScanDesc scan, ScanDirection dir)
15011501
so->btso_curbuf=buf;
15021502
return_bt_next(scan,dir);
15031503
}
1504-
elseif (keysok==-1&&ScanDirectionIsBackward(dir))
1504+
elseif (keysok==((Size)-1)&&ScanDirectionIsBackward(dir))
15051505
{
15061506
so->btso_curbuf=buf;
15071507
return_bt_next(scan,dir);

‎src/backend/access/transam/xact.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.61 2000/02/18 09:30:20 inoue Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.62 2000/03/17 02:36:05 tgl Exp $
1212
*
1313
* NOTES
1414
*Transaction aborts can now occur two ways:
@@ -190,6 +190,7 @@ static void StartTransaction(void);
190190
TransactionStateDataCurrentTransactionStateData= {
191191
0,/* transaction id */
192192
FirstCommandId,/* command id */
193+
0,/* scan command id */
193194
0x0,/* start time */
194195
TRANS_DEFAULT,/* transaction state */
195196
TBLOCK_DEFAULT/* transaction block state */

‎src/backend/catalog/heap.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.123 2000/03/14 23:06:06 thomas Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.124 2000/03/17 02:36:05 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -184,7 +184,7 @@ heap_create(char *relname,
184184
boolistemp,
185185
boolstorage_create)
186186
{
187-
unsignedi;
187+
inti;
188188
Oidrelid;
189189
Relationrel;
190190
intlen;
@@ -425,8 +425,8 @@ heap_storage_create(Relation rel)
425425
staticvoid
426426
CheckAttributeNames(TupleDesctupdesc)
427427
{
428-
unsignedi;
429-
unsignedj;
428+
inti;
429+
intj;
430430
intnatts=tupdesc->natts;
431431

432432
/* ----------------
@@ -437,9 +437,9 @@ CheckAttributeNames(TupleDesc tupdesc)
437437
* an unknown typid (usually as a result of a 'retrieve into'
438438
* - jolly
439439
*/
440-
for (i=0;i<natts;i+=1)
440+
for (i=0;i<natts;i++)
441441
{
442-
for (j=0;j<sizeofHeapAtt /sizeofHeapAtt[0];j+=1)
442+
for (j=0;j<(int) (sizeof(HeapAtt) /sizeof(HeapAtt[0]));j++)
443443
{
444444
if (nameeq(&(HeapAtt[j]->attname),
445445
&(tupdesc->attrs[i]->attname)))
@@ -461,9 +461,9 @@ CheckAttributeNames(TupleDesc tupdesc)
461461
*next check for repeated attribute names
462462
* ----------------
463463
*/
464-
for (i=1;i<natts;i+=1)
464+
for (i=1;i<natts;i++)
465465
{
466-
for (j=0;j<i;j+=1)
466+
for (j=0;j<i;j++)
467467
{
468468
if (nameeq(&(tupdesc->attrs[j]->attname),
469469
&(tupdesc->attrs[i]->attname)))
@@ -561,7 +561,7 @@ AddNewAttributeTuples(Oid new_rel_oid,
561561
TupleDesctupdesc)
562562
{
563563
Form_pg_attribute*dpp;
564-
unsignedi;
564+
inti;
565565
HeapTupletup;
566566
Relationrel;
567567
boolhasindex;

‎src/backend/commands/comment.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ void DeleteComments(Oid oid) {
256256
*------------------------------------------------------------------
257257
*/
258258

259-
voidCommentRelation(intreltype,char*relname,char*comment) {
259+
staticvoidCommentRelation(intreltype,char*relname,char*comment) {
260260

261261
HeapTuplereltuple;
262262
Oidoid;
@@ -325,7 +325,7 @@ void CommentRelation(int reltype, char *relname, char *comment) {
325325
*------------------------------------------------------------------
326326
*/
327327

328-
voidCommentAttribute(char*relname,char*attrname,char*comment) {
328+
staticvoidCommentAttribute(char*relname,char*attrname,char*comment) {
329329

330330
Relationrelation;
331331
HeapTupleattrtuple;
@@ -371,7 +371,7 @@ void CommentAttribute(char *relname, char *attrname, char *comment) {
371371
*------------------------------------------------------------------
372372
*/
373373

374-
voidCommentDatabase(char*database,char*comment) {
374+
staticvoidCommentDatabase(char*database,char*comment) {
375375

376376
Relationpg_database;
377377
HeapTupledbtuple,usertuple;
@@ -439,7 +439,7 @@ void CommentDatabase(char *database, char *comment) {
439439
*------------------------------------------------------------------
440440
*/
441441

442-
voidCommentRewrite(char*rule,char*comment) {
442+
staticvoidCommentRewrite(char*rule,char*comment) {
443443

444444
HeapTuplerewritetuple;
445445
Oidoid;
@@ -485,7 +485,7 @@ void CommentRewrite(char *rule, char *comment) {
485485
*------------------------------------------------------------------
486486
*/
487487

488-
voidCommentType(char*type,char*comment) {
488+
staticvoidCommentType(char*type,char*comment) {
489489

490490
HeapTupletypetuple;
491491
Oidoid;
@@ -527,7 +527,7 @@ void CommentType(char *type, char *comment) {
527527
*------------------------------------------------------------------
528528
*/
529529

530-
voidCommentAggregate(char*aggregate,char*argument,char*comment) {
530+
staticvoidCommentAggregate(char*aggregate,char*argument,char*comment) {
531531

532532
HeapTupleaggtuple;
533533
Oidbaseoid,oid;
@@ -592,7 +592,7 @@ void CommentAggregate(char *aggregate, char *argument, char *comment) {
592592
*------------------------------------------------------------------
593593
*/
594594

595-
voidCommentProc(char*function,List*arguments,char*comment)
595+
staticvoidCommentProc(char*function,List*arguments,char*comment)
596596
{
597597
HeapTupleargtuple,functuple;
598598
Oidoid,argoids[FUNC_MAX_ARGS];
@@ -663,7 +663,7 @@ void CommentProc(char *function, List *arguments, char *comment)
663663
*------------------------------------------------------------------
664664
*/
665665

666-
voidCommentOperator(char*opername,List*arguments,char*comment) {
666+
staticvoidCommentOperator(char*opername,List*arguments,char*comment) {
667667

668668
Form_pg_operatordata;
669669
HeapTupleoptuple;
@@ -752,7 +752,7 @@ void CommentOperator(char *opername, List *arguments, char *comment) {
752752
*------------------------------------------------------------------
753753
*/
754754

755-
voidCommentTrigger(char*trigger,char*relname,char*comment) {
755+
staticvoidCommentTrigger(char*trigger,char*relname,char*comment) {
756756

757757
Form_pg_triggerdata;
758758
Relationpg_trigger,relation;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp