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

Commitae03a7c

Browse files
committed
Remove some unnecessary casts in format arguments
We can use %zd or %zu directly, no need to cast to int. Conversely,some code was casting away from int when it could be using %ddirectly.
1 parentcf5ce5a commitae03a7c

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

‎src/backend/access/spgist/spgutils.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,8 +1240,8 @@ SpGistPageAddNewItem(SpGistState *state, Page page, Item item, Size size,
12401240
*startOffset=offnum+1;
12411241
}
12421242
else
1243-
elog(PANIC,"failed to add item of size %u to SPGiST index page",
1244-
(int)size);
1243+
elog(PANIC,"failed to add item of size %zu to SPGiST index page",
1244+
size);
12451245

12461246
returnoffnum;
12471247
}
@@ -1252,8 +1252,8 @@ SpGistPageAddNewItem(SpGistState *state, Page page, Item item, Size size,
12521252
InvalidOffsetNumber, false, false);
12531253

12541254
if (offnum==InvalidOffsetNumber&& !errorOK)
1255-
elog(ERROR,"failed to add item of size %u to SPGiST index page",
1256-
(int)size);
1255+
elog(ERROR,"failed to add item of size %zu to SPGiST index page",
1256+
size);
12571257

12581258
returnoffnum;
12591259
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -991,8 +991,8 @@ WALReadRaiseError(WALReadError *errinfo)
991991
{
992992
ereport(ERROR,
993993
(errcode(ERRCODE_DATA_CORRUPTED),
994-
errmsg("could not read from log segment %s, offset %u: read %d of %zu",
994+
errmsg("could not read from log segment %s, offset %u: read %d of %d",
995995
fname,errinfo->wre_off,errinfo->wre_read,
996-
(Size)errinfo->wre_req)));
996+
errinfo->wre_req)));
997997
}
998998
}

‎src/backend/utils/adt/xml.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,8 +959,8 @@ pg_xml_init_library(void)
959959
if (sizeof(char)!=sizeof(xmlChar))
960960
ereport(ERROR,
961961
(errmsg("could not initialize XML library"),
962-
errdetail("libxml2 has incompatible char type: sizeof(char)=%u, sizeof(xmlChar)=%u.",
963-
(int)sizeof(char), (int)sizeof(xmlChar))));
962+
errdetail("libxml2 has incompatible char type: sizeof(char)=%zu, sizeof(xmlChar)=%zu.",
963+
sizeof(char),sizeof(xmlChar))));
964964

965965
#ifdefUSE_LIBXMLCONTEXT
966966
/* Set up libxml's memory allocation our way */

‎src/bin/pg_basebackup/receivelog.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ open_walfile(StreamCtl *stream, XLogRecPtr startpoint)
150150
/* if write didn't set errno, assume problem is no disk space */
151151
if (errno==0)
152152
errno=ENOSPC;
153-
pg_log_error(ngettext("write-ahead log file \"%s\" has %d byte, should be 0 or %d",
154-
"write-ahead log file \"%s\" has %d bytes, should be 0 or %d",
153+
pg_log_error(ngettext("write-ahead log file \"%s\" has %zd byte, should be 0 or %d",
154+
"write-ahead log file \"%s\" has %zd bytes, should be 0 or %d",
155155
size),
156-
fn,(int)size,WalSegSz);
156+
fn,size,WalSegSz);
157157
pg_free(fn);
158158
return false;
159159
}

‎src/bin/pg_waldump/pg_waldump.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ search_directory(const char *directory, const char *fname)
211211
fatal_error("could not read file \"%s\": %m",
212212
fname);
213213
else
214-
fatal_error("could not read file \"%s\": read %d of %zu",
215-
fname,r,(Size)XLOG_BLCKSZ);
214+
fatal_error("could not read file \"%s\": read %d of %d",
215+
fname,r,XLOG_BLCKSZ);
216216
}
217217
close(fd);
218218
return true;
@@ -369,9 +369,9 @@ WALDumpReadPage(XLogReaderState *state, XLogRecPtr targetPagePtr, int reqLen,
369369
fname,errinfo.wre_off);
370370
}
371371
else
372-
fatal_error("could not read from file %s, offset %u: read %d of %zu",
372+
fatal_error("could not read from file %s, offset %u: read %d of %d",
373373
fname,errinfo.wre_off,errinfo.wre_read,
374-
(Size)errinfo.wre_req);
374+
errinfo.wre_req);
375375
}
376376

377377
returncount;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp