1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-10 14:22:35 +03:00

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.

Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/07fa29f9-42d7-4aac-8834-197918cbbab6%40eisentraut.org
This commit is contained in:
Peter Eisentraut
2025-12-09 06:58:39 +01:00
parent 907caf5c39
commit 2268f2b91b
19 changed files with 88 additions and 89 deletions

View File

@@ -526,17 +526,17 @@ verify_heapam(PG_FUNCTION_ARGS)
if (rdoffnum < FirstOffsetNumber) if (rdoffnum < FirstOffsetNumber)
{ {
report_corruption(&ctx, report_corruption(&ctx,
psprintf("line pointer redirection to item at offset %u precedes minimum offset %u", psprintf("line pointer redirection to item at offset %d precedes minimum offset %d",
(unsigned) rdoffnum, rdoffnum,
(unsigned) FirstOffsetNumber)); FirstOffsetNumber));
continue; continue;
} }
if (rdoffnum > maxoff) if (rdoffnum > maxoff)
{ {
report_corruption(&ctx, report_corruption(&ctx,
psprintf("line pointer redirection to item at offset %u exceeds maximum offset %u", psprintf("line pointer redirection to item at offset %d exceeds maximum offset %d",
(unsigned) rdoffnum, rdoffnum,
(unsigned) maxoff)); maxoff));
continue; continue;
} }
@@ -550,22 +550,22 @@ verify_heapam(PG_FUNCTION_ARGS)
if (!ItemIdIsUsed(rditem)) if (!ItemIdIsUsed(rditem))
{ {
report_corruption(&ctx, report_corruption(&ctx,
psprintf("redirected line pointer points to an unused item at offset %u", psprintf("redirected line pointer points to an unused item at offset %d",
(unsigned) rdoffnum)); rdoffnum));
continue; continue;
} }
else if (ItemIdIsDead(rditem)) else if (ItemIdIsDead(rditem))
{ {
report_corruption(&ctx, report_corruption(&ctx,
psprintf("redirected line pointer points to a dead item at offset %u", psprintf("redirected line pointer points to a dead item at offset %d",
(unsigned) rdoffnum)); rdoffnum));
continue; continue;
} }
else if (ItemIdIsRedirected(rditem)) else if (ItemIdIsRedirected(rditem))
{ {
report_corruption(&ctx, report_corruption(&ctx,
psprintf("redirected line pointer points to another redirected line pointer at offset %u", psprintf("redirected line pointer points to another redirected line pointer at offset %d",
(unsigned) rdoffnum)); rdoffnum));
continue; continue;
} }
@@ -601,10 +601,10 @@ verify_heapam(PG_FUNCTION_ARGS)
if (ctx.lp_off + ctx.lp_len > BLCKSZ) if (ctx.lp_off + ctx.lp_len > BLCKSZ)
{ {
report_corruption(&ctx, 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_off,
ctx.lp_len, ctx.lp_len,
(unsigned) BLCKSZ)); BLCKSZ));
continue; continue;
} }
@@ -678,16 +678,16 @@ verify_heapam(PG_FUNCTION_ARGS)
if (!HeapTupleHeaderIsHeapOnly(next_htup)) if (!HeapTupleHeaderIsHeapOnly(next_htup))
{ {
report_corruption(&ctx, report_corruption(&ctx,
psprintf("redirected line pointer points to a non-heap-only tuple at offset %u", psprintf("redirected line pointer points to a non-heap-only tuple at offset %d",
(unsigned) nextoffnum)); nextoffnum));
} }
/* HOT chains should not intersect. */ /* HOT chains should not intersect. */
if (predecessor[nextoffnum] != InvalidOffsetNumber) if (predecessor[nextoffnum] != InvalidOffsetNumber)
{ {
report_corruption(&ctx, report_corruption(&ctx,
psprintf("redirect line pointer points to offset %u, but offset %u also points there", psprintf("redirect line pointer points to offset %d, but offset %d also points there",
(unsigned) nextoffnum, (unsigned) predecessor[nextoffnum])); nextoffnum, predecessor[nextoffnum]));
continue; continue;
} }
@@ -719,8 +719,8 @@ verify_heapam(PG_FUNCTION_ARGS)
if (predecessor[nextoffnum] != InvalidOffsetNumber) if (predecessor[nextoffnum] != InvalidOffsetNumber)
{ {
report_corruption(&ctx, report_corruption(&ctx,
psprintf("tuple points to new version at offset %u, but offset %u also points there", psprintf("tuple points to new version at offset %d, but offset %d also points there",
(unsigned) nextoffnum, (unsigned) predecessor[nextoffnum])); nextoffnum, predecessor[nextoffnum]));
continue; continue;
} }
@@ -743,15 +743,15 @@ verify_heapam(PG_FUNCTION_ARGS)
HeapTupleHeaderIsHeapOnly(next_htup)) HeapTupleHeaderIsHeapOnly(next_htup))
{ {
report_corruption(&ctx, report_corruption(&ctx,
psprintf("non-heap-only update produced a heap-only tuple at offset %u", psprintf("non-heap-only update produced a heap-only tuple at offset %d",
(unsigned) nextoffnum)); nextoffnum));
} }
if ((curr_htup->t_infomask2 & HEAP_HOT_UPDATED) && if ((curr_htup->t_infomask2 & HEAP_HOT_UPDATED) &&
!HeapTupleHeaderIsHeapOnly(next_htup)) !HeapTupleHeaderIsHeapOnly(next_htup))
{ {
report_corruption(&ctx, report_corruption(&ctx,
psprintf("heap-only update produced a non-heap only tuple at offset %u", psprintf("heap-only update produced a non-heap only tuple at offset %d",
(unsigned) nextoffnum)); nextoffnum));
} }
/* /*
@@ -772,10 +772,10 @@ verify_heapam(PG_FUNCTION_ARGS)
TransactionIdIsInProgress(curr_xmin)) TransactionIdIsInProgress(curr_xmin))
{ {
report_corruption(&ctx, report_corruption(&ctx,
psprintf("tuple with in-progress xmin %u was updated to produce a tuple at offset %u with committed xmin %u", psprintf("tuple with in-progress xmin %u was updated to produce a tuple at offset %d with committed xmin %u",
(unsigned) curr_xmin, curr_xmin,
(unsigned) ctx.offnum, ctx.offnum,
(unsigned) next_xmin)); next_xmin));
} }
/* /*
@@ -788,16 +788,16 @@ verify_heapam(PG_FUNCTION_ARGS)
{ {
if (xmin_commit_status[nextoffnum] == XID_IN_PROGRESS) if (xmin_commit_status[nextoffnum] == XID_IN_PROGRESS)
report_corruption(&ctx, report_corruption(&ctx,
psprintf("tuple with aborted xmin %u was updated to produce a tuple at offset %u with in-progress xmin %u", psprintf("tuple with aborted xmin %u was updated to produce a tuple at offset %d with in-progress xmin %u",
(unsigned) curr_xmin, curr_xmin,
(unsigned) ctx.offnum, ctx.offnum,
(unsigned) next_xmin)); next_xmin));
else if (xmin_commit_status[nextoffnum] == XID_COMMITTED) else if (xmin_commit_status[nextoffnum] == XID_COMMITTED)
report_corruption(&ctx, report_corruption(&ctx,
psprintf("tuple with aborted xmin %u was updated to produce a tuple at offset %u with committed xmin %u", psprintf("tuple with aborted xmin %u was updated to produce a tuple at offset %d with committed xmin %u",
(unsigned) curr_xmin, curr_xmin,
(unsigned) ctx.offnum, ctx.offnum,
(unsigned) next_xmin)); next_xmin));
} }
} }

View File

@@ -431,7 +431,7 @@ printatt(unsigned attributeId,
value != NULL ? " = \"" : "", value != NULL ? " = \"" : "",
value != NULL ? value : "", value != NULL ? value : "",
value != NULL ? "\"" : "", value != NULL ? "\"" : "",
(unsigned int) (attributeP->atttypid), attributeP->atttypid,
attributeP->attlen, attributeP->attlen,
attributeP->atttypmod, attributeP->atttypmod,
attributeP->attbyval ? 't' : 'f'); attributeP->attbyval ? 't' : 'f');

View File

@@ -23,7 +23,7 @@ desc_recompress_leaf(StringInfo buf, ginxlogRecompressDataLeaf *insertData)
int i; int i;
char *walbuf = ((char *) insertData) + sizeof(ginxlogRecompressDataLeaf); 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++) for (i = 0; i < insertData->nactions; i++)
{ {

View File

@@ -5709,9 +5709,9 @@ ShowTransactionStateRec(const char *str, TransactionState s)
s->name ? s->name : "unnamed", s->name ? s->name : "unnamed",
BlockStateAsString(s->blockState), BlockStateAsString(s->blockState),
TransStateAsString(s->state), TransStateAsString(s->state),
(unsigned int) XidFromFullTransactionId(s->fullTransactionId), XidFromFullTransactionId(s->fullTransactionId),
(unsigned int) s->subTransactionId, s->subTransactionId,
(unsigned int) currentCommandId, currentCommandId,
currentCommandIdUsed ? " (used)" : "", currentCommandIdUsed ? " (used)" : "",
buf.data))); buf.data)));
pfree(buf.data); pfree(buf.data);

View File

@@ -1797,8 +1797,8 @@ DecodeXLogRecord(XLogReaderState *state,
if (!blk->has_data && blk->data_len != 0) if (!blk->has_data && blk->data_len != 0)
{ {
report_invalid_record(state, report_invalid_record(state,
"BKPBLOCK_HAS_DATA not set, but data length is %u at %X/%08X", "BKPBLOCK_HAS_DATA not set, but data length is %d at %X/%08X",
(unsigned int) blk->data_len, blk->data_len,
LSN_FORMAT_ARGS(state->ReadRecPtr)); LSN_FORMAT_ARGS(state->ReadRecPtr));
goto err; goto err;
} }
@@ -1833,10 +1833,10 @@ DecodeXLogRecord(XLogReaderState *state,
blk->bimg_len == BLCKSZ)) blk->bimg_len == BLCKSZ))
{ {
report_invalid_record(state, report_invalid_record(state,
"BKPIMAGE_HAS_HOLE set, but hole offset %u length %u block image length %u at %X/%08X", "BKPIMAGE_HAS_HOLE set, but hole offset %d length %d block image length %d at %X/%08X",
(unsigned int) blk->hole_offset, blk->hole_offset,
(unsigned int) blk->hole_length, blk->hole_length,
(unsigned int) blk->bimg_len, blk->bimg_len,
LSN_FORMAT_ARGS(state->ReadRecPtr)); LSN_FORMAT_ARGS(state->ReadRecPtr));
goto err; goto err;
} }
@@ -1849,9 +1849,9 @@ DecodeXLogRecord(XLogReaderState *state,
(blk->hole_offset != 0 || blk->hole_length != 0)) (blk->hole_offset != 0 || blk->hole_length != 0))
{ {
report_invalid_record(state, report_invalid_record(state,
"BKPIMAGE_HAS_HOLE not set, but hole offset %u length %u at %X/%08X", "BKPIMAGE_HAS_HOLE not set, but hole offset %d length %d at %X/%08X",
(unsigned int) blk->hole_offset, blk->hole_offset,
(unsigned int) blk->hole_length, blk->hole_length,
LSN_FORMAT_ARGS(state->ReadRecPtr)); LSN_FORMAT_ARGS(state->ReadRecPtr));
goto err; goto err;
} }
@@ -1863,8 +1863,8 @@ DecodeXLogRecord(XLogReaderState *state,
blk->bimg_len == BLCKSZ) blk->bimg_len == BLCKSZ)
{ {
report_invalid_record(state, report_invalid_record(state,
"BKPIMAGE_COMPRESSED set, but block image length %u at %X/%08X", "BKPIMAGE_COMPRESSED set, but block image length %d at %X/%08X",
(unsigned int) blk->bimg_len, blk->bimg_len,
LSN_FORMAT_ARGS(state->ReadRecPtr)); LSN_FORMAT_ARGS(state->ReadRecPtr));
goto err; goto err;
} }
@@ -1878,8 +1878,8 @@ DecodeXLogRecord(XLogReaderState *state,
blk->bimg_len != BLCKSZ) blk->bimg_len != BLCKSZ)
{ {
report_invalid_record(state, report_invalid_record(state,
"neither BKPIMAGE_HAS_HOLE nor BKPIMAGE_COMPRESSED set, but block image length is %u at %X/%08X", "neither BKPIMAGE_HAS_HOLE nor BKPIMAGE_COMPRESSED set, but block image length is %d at %X/%08X",
(unsigned int) blk->data_len, blk->data_len,
LSN_FORMAT_ARGS(state->ReadRecPtr)); LSN_FORMAT_ARGS(state->ReadRecPtr));
goto err; goto err;
} }

View File

@@ -1136,7 +1136,7 @@ CopyFromBinaryOneRow(CopyFromState cstate, ExprContext *econtext, Datum *values,
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT), (errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("row field count is %d, expected %d", errmsg("row field count is %d, expected %d",
(int) fld_count, attr_count))); fld_count, attr_count)));
foreach(cur, cstate->attnumlist) foreach(cur, cstate->attnumlist)
{ {

View File

@@ -42,7 +42,7 @@ defGetString(DefElem *def)
switch (nodeTag(def->arg)) switch (nodeTag(def->arg))
{ {
case T_Integer: case T_Integer:
return psprintf("%ld", (long) intVal(def->arg)); return psprintf("%d", intVal(def->arg));
case T_Float: case T_Float:
return castNode(Float, def->arg)->fval; return castNode(Float, def->arg)->fval;
case T_Boolean: case T_Boolean:

View File

@@ -2240,8 +2240,8 @@ InitializeLDAPConnection(Port *port, LDAP **ldap)
if (!*ldap) if (!*ldap)
{ {
ereport(LOG, ereport(LOG,
(errmsg("could not initialize LDAP: error code %d", (errmsg("could not initialize LDAP: error code %lu",
(int) LdapGetLastError()))); LdapGetLastError())));
return STATUS_ERROR; return STATUS_ERROR;
} }

View File

@@ -618,10 +618,10 @@ ListenServerPort(int family, const char *hostName, unsigned short portNumber,
saved_errno == EADDRINUSE ? saved_errno == EADDRINUSE ?
(addr->ai_family == AF_UNIX ? (addr->ai_family == AF_UNIX ?
errhint("Is another postmaster already running on port %d?", errhint("Is another postmaster already running on port %d?",
(int) portNumber) : portNumber) :
errhint("Is another postmaster already running on port %d?" errhint("Is another postmaster already running on port %d?"
" If not, wait a few seconds and retry.", " If not, wait a few seconds and retry.",
(int) portNumber)) : 0)); portNumber)) : 0));
closesocket(fd); closesocket(fd);
continue; continue;
} }
@@ -662,7 +662,7 @@ ListenServerPort(int family, const char *hostName, unsigned short portNumber,
ereport(LOG, ereport(LOG,
/* translator: first %s is IPv4 or IPv6 */ /* translator: first %s is IPv4 or IPv6 */
(errmsg("listening on %s address \"%s\", port %d", (errmsg("listening on %s address \"%s\", port %d",
familyDesc, addrDesc, (int) portNumber))); familyDesc, addrDesc, portNumber)));
ListenSockets[*NumListenSockets] = fd; ListenSockets[*NumListenSockets] = fd;
(*NumListenSockets)++; (*NumListenSockets)++;

View File

@@ -329,7 +329,7 @@ pq_parse_errornotice(StringInfo msg, ErrorData *edata)
edata->funcname = pstrdup(value); edata->funcname = pstrdup(value);
break; break;
default: default:
elog(ERROR, "unrecognized error field code: %d", (int) code); elog(ERROR, "unrecognized error field code: %d", code);
break; break;
} }
} }

View File

@@ -382,7 +382,7 @@ typenameTypeMod(ParseState *pstate, const TypeName *typeName, Type typ)
if (IsA(&ac->val, Integer)) if (IsA(&ac->val, Integer))
{ {
cstr = psprintf("%ld", (long) intVal(&ac->val)); cstr = psprintf("%d", intVal(&ac->val));
} }
else if (IsA(&ac->val, Float)) else if (IsA(&ac->val, Float))
{ {

View File

@@ -949,8 +949,8 @@ XLogWalRcvWrite(char *buf, Size nbytes, XLogRecPtr recptr, TimeLineID tli)
ereport(PANIC, ereport(PANIC,
(errcode_for_file_access(), (errcode_for_file_access(),
errmsg("could not write to WAL segment %s " errmsg("could not write to WAL segment %s "
"at offset %d, length %lu: %m", "at offset %d, length %d: %m",
xlogfname, startoff, (unsigned long) segbytes))); xlogfname, startoff, segbytes)));
} }
/* Update state for write */ /* Update state for write */

View File

@@ -1438,8 +1438,8 @@ PageIndexTupleOverwrite(Page page, OffsetNumber offnum,
offset != MAXALIGN(offset)) offset != MAXALIGN(offset))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED), (errcode(ERRCODE_DATA_CORRUPTED),
errmsg("corrupted line pointer: offset = %u, size = %u", errmsg("corrupted line pointer: offset = %u, size = %d",
offset, (unsigned int) oldsize))); offset, oldsize)));
/* /*
* Determine actual change in space requirement, check for page overflow. * Determine actual change in space requirement, check for page overflow.

View File

@@ -378,7 +378,7 @@ printTypmod(const char *typname, int32 typmod, Oid typmodout)
if (typmodout == InvalidOid) if (typmodout == InvalidOid)
{ {
/* Default behavior: just print the integer typmod with parens */ /* Default behavior: just print the integer typmod with parens */
res = psprintf("%s(%d)", typname, (int) typmod); res = psprintf("%s(%d)", typname, typmod);
} }
else else
{ {

View File

@@ -210,9 +210,9 @@ tsvectorin(PG_FUNCTION_ARGS)
if (toklen >= MAXSTRLEN) if (toklen >= MAXSTRLEN)
ereturn(escontext, (Datum) 0, ereturn(escontext, (Datum) 0,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("word is too long (%ld bytes, max %ld bytes)", errmsg("word is too long (%d bytes, max %d bytes)",
(long) toklen, toklen,
(long) (MAXSTRLEN - 1)))); MAXSTRLEN - 1)));
if (cur - tmpbuf > MAXSTRPOS) if (cur - tmpbuf > MAXSTRPOS)
ereturn(escontext, (Datum) 0, ereturn(escontext, (Datum) 0,

View File

@@ -45,7 +45,7 @@ xidout(PG_FUNCTION_ARGS)
TransactionId transactionId = PG_GETARG_TRANSACTIONID(0); TransactionId transactionId = PG_GETARG_TRANSACTIONID(0);
char *result = (char *) palloc(16); char *result = (char *) palloc(16);
snprintf(result, 16, "%lu", (unsigned long) transactionId); snprintf(result, 16, "%u", transactionId);
PG_RETURN_CSTRING(result); PG_RETURN_CSTRING(result);
} }
@@ -362,7 +362,7 @@ cidout(PG_FUNCTION_ARGS)
CommandId c = PG_GETARG_COMMANDID(0); CommandId c = PG_GETARG_COMMANDID(0);
char *result = (char *) palloc(16); char *result = (char *) palloc(16);
snprintf(result, 16, "%lu", (unsigned long) c); snprintf(result, 16, "%u", c);
PG_RETURN_CSTRING(result); PG_RETURN_CSTRING(result);
} }

View File

@@ -564,7 +564,7 @@ start_postmaster(void)
if (!CreateRestrictedProcess(cmd, &pi, false)) if (!CreateRestrictedProcess(cmd, &pi, false))
{ {
write_stderr(_("%s: could not start server: error code %lu\n"), write_stderr(_("%s: could not start server: error code %lu\n"),
progname, (unsigned long) GetLastError()); progname, GetLastError());
exit(1); exit(1);
} }
/* Don't close command process handle here; caller must do so */ /* Don't close command process handle here; caller must do so */
@@ -1537,7 +1537,7 @@ pgwin32_doRegister(void)
CloseServiceHandle(hSCM); CloseServiceHandle(hSCM);
write_stderr(_("%s: could not register service \"%s\": error code %lu\n"), write_stderr(_("%s: could not register service \"%s\": error code %lu\n"),
progname, register_servicename, progname, register_servicename,
(unsigned long) GetLastError()); GetLastError());
exit(1); exit(1);
} }
CloseServiceHandle(hService); CloseServiceHandle(hService);
@@ -1567,7 +1567,7 @@ pgwin32_doUnregister(void)
CloseServiceHandle(hSCM); CloseServiceHandle(hSCM);
write_stderr(_("%s: could not open service \"%s\": error code %lu\n"), write_stderr(_("%s: could not open service \"%s\": error code %lu\n"),
progname, register_servicename, progname, register_servicename,
(unsigned long) GetLastError()); GetLastError());
exit(1); exit(1);
} }
if (!DeleteService(hService)) if (!DeleteService(hService))
@@ -1576,7 +1576,7 @@ pgwin32_doUnregister(void)
CloseServiceHandle(hSCM); CloseServiceHandle(hSCM);
write_stderr(_("%s: could not unregister service \"%s\": error code %lu\n"), write_stderr(_("%s: could not unregister service \"%s\": error code %lu\n"),
progname, register_servicename, progname, register_servicename,
(unsigned long) GetLastError()); GetLastError());
exit(1); exit(1);
} }
CloseServiceHandle(hService); CloseServiceHandle(hService);
@@ -1725,7 +1725,7 @@ pgwin32_doRunAsService(void)
{ {
write_stderr(_("%s: could not start service \"%s\": error code %lu\n"), write_stderr(_("%s: could not start service \"%s\": error code %lu\n"),
progname, register_servicename, progname, register_servicename,
(unsigned long) GetLastError()); GetLastError());
exit(1); exit(1);
} }
} }
@@ -1797,7 +1797,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser
* it doesn't cast DWORD before printing. * it doesn't cast DWORD before printing.
*/ */
write_stderr(_("%s: could not open process token: error code %lu\n"), write_stderr(_("%s: could not open process token: error code %lu\n"),
progname, (unsigned long) GetLastError()); progname, GetLastError());
return 0; return 0;
} }
@@ -1811,7 +1811,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser
0, &dropSids[1].Sid)) 0, &dropSids[1].Sid))
{ {
write_stderr(_("%s: could not allocate SIDs: error code %lu\n"), write_stderr(_("%s: could not allocate SIDs: error code %lu\n"),
progname, (unsigned long) GetLastError()); progname, GetLastError());
return 0; return 0;
} }
@@ -1837,7 +1837,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser
if (!b) if (!b)
{ {
write_stderr(_("%s: could not create restricted token: error code %lu\n"), write_stderr(_("%s: could not create restricted token: error code %lu\n"),
progname, (unsigned long) GetLastError()); progname, GetLastError());
return 0; return 0;
} }
@@ -1856,8 +1856,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser
HANDLE job; HANDLE job;
char jobname[128]; char jobname[128];
sprintf(jobname, "PostgreSQL_%lu", sprintf(jobname, "PostgreSQL_%lu", processInfo->dwProcessId);
(unsigned long) processInfo->dwProcessId);
job = CreateJobObject(NULL, jobname); job = CreateJobObject(NULL, jobname);
if (job) if (job)
@@ -1919,7 +1918,7 @@ GetPrivilegesToDelete(HANDLE hToken)
!LookupPrivilegeValue(NULL, SE_CHANGE_NOTIFY_NAME, &luidChangeNotify)) !LookupPrivilegeValue(NULL, SE_CHANGE_NOTIFY_NAME, &luidChangeNotify))
{ {
write_stderr(_("%s: could not get LUIDs for privileges: error code %lu\n"), write_stderr(_("%s: could not get LUIDs for privileges: error code %lu\n"),
progname, (unsigned long) GetLastError()); progname, GetLastError());
return NULL; return NULL;
} }
@@ -1927,7 +1926,7 @@ GetPrivilegesToDelete(HANDLE hToken)
GetLastError() != ERROR_INSUFFICIENT_BUFFER) GetLastError() != ERROR_INSUFFICIENT_BUFFER)
{ {
write_stderr(_("%s: could not get token information: error code %lu\n"), write_stderr(_("%s: could not get token information: error code %lu\n"),
progname, (unsigned long) GetLastError()); progname, GetLastError());
return NULL; return NULL;
} }
@@ -1942,7 +1941,7 @@ GetPrivilegesToDelete(HANDLE hToken)
if (!GetTokenInformation(hToken, TokenPrivileges, tokenPrivs, length, &length)) if (!GetTokenInformation(hToken, TokenPrivileges, tokenPrivs, length, &length))
{ {
write_stderr(_("%s: could not get token information: error code %lu\n"), write_stderr(_("%s: could not get token information: error code %lu\n"),
progname, (unsigned long) GetLastError()); progname, GetLastError());
free(tokenPrivs); free(tokenPrivs);
return NULL; return NULL;
} }

View File

@@ -6274,8 +6274,8 @@ parseScriptWeight(const char *option, char **script)
if (errno != 0 || badp == sep + 1 || *badp != '\0') if (errno != 0 || badp == sep + 1 || *badp != '\0')
pg_fatal("invalid weight specification: %s", sep); pg_fatal("invalid weight specification: %s", sep);
if (wtmp > INT_MAX || wtmp < 0) if (wtmp > INT_MAX || wtmp < 0)
pg_fatal("weight specification out of range (0 .. %d): %lld", pg_fatal("weight specification out of range (0 .. %d): %ld",
INT_MAX, (long long) wtmp); INT_MAX, wtmp);
weight = wtmp; weight = wtmp;
} }
else else

View File

@@ -1021,7 +1021,7 @@ PrintQueryStatus(PGresult *result, FILE *printQueryFout)
if (pset.logfile) if (pset.logfile)
fprintf(pset.logfile, "%s\n", cmdstatus); 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); SetVariable(pset.vars, "LASTOID", buf);
} }