Skip to content

Commit 64af43a

Browse files
committed
Add casts to suppress compiler warnings observed on Darwin platform
(surprised no one has reported these yet...)
1 parent c6e25ed commit 64af43a

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

src/backend/storage/page/bufpage.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/storage/page/bufpage.c,v 1.40 2001/10/28 06:25:51 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.41 2001/11/08 04:05:13 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -349,7 +349,7 @@ PageRepairFragmentation(Page page, OffsetNumber *unused)
349349

350350
if (totallen > (Size) (pd_special - pd_lower))
351351
elog(ERROR, "PageRepairFragmentation: corrupted item lengths, total %u, avail %u",
352-
totallen, pd_special - pd_lower);
352+
(unsigned int) totallen, pd_special - pd_lower);
353353

354354
/* sort itemIdSortData array into decreasing itemoff order */
355355
qsort((char *) itemidbase, nused, sizeof(struct itemIdSortData),

src/backend/utils/adt/varchar.c

Lines changed: 7 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/utils/adt/varchar.c,v 1.85 2001/10/25 05:49:46 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.86 2001/11/08 04:05:13 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -117,7 +117,8 @@ bpcharin(PG_FUNCTION_ARGS)
117117
if (strspn(s + mbmaxlen, " ") == len - mbmaxlen)
118118
len = mbmaxlen;
119119
else
120-
elog(ERROR, "value too long for type character(%d)", maxlen);
120+
elog(ERROR, "value too long for type character(%d)",
121+
(int) maxlen);
121122

122123
/*
123124
* XXX: at this point, maxlen is the necessary byte length, not
@@ -128,7 +129,8 @@ bpcharin(PG_FUNCTION_ARGS)
128129
if (strspn(s + maxlen, " ") == len - maxlen)
129130
len = maxlen;
130131
else
131-
elog(ERROR, "value too long for type character(%d)", maxlen);
132+
elog(ERROR, "value too long for type character(%d)",
133+
(int) maxlen);
132134
#endif
133135
}
134136
#ifdef MULTIBYTE
@@ -443,7 +445,8 @@ varcharin(PG_FUNCTION_ARGS)
443445
len = maxlen;
444446
#endif
445447
else
446-
elog(ERROR, "value too long for type character varying(%d)", maxlen);
448+
elog(ERROR, "value too long for type character varying(%d)",
449+
(int) maxlen);
447450
}
448451

449452
result = palloc(len + VARHDRSZ);

src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.37 2001/11/05 17:46:30 momjian Exp $
18+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.38 2001/11/08 04:05:12 tgl Exp $
1919
*
2020
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
2121
*
@@ -1226,10 +1226,11 @@ ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH)
12261226
if (AH->writingBlob)
12271227
{
12281228
res = lo_write(AH->connection, AH->loFd, (void *) ptr, size * nmemb);
1229-
ahlog(AH, 5, "wrote %d bytes of large object data (result = %d)\n", size * nmemb, res);
1230-
if (res < size * nmemb)
1229+
ahlog(AH, 5, "wrote %d bytes of large object data (result = %d)\n",
1230+
(int) (size * nmemb), res);
1231+
if (res != size * nmemb)
12311232
die_horribly(AH, modulename, "could not write to large object (result: %d, expected: %d)\n",
1232-
res, size * nmemb);
1233+
res, (int) (size * nmemb));
12331234

12341235
return res;
12351236
}
@@ -1260,7 +1261,8 @@ ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH)
12601261
{
12611262
res = fwrite((void *) ptr, size, nmemb, AH->OF);
12621263
if (res != nmemb)
1263-
die_horribly(AH, modulename, "could not write to output file (%d != %d)\n", res, nmemb);
1264+
die_horribly(AH, modulename, "could not write to output file (%d != %d)\n",
1265+
res, (int) nmemb);
12641266
return res;
12651267
}
12661268
}

src/interfaces/libpq/fe-misc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*
2626
*
2727
* IDENTIFICATION
28-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.60 2001/11/05 17:46:37 momjian Exp $
28+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.61 2001/11/08 04:05:13 tgl Exp $
2929
*
3030
*-------------------------------------------------------------------------
3131
*/
@@ -128,7 +128,8 @@ pqPutBytes(const char *s, size_t nbytes, PGconn *conn)
128128
{
129129
printfPQExpBuffer(&conn->errorMessage,
130130
libpq_gettext("could not flush enough data (space available: %d, space needed %d)\n"),
131-
Max(conn->outBufSize - conn->outCount, 0), nbytes);
131+
(int) Max(conn->outBufSize - conn->outCount, 0),
132+
(int) nbytes);
132133
return EOF;
133134
}
134135
/* fixup avail for while loop */

0 commit comments

Comments
 (0)