From 09d46d19bc43b8de658347fcde1baebf38d9a3b4 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 4 Dec 2025 12:58:05 +0100 Subject: [PATCH 3/3] Remove useless casts in format arguments There were a number of useless casts in format arguments, either where the input to the cast was already in the right type, or seemingly uselessly casting between types instead of just using the right format placeholder to begin with. --- contrib/amcheck/verify_heapam.c | 72 ++++++++++++------------- src/backend/access/common/printtup.c | 2 +- src/backend/access/rmgrdesc/gindesc.c | 2 +- src/backend/access/transam/xact.c | 6 +-- src/backend/access/transam/xlogreader.c | 26 ++++----- src/backend/commands/copyfromparse.c | 2 +- src/backend/commands/define.c | 2 +- src/backend/libpq/auth.c | 4 +- src/backend/libpq/pqcomm.c | 6 +-- src/backend/libpq/pqmq.c | 2 +- src/backend/parser/parse_type.c | 2 +- src/backend/replication/walreceiver.c | 4 +- src/backend/storage/page/bufpage.c | 4 +- src/backend/utils/adt/format_type.c | 2 +- src/backend/utils/adt/tsvector.c | 6 +-- src/backend/utils/adt/xid.c | 4 +- src/bin/pg_ctl/pg_ctl.c | 25 +++++---- src/bin/pgbench/pgbench.c | 4 +- src/bin/psql/common.c | 2 +- 19 files changed, 88 insertions(+), 89 deletions(-) diff --git a/contrib/amcheck/verify_heapam.c b/contrib/amcheck/verify_heapam.c index 4963e9245cb..b2b30ea6f4d 100644 --- a/contrib/amcheck/verify_heapam.c +++ b/contrib/amcheck/verify_heapam.c @@ -526,17 +526,17 @@ verify_heapam(PG_FUNCTION_ARGS) if (rdoffnum < FirstOffsetNumber) { report_corruption(&ctx, - psprintf("line pointer redirection to item at offset %u precedes minimum offset %u", - (unsigned) rdoffnum, - (unsigned) FirstOffsetNumber)); + psprintf("line pointer redirection to item at offset %d precedes minimum offset %d", + rdoffnum, + FirstOffsetNumber)); continue; } if (rdoffnum > maxoff) { report_corruption(&ctx, - psprintf("line pointer redirection to item at offset %u exceeds maximum offset %u", - (unsigned) rdoffnum, - (unsigned) maxoff)); + psprintf("line pointer redirection to item at offset %d exceeds maximum offset %d", + rdoffnum, + maxoff)); continue; } @@ -550,22 +550,22 @@ verify_heapam(PG_FUNCTION_ARGS) if (!ItemIdIsUsed(rditem)) { report_corruption(&ctx, - psprintf("redirected line pointer points to an unused item at offset %u", - (unsigned) rdoffnum)); + psprintf("redirected line pointer points to an unused item at offset %d", + rdoffnum)); continue; } else if (ItemIdIsDead(rditem)) { report_corruption(&ctx, - psprintf("redirected line pointer points to a dead item at offset %u", - (unsigned) rdoffnum)); + psprintf("redirected line pointer points to a dead item at offset %d", + rdoffnum)); continue; } else if (ItemIdIsRedirected(rditem)) { report_corruption(&ctx, - psprintf("redirected line pointer points to another redirected line pointer at offset %u", - (unsigned) rdoffnum)); + psprintf("redirected line pointer points to another redirected line pointer at offset %d", + rdoffnum)); continue; } @@ -601,10 +601,10 @@ verify_heapam(PG_FUNCTION_ARGS) if (ctx.lp_off + ctx.lp_len > BLCKSZ) { report_corruption(&ctx, - psprintf("line pointer to page offset %u with length %u ends beyond maximum page offset %u", + psprintf("line pointer to page offset %u with length %u ends beyond maximum page offset %d", ctx.lp_off, ctx.lp_len, - (unsigned) BLCKSZ)); + BLCKSZ)); continue; } @@ -678,16 +678,16 @@ verify_heapam(PG_FUNCTION_ARGS) if (!HeapTupleHeaderIsHeapOnly(next_htup)) { report_corruption(&ctx, - psprintf("redirected line pointer points to a non-heap-only tuple at offset %u", - (unsigned) nextoffnum)); + psprintf("redirected line pointer points to a non-heap-only tuple at offset %d", + nextoffnum)); } /* HOT chains should not intersect. */ if (predecessor[nextoffnum] != InvalidOffsetNumber) { report_corruption(&ctx, - psprintf("redirect line pointer points to offset %u, but offset %u also points there", - (unsigned) nextoffnum, (unsigned) predecessor[nextoffnum])); + psprintf("redirect line pointer points to offset %d, but offset %d also points there", + nextoffnum, predecessor[nextoffnum])); continue; } @@ -719,8 +719,8 @@ verify_heapam(PG_FUNCTION_ARGS) if (predecessor[nextoffnum] != InvalidOffsetNumber) { report_corruption(&ctx, - psprintf("tuple points to new version at offset %u, but offset %u also points there", - (unsigned) nextoffnum, (unsigned) predecessor[nextoffnum])); + psprintf("tuple points to new version at offset %d, but offset %d also points there", + nextoffnum, predecessor[nextoffnum])); continue; } @@ -743,15 +743,15 @@ verify_heapam(PG_FUNCTION_ARGS) HeapTupleHeaderIsHeapOnly(next_htup)) { report_corruption(&ctx, - psprintf("non-heap-only update produced a heap-only tuple at offset %u", - (unsigned) nextoffnum)); + psprintf("non-heap-only update produced a heap-only tuple at offset %d", + nextoffnum)); } if ((curr_htup->t_infomask2 & HEAP_HOT_UPDATED) && !HeapTupleHeaderIsHeapOnly(next_htup)) { report_corruption(&ctx, - psprintf("heap-only update produced a non-heap only tuple at offset %u", - (unsigned) nextoffnum)); + psprintf("heap-only update produced a non-heap only tuple at offset %d", + nextoffnum)); } /* @@ -772,10 +772,10 @@ verify_heapam(PG_FUNCTION_ARGS) TransactionIdIsInProgress(curr_xmin)) { report_corruption(&ctx, - psprintf("tuple with in-progress xmin %u was updated to produce a tuple at offset %u with committed xmin %u", - (unsigned) curr_xmin, - (unsigned) ctx.offnum, - (unsigned) next_xmin)); + psprintf("tuple with in-progress xmin %u was updated to produce a tuple at offset %d with committed xmin %u", + curr_xmin, + ctx.offnum, + next_xmin)); } /* @@ -788,16 +788,16 @@ verify_heapam(PG_FUNCTION_ARGS) { if (xmin_commit_status[nextoffnum] == XID_IN_PROGRESS) report_corruption(&ctx, - psprintf("tuple with aborted xmin %u was updated to produce a tuple at offset %u with in-progress xmin %u", - (unsigned) curr_xmin, - (unsigned) ctx.offnum, - (unsigned) next_xmin)); + psprintf("tuple with aborted xmin %u was updated to produce a tuple at offset %d with in-progress xmin %u", + curr_xmin, + ctx.offnum, + next_xmin)); else if (xmin_commit_status[nextoffnum] == XID_COMMITTED) report_corruption(&ctx, - psprintf("tuple with aborted xmin %u was updated to produce a tuple at offset %u with committed xmin %u", - (unsigned) curr_xmin, - (unsigned) ctx.offnum, - (unsigned) next_xmin)); + psprintf("tuple with aborted xmin %u was updated to produce a tuple at offset %d with committed xmin %u", + curr_xmin, + ctx.offnum, + next_xmin)); } } diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c index 9f05e1d15bd..025fe75916f 100644 --- a/src/backend/access/common/printtup.c +++ b/src/backend/access/common/printtup.c @@ -431,7 +431,7 @@ printatt(unsigned attributeId, value != NULL ? " = \"" : "", value != NULL ? value : "", value != NULL ? "\"" : "", - (unsigned int) (attributeP->atttypid), + attributeP->atttypid, attributeP->attlen, attributeP->atttypmod, attributeP->attbyval ? 't' : 'f'); diff --git a/src/backend/access/rmgrdesc/gindesc.c b/src/backend/access/rmgrdesc/gindesc.c index 075c4a0ae93..62e21f8c935 100644 --- a/src/backend/access/rmgrdesc/gindesc.c +++ b/src/backend/access/rmgrdesc/gindesc.c @@ -23,7 +23,7 @@ desc_recompress_leaf(StringInfo buf, ginxlogRecompressDataLeaf *insertData) int i; char *walbuf = ((char *) insertData) + sizeof(ginxlogRecompressDataLeaf); - appendStringInfo(buf, " %d segments:", (int) insertData->nactions); + appendStringInfo(buf, " %d segments:", insertData->nactions); for (i = 0; i < insertData->nactions; i++) { diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 092e197eba3..e48d4b7af6c 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -5709,9 +5709,9 @@ ShowTransactionStateRec(const char *str, TransactionState s) s->name ? s->name : "unnamed", BlockStateAsString(s->blockState), TransStateAsString(s->state), - (unsigned int) XidFromFullTransactionId(s->fullTransactionId), - (unsigned int) s->subTransactionId, - (unsigned int) currentCommandId, + XidFromFullTransactionId(s->fullTransactionId), + s->subTransactionId, + currentCommandId, currentCommandIdUsed ? " (used)" : "", buf.data))); pfree(buf.data); diff --git a/src/backend/access/transam/xlogreader.c b/src/backend/access/transam/xlogreader.c index 9cc7488e892..5e5001b2101 100644 --- a/src/backend/access/transam/xlogreader.c +++ b/src/backend/access/transam/xlogreader.c @@ -1797,8 +1797,8 @@ DecodeXLogRecord(XLogReaderState *state, if (!blk->has_data && blk->data_len != 0) { report_invalid_record(state, - "BKPBLOCK_HAS_DATA not set, but data length is %u at %X/%08X", - (unsigned int) blk->data_len, + "BKPBLOCK_HAS_DATA not set, but data length is %d at %X/%08X", + blk->data_len, LSN_FORMAT_ARGS(state->ReadRecPtr)); goto err; } @@ -1833,10 +1833,10 @@ DecodeXLogRecord(XLogReaderState *state, blk->bimg_len == BLCKSZ)) { report_invalid_record(state, - "BKPIMAGE_HAS_HOLE set, but hole offset %u length %u block image length %u at %X/%08X", - (unsigned int) blk->hole_offset, - (unsigned int) blk->hole_length, - (unsigned int) blk->bimg_len, + "BKPIMAGE_HAS_HOLE set, but hole offset %d length %d block image length %d at %X/%08X", + blk->hole_offset, + blk->hole_length, + blk->bimg_len, LSN_FORMAT_ARGS(state->ReadRecPtr)); goto err; } @@ -1849,9 +1849,9 @@ DecodeXLogRecord(XLogReaderState *state, (blk->hole_offset != 0 || blk->hole_length != 0)) { report_invalid_record(state, - "BKPIMAGE_HAS_HOLE not set, but hole offset %u length %u at %X/%08X", - (unsigned int) blk->hole_offset, - (unsigned int) blk->hole_length, + "BKPIMAGE_HAS_HOLE not set, but hole offset %d length %d at %X/%08X", + blk->hole_offset, + blk->hole_length, LSN_FORMAT_ARGS(state->ReadRecPtr)); goto err; } @@ -1863,8 +1863,8 @@ DecodeXLogRecord(XLogReaderState *state, blk->bimg_len == BLCKSZ) { report_invalid_record(state, - "BKPIMAGE_COMPRESSED set, but block image length %u at %X/%08X", - (unsigned int) blk->bimg_len, + "BKPIMAGE_COMPRESSED set, but block image length %d at %X/%08X", + blk->bimg_len, LSN_FORMAT_ARGS(state->ReadRecPtr)); goto err; } @@ -1878,8 +1878,8 @@ DecodeXLogRecord(XLogReaderState *state, blk->bimg_len != BLCKSZ) { report_invalid_record(state, - "neither BKPIMAGE_HAS_HOLE nor BKPIMAGE_COMPRESSED set, but block image length is %u at %X/%08X", - (unsigned int) blk->data_len, + "neither BKPIMAGE_HAS_HOLE nor BKPIMAGE_COMPRESSED set, but block image length is %d at %X/%08X", + blk->data_len, LSN_FORMAT_ARGS(state->ReadRecPtr)); goto err; } diff --git a/src/backend/commands/copyfromparse.c b/src/backend/commands/copyfromparse.c index a09e7fbace3..62afcd8fad1 100644 --- a/src/backend/commands/copyfromparse.c +++ b/src/backend/commands/copyfromparse.c @@ -1136,7 +1136,7 @@ CopyFromBinaryOneRow(CopyFromState cstate, ExprContext *econtext, Datum *values, ereport(ERROR, (errcode(ERRCODE_BAD_COPY_FILE_FORMAT), errmsg("row field count is %d, expected %d", - (int) fld_count, attr_count))); + fld_count, attr_count))); foreach(cur, cstate->attnumlist) { diff --git a/src/backend/commands/define.c b/src/backend/commands/define.c index 5e1b867e6f7..3e238c414f7 100644 --- a/src/backend/commands/define.c +++ b/src/backend/commands/define.c @@ -42,7 +42,7 @@ defGetString(DefElem *def) switch (nodeTag(def->arg)) { case T_Integer: - return psprintf("%ld", (long) intVal(def->arg)); + return psprintf("%d", intVal(def->arg)); case T_Float: return castNode(Float, def->arg)->fval; case T_Boolean: diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c index a9181cde87b..8045dbffe04 100644 --- a/src/backend/libpq/auth.c +++ b/src/backend/libpq/auth.c @@ -2240,8 +2240,8 @@ InitializeLDAPConnection(Port *port, LDAP **ldap) if (!*ldap) { ereport(LOG, - (errmsg("could not initialize LDAP: error code %d", - (int) LdapGetLastError()))); + (errmsg("could not initialize LDAP: error code %lu", + LdapGetLastError()))); return STATUS_ERROR; } diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c index 77b62edafb7..40b180644eb 100644 --- a/src/backend/libpq/pqcomm.c +++ b/src/backend/libpq/pqcomm.c @@ -618,10 +618,10 @@ ListenServerPort(int family, const char *hostName, unsigned short portNumber, saved_errno == EADDRINUSE ? (addr->ai_family == AF_UNIX ? errhint("Is another postmaster already running on port %d?", - (int) portNumber) : + portNumber) : errhint("Is another postmaster already running on port %d?" " If not, wait a few seconds and retry.", - (int) portNumber)) : 0)); + portNumber)) : 0)); closesocket(fd); continue; } @@ -662,7 +662,7 @@ ListenServerPort(int family, const char *hostName, unsigned short portNumber, ereport(LOG, /* translator: first %s is IPv4 or IPv6 */ (errmsg("listening on %s address \"%s\", port %d", - familyDesc, addrDesc, (int) portNumber))); + familyDesc, addrDesc, portNumber))); ListenSockets[*NumListenSockets] = fd; (*NumListenSockets)++; diff --git a/src/backend/libpq/pqmq.c b/src/backend/libpq/pqmq.c index 5f39949a367..2b75de0ddef 100644 --- a/src/backend/libpq/pqmq.c +++ b/src/backend/libpq/pqmq.c @@ -329,7 +329,7 @@ pq_parse_errornotice(StringInfo msg, ErrorData *edata) edata->funcname = pstrdup(value); break; default: - elog(ERROR, "unrecognized error field code: %d", (int) code); + elog(ERROR, "unrecognized error field code: %d", code); break; } } diff --git a/src/backend/parser/parse_type.c b/src/backend/parser/parse_type.c index 7713bdc6af0..e07d65fc25b 100644 --- a/src/backend/parser/parse_type.c +++ b/src/backend/parser/parse_type.c @@ -382,7 +382,7 @@ typenameTypeMod(ParseState *pstate, const TypeName *typeName, Type typ) if (IsA(&ac->val, Integer)) { - cstr = psprintf("%ld", (long) intVal(&ac->val)); + cstr = psprintf("%d", intVal(&ac->val)); } else if (IsA(&ac->val, Float)) { diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c index 4217fc54e2e..3a94c9683a7 100644 --- a/src/backend/replication/walreceiver.c +++ b/src/backend/replication/walreceiver.c @@ -949,8 +949,8 @@ XLogWalRcvWrite(char *buf, Size nbytes, XLogRecPtr recptr, TimeLineID tli) ereport(PANIC, (errcode_for_file_access(), errmsg("could not write to WAL segment %s " - "at offset %d, length %lu: %m", - xlogfname, startoff, (unsigned long) segbytes))); + "at offset %d, length %d: %m", + xlogfname, startoff, segbytes))); } /* Update state for write */ diff --git a/src/backend/storage/page/bufpage.c b/src/backend/storage/page/bufpage.c index 91c8e758b19..05376431ef2 100644 --- a/src/backend/storage/page/bufpage.c +++ b/src/backend/storage/page/bufpage.c @@ -1438,8 +1438,8 @@ PageIndexTupleOverwrite(Page page, OffsetNumber offnum, offset != MAXALIGN(offset)) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), - errmsg("corrupted line pointer: offset = %u, size = %u", - offset, (unsigned int) oldsize))); + errmsg("corrupted line pointer: offset = %u, size = %d", + offset, oldsize))); /* * Determine actual change in space requirement, check for page overflow. diff --git a/src/backend/utils/adt/format_type.c b/src/backend/utils/adt/format_type.c index 9948c26e76c..0afd1cb3563 100644 --- a/src/backend/utils/adt/format_type.c +++ b/src/backend/utils/adt/format_type.c @@ -378,7 +378,7 @@ printTypmod(const char *typname, int32 typmod, Oid typmodout) if (typmodout == InvalidOid) { /* Default behavior: just print the integer typmod with parens */ - res = psprintf("%s(%d)", typname, (int) typmod); + res = psprintf("%s(%d)", typname, typmod); } else { diff --git a/src/backend/utils/adt/tsvector.c b/src/backend/utils/adt/tsvector.c index 1fa2e3729bf..f568f1fce99 100644 --- a/src/backend/utils/adt/tsvector.c +++ b/src/backend/utils/adt/tsvector.c @@ -210,9 +210,9 @@ tsvectorin(PG_FUNCTION_ARGS) if (toklen >= MAXSTRLEN) ereturn(escontext, (Datum) 0, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("word is too long (%ld bytes, max %ld bytes)", - (long) toklen, - (long) (MAXSTRLEN - 1)))); + errmsg("word is too long (%d bytes, max %d bytes)", + toklen, + MAXSTRLEN - 1))); if (cur - tmpbuf > MAXSTRPOS) ereturn(escontext, (Datum) 0, diff --git a/src/backend/utils/adt/xid.c b/src/backend/utils/adt/xid.c index 3d0c48769cc..8a6e0390709 100644 --- a/src/backend/utils/adt/xid.c +++ b/src/backend/utils/adt/xid.c @@ -45,7 +45,7 @@ xidout(PG_FUNCTION_ARGS) TransactionId transactionId = PG_GETARG_TRANSACTIONID(0); char *result = (char *) palloc(16); - snprintf(result, 16, "%lu", (unsigned long) transactionId); + snprintf(result, 16, "%u", transactionId); PG_RETURN_CSTRING(result); } @@ -362,7 +362,7 @@ cidout(PG_FUNCTION_ARGS) CommandId c = PG_GETARG_COMMANDID(0); char *result = (char *) palloc(16); - snprintf(result, 16, "%lu", (unsigned long) c); + snprintf(result, 16, "%u", c); PG_RETURN_CSTRING(result); } diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c index 4f666d91036..dfe7b4d2f9e 100644 --- a/src/bin/pg_ctl/pg_ctl.c +++ b/src/bin/pg_ctl/pg_ctl.c @@ -564,7 +564,7 @@ start_postmaster(void) if (!CreateRestrictedProcess(cmd, &pi, false)) { write_stderr(_("%s: could not start server: error code %lu\n"), - progname, (unsigned long) GetLastError()); + progname, GetLastError()); exit(1); } /* Don't close command process handle here; caller must do so */ @@ -1537,7 +1537,7 @@ pgwin32_doRegister(void) CloseServiceHandle(hSCM); write_stderr(_("%s: could not register service \"%s\": error code %lu\n"), progname, register_servicename, - (unsigned long) GetLastError()); + GetLastError()); exit(1); } CloseServiceHandle(hService); @@ -1567,7 +1567,7 @@ pgwin32_doUnregister(void) CloseServiceHandle(hSCM); write_stderr(_("%s: could not open service \"%s\": error code %lu\n"), progname, register_servicename, - (unsigned long) GetLastError()); + GetLastError()); exit(1); } if (!DeleteService(hService)) @@ -1576,7 +1576,7 @@ pgwin32_doUnregister(void) CloseServiceHandle(hSCM); write_stderr(_("%s: could not unregister service \"%s\": error code %lu\n"), progname, register_servicename, - (unsigned long) GetLastError()); + GetLastError()); exit(1); } CloseServiceHandle(hService); @@ -1725,7 +1725,7 @@ pgwin32_doRunAsService(void) { write_stderr(_("%s: could not start service \"%s\": error code %lu\n"), progname, register_servicename, - (unsigned long) GetLastError()); + GetLastError()); exit(1); } } @@ -1797,7 +1797,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser * it doesn't cast DWORD before printing. */ write_stderr(_("%s: could not open process token: error code %lu\n"), - progname, (unsigned long) GetLastError()); + progname, GetLastError()); return 0; } @@ -1811,7 +1811,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser 0, &dropSids[1].Sid)) { write_stderr(_("%s: could not allocate SIDs: error code %lu\n"), - progname, (unsigned long) GetLastError()); + progname, GetLastError()); return 0; } @@ -1837,7 +1837,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser if (!b) { write_stderr(_("%s: could not create restricted token: error code %lu\n"), - progname, (unsigned long) GetLastError()); + progname, GetLastError()); return 0; } @@ -1856,8 +1856,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser HANDLE job; char jobname[128]; - sprintf(jobname, "PostgreSQL_%lu", - (unsigned long) processInfo->dwProcessId); + sprintf(jobname, "PostgreSQL_%lu", processInfo->dwProcessId); job = CreateJobObject(NULL, jobname); if (job) @@ -1919,7 +1918,7 @@ GetPrivilegesToDelete(HANDLE hToken) !LookupPrivilegeValue(NULL, SE_CHANGE_NOTIFY_NAME, &luidChangeNotify)) { write_stderr(_("%s: could not get LUIDs for privileges: error code %lu\n"), - progname, (unsigned long) GetLastError()); + progname, GetLastError()); return NULL; } @@ -1927,7 +1926,7 @@ GetPrivilegesToDelete(HANDLE hToken) GetLastError() != ERROR_INSUFFICIENT_BUFFER) { write_stderr(_("%s: could not get token information: error code %lu\n"), - progname, (unsigned long) GetLastError()); + progname, GetLastError()); return NULL; } @@ -1942,7 +1941,7 @@ GetPrivilegesToDelete(HANDLE hToken) if (!GetTokenInformation(hToken, TokenPrivileges, tokenPrivs, length, &length)) { write_stderr(_("%s: could not get token information: error code %lu\n"), - progname, (unsigned long) GetLastError()); + progname, GetLastError()); free(tokenPrivs); return NULL; } diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index 68774a59efd..188f24df7a6 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -6274,8 +6274,8 @@ parseScriptWeight(const char *option, char **script) if (errno != 0 || badp == sep + 1 || *badp != '\0') pg_fatal("invalid weight specification: %s", sep); if (wtmp > INT_MAX || wtmp < 0) - pg_fatal("weight specification out of range (0 .. %d): %lld", - INT_MAX, (long long) wtmp); + pg_fatal("weight specification out of range (0 .. %d): %ld", + INT_MAX, wtmp); weight = wtmp; } else diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index cd329ade12b..1a28ba6c02b 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1021,7 +1021,7 @@ PrintQueryStatus(PGresult *result, FILE *printQueryFout) if (pset.logfile) fprintf(pset.logfile, "%s\n", cmdstatus); - snprintf(buf, sizeof(buf), "%u", (unsigned int) PQoidValue(result)); + snprintf(buf, sizeof(buf), "%u", PQoidValue(result)); SetVariable(pset.vars, "LASTOID", buf); } -- 2.52.0