l = PageAddItem(page, itup[i], sz, off, false, false);
if (l == InvalidOffsetNumber)
- elog(ERROR, "failed to add item to GiST index page, item %d out of %d, size %d bytes",
- i, len, (int) sz);
+ elog(ERROR, "failed to add item to GiST index page, item %d out of %d, size %zu bytes",
+ i, len, sz);
off++;
}
}
itup = (IndexTuple) data;
itupsize = IndexTupleSize(itup);
if (!PageIndexTupleOverwrite(page, offnum, itup, itupsize))
- elog(ERROR, "failed to add item to GiST index page, size %d bytes",
- (int) itupsize);
+ elog(ERROR, "failed to add item to GiST index page, size %zu bytes", itupsize);
data += itupsize;
/* should be nothing left after consuming 1 tuple */
Assert(data - begin == datalen);
l = PageAddItem(page, itup, sz, off, false, false);
if (l == InvalidOffsetNumber)
- elog(ERROR, "failed to add item to GiST index page, size %d bytes",
- (int) sz);
+ elog(ERROR, "failed to add item to GiST index page, size %zu bytes", sz);
off++;
ninserted++;
}
l = PageAddItem(writepage, itup, itemsz, towrite[ninserted], false, false);
if (l == InvalidOffsetNumber)
- elog(ERROR, "hash_xlog_move_page_contents: failed to add item to hash index page, size %d bytes",
- (int) itemsz);
+ elog(ERROR, "hash_xlog_move_page_contents: failed to add item to hash index page, size %zu bytes", itemsz);
ninserted++;
}
l = PageAddItem(writepage, itup, itemsz, towrite[ninserted], false, false);
if (l == InvalidOffsetNumber)
- elog(ERROR, "hash_xlog_squeeze_page: failed to add item to hash index page, size %d bytes",
- (int) itemsz);
+ elog(ERROR, "hash_xlog_squeeze_page: failed to add item to hash index page, size %zu bytes", itemsz);
ninserted++;
}
/* short write: complain appropriately */
ereport(ERROR,
(errcode(ERRCODE_DISK_FULL),
- errmsg("could not write file \"%s\": wrote only %d of %d bytes at offset %u",
+ errmsg("could not write file \"%s\": wrote only %d of %zu bytes at offset %u",
FilePathName(mysink->file),
- nbytes, (int) len, (unsigned) mysink->filepos),
+ nbytes, len, (unsigned) mysink->filepos),
errhint("Check free disk space.")));
}
/* short write: complain appropriately */
ereport(ERROR,
(errcode(ERRCODE_DISK_FULL),
- errmsg("could not write file \"%s\": wrote only %d of %d bytes at offset %u",
+ errmsg("could not write file \"%s\": wrote only %d of %zu bytes at offset %u",
FilePathName(mysink->file),
- nbytes, (int) len, (unsigned) mysink->filepos),
+ nbytes, len, (unsigned) mysink->filepos),
errhint("Check free disk space.")));
}
gbuf.length = buf.len;
gbuf.value = buf.data;
- elog(DEBUG4, "processing received GSS token of length %u",
- (unsigned int) gbuf.length);
+ elog(DEBUG4, "processing received GSS token of length %zu",
+ gbuf.length);
maj_stat = gss_accept_sec_context(&min_stat,
&port->gss->ctx,
pfree(buf.data);
elog(DEBUG5, "gss_accept_sec_context major: %u, "
- "minor: %u, outlen: %u, outflags: %x",
+ "minor: %u, outlen: %zu, outflags: %x",
maj_stat, min_stat,
- (unsigned int) port->gss->outbuf.length, gflags);
+ port->gss->outbuf.length, gflags);
CHECK_FOR_INTERRUPTS();
/*
* Negotiation generated data to be sent to the client.
*/
- elog(DEBUG4, "sending GSS response token of length %u",
- (unsigned int) port->gss->outbuf.length);
+ elog(DEBUG4, "sending GSS response token of length %zu",
+ port->gss->outbuf.length);
sendAuthRequest(port, AUTH_REQ_GSS_CONT,
port->gss->outbuf.value, port->gss->outbuf.length);
if (strlen(unixSocketPath) >= UNIXSOCK_PATH_BUFLEN)
{
ereport(LOG,
- (errmsg("Unix-domain socket path \"%s\" is too long (maximum %d bytes)",
+ (errmsg("Unix-domain socket path \"%s\" is too long (maximum %zu bytes)",
unixSocketPath,
- (int) (UNIXSOCK_PATH_BUFLEN - 1))));
+ (UNIXSOCK_PATH_BUFLEN - 1))));
return STATUS_ERROR;
}
if (Lock_AF_UNIX(unixSocketDir, unixSocketPath) != STATUS_OK)
if (typbyval)
{
s = (char *) (&value);
- appendStringInfo(str, "%u [ ", (unsigned int) length);
+ appendStringInfo(str, "%zu [ ", length);
for (Size i = 0; i < (Size) sizeof(Datum); i++)
appendStringInfo(str, "%d ", (int) (s[i]));
appendStringInfoChar(str, ']');
appendStringInfoString(str, "0 [ ]");
else
{
- appendStringInfo(str, "%u [ ", (unsigned int) length);
+ appendStringInfo(str, "%zu [ ", length);
for (Size i = 0; i < length; i++)
appendStringInfo(str, "%d ", (int) (s[i]));
appendStringInfoChar(str, ']');
if (totallen > (Size) (pd_special - pd_lower))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg("corrupted item lengths: total %u, available space %u",
- (unsigned int) totallen, pd_special - pd_lower)));
+ errmsg("corrupted item lengths: total %zu, available space %u",
+ totallen, pd_special - pd_lower)));
compactify_tuples(itemidbase, nstorage, page, presorted);
}
offset != MAXALIGN(offset))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg("corrupted line pointer: offset = %u, size = %u",
- offset, (unsigned int) size)));
+ errmsg("corrupted line pointer: offset = %u, size = %zu",
+ offset, size)));
/* Amount of space to actually be deleted */
size = MAXALIGN(size);
offset != MAXALIGN(offset))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg("corrupted line pointer: offset = %u, size = %u",
- offset, (unsigned int) size)));
+ errmsg("corrupted line pointer: offset = %u, size = %zu",
+ offset, size)));
if (nextitm < nitems && offnum == itemnos[nextitm])
{
if (totallen > (Size) (pd_special - pd_lower))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg("corrupted item lengths: total %u, available space %u",
- (unsigned int) totallen, pd_special - pd_lower)));
+ errmsg("corrupted item lengths: total %zu, available space %u",
+ totallen, pd_special - pd_lower)));
/*
* Looks good. Overwrite the line pointers with the copy, from which we've
offset != MAXALIGN(offset))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg("corrupted line pointer: offset = %u, size = %u",
- offset, (unsigned int) size)));
+ errmsg("corrupted line pointer: offset = %u, size = %zu",
+ offset, size)));
/* Amount of space to actually be deleted */
size = MAXALIGN(size);
if (!AllocSizeIsValid(nbytes))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxAllocSize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxAllocSize)));
}
if (dnulls)
if (!AllocSizeIsValid(nbytes))
ereturn(escontext, (Datum) 0,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxAllocSize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxAllocSize)));
}
}
if (hasnulls)
pg_add_s32_overflow(ub, 1, &ub))
ereturn(escontext, false,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxArraySize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxArraySize)));
dim[ndim] = ub;
ndim++;
if (maxitems >= MaxArraySize)
ereturn(escontext, false,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxArraySize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxArraySize)));
maxitems = Min(maxitems * 2, MaxArraySize);
values = repalloc_array(values, Datum, maxitems);
nulls = repalloc_array(nulls, bool, maxitems);
if (!AllocSizeIsValid(totbytes))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxAllocSize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxAllocSize)));
}
}
*hasnulls = hasnull;
pg_add_s32_overflow(dim[0], addedbefore, &dim[0]))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxArraySize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxArraySize)));
lb[0] = indx[0];
if (addedbefore > 1)
newhasnulls = true; /* will insert nulls */
pg_add_s32_overflow(dim[0], addedafter, &dim[0]))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxArraySize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxArraySize)));
if (addedafter > 1)
newhasnulls = true; /* will insert nulls */
}
pg_add_s32_overflow(dim[0], addedbefore, &dim[0]))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxArraySize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxArraySize)));
lb[0] = indx[0];
dimschanged = true;
if (addedbefore > 1)
pg_add_s32_overflow(dim[0], addedafter, &dim[0]))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxArraySize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxArraySize)));
dimschanged = true;
if (addedafter > 1)
newhasnulls = true; /* will insert nulls */
pg_add_s32_overflow(dim[i], 1, &dim[i]))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxArraySize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxArraySize)));
lb[i] = lowerIndx[i];
}
pg_add_s32_overflow(dim[0], addedbefore, &dim[0]))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxArraySize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxArraySize)));
lb[0] = lowerIndx[0];
if (addedbefore > 1)
newhasnulls = true; /* will insert nulls */
pg_add_s32_overflow(dim[0], addedafter, &dim[0]))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxArraySize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxArraySize)));
if (addedafter > 1)
newhasnulls = true; /* will insert nulls */
}
if (!AllocSizeIsValid(nbytes))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxAllocSize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxAllocSize)));
}
}
if (!AllocSizeIsValid(nbytes))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxAllocSize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxAllocSize)));
}
/* Allocate and initialize result array */
if (!AllocSizeIsValid(astate->alen * sizeof(Datum)))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxAllocSize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxAllocSize)));
astate->dvalues = (Datum *)
repalloc(astate->dvalues, astate->alen * sizeof(Datum));
astate->dnulls = (bool *)
!AllocSizeIsValid(totbytes))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxAllocSize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxAllocSize)));
/*
* This addition can't overflow, but it might cause us to go past
if (!AllocSizeIsValid(nbytes))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxAllocSize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxAllocSize)));
}
nresult++;
}
if (s[j] != ' ')
ereturn(escontext, NULL,
(errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION),
- errmsg("value too long for type character(%d)",
- (int) maxlen)));
+ errmsg("value too long for type character(%zu)",
+ maxlen)));
}
/*
if (s[j] != ' ')
ereturn(escontext, NULL,
(errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION),
- errmsg("value too long for type character varying(%d)",
- (int) maxlen)));
+ errmsg("value too long for type character varying(%zu)",
+ maxlen)));
}
len = mbmaxlen;
new_limit = 2048;
source = PGC_S_DYNAMIC_DEFAULT;
}
- snprintf(limbuf, sizeof(limbuf), "%d", (int) new_limit);
+ snprintf(limbuf, sizeof(limbuf), "%zd", new_limit);
SetConfigOption("max_stack_depth", limbuf,
PGC_POSTMASTER, source);
}
if (wb < 0)
pg_fatal("could not write file \"%s\": %m", mwriter->pathname);
else
- pg_fatal("could not write file \"%s\": wrote %d of %d",
- mwriter->pathname, (int) wb, mwriter->buf.len);
+ pg_fatal("could not write file \"%s\": wrote %zd of %d",
+ mwriter->pathname, wb, mwriter->buf.len);
}
if (mwriter->still_checksumming &&
ahprintf(AH, "; Dump Version: %d.%d-%d\n",
ARCHIVE_MAJOR(AH->version), ARCHIVE_MINOR(AH->version), ARCHIVE_REV(AH->version));
ahprintf(AH, "; Format: %s\n", fmtName);
- ahprintf(AH, "; Integer: %d bytes\n", (int) AH->intSize);
- ahprintf(AH, "; Offset: %d bytes\n", (int) AH->offSize);
+ ahprintf(AH, "; Integer: %zu bytes\n", AH->intSize);
+ ahprintf(AH, "; Offset: %zu bytes\n", AH->offSize);
if (AH->archiveRemoteVersion)
ahprintf(AH, "; Dumped from database version: %s\n",
AH->archiveRemoteVersion);
if (ferror(fh))
pg_fatal("could not read input file: %m");
else
- pg_fatal("input file is too short (read %lu, expected 5)",
- (unsigned long) cnt);
+ pg_fatal("input file is too short (read %zu, expected 5)", cnt);
}
/* Save it, just in case we need it later */
AH->intSize = AH->ReadBytePtr(AH);
if (AH->intSize > 32)
- pg_fatal("sanity check on integer size (%lu) failed",
- (unsigned long) AH->intSize);
+ pg_fatal("sanity check on integer size (%zu) failed", AH->intSize);
if (AH->intSize > sizeof(int))
pg_log_warning("archive was made on a machine with larger integers, some operations might fail");
appendArrayEscapedString(&src->paths, rq->path);
appendStringInfo(&src->offsets, INT64_FORMAT, (int64) rq->offset);
- appendStringInfo(&src->lengths, INT64_FORMAT, (int64) rq->length);
+ appendStringInfo(&src->lengths, "%zu", rq->length);
}
appendStringInfoChar(&src->paths, '}');
appendStringInfoChar(&src->offsets, '}');
* check that the size of the file matches our earlier expectation.
*/
if (written_len != len)
- pg_fatal("size of source file \"%s\" changed concurrently: %d bytes expected, %d copied",
- srcpath, (int) len, (int) written_len);
+ pg_fatal("size of source file \"%s\" changed concurrently: %zu bytes expected, %zu copied",
+ srcpath, len, written_len);
if (close(srcfd) != 0)
pg_fatal("could not close file \"%s\": %m", srcpath);
size_t size)
{
if (size != PG_CONTROL_FILE_SIZE)
- pg_fatal("unexpected control file size %d, expected %d",
- (int) size, PG_CONTROL_FILE_SIZE);
+ pg_fatal("unexpected control file size %zu, expected %d",
+ size, PG_CONTROL_FILE_SIZE);
memcpy(ControlFile, content, sizeof(ControlFileData));
UNIXSOCK_PATH(portstr, thisport, ch->host);
if (strlen(portstr) >= UNIXSOCK_PATH_BUFLEN)
{
- libpq_append_conn_error(conn, "Unix-domain socket path \"%s\" is too long (maximum %d bytes)",
+ libpq_append_conn_error(conn, "Unix-domain socket path \"%s\" is too long (maximum %zu bytes)",
portstr,
- (int) (UNIXSOCK_PATH_BUFLEN - 1));
+ (UNIXSOCK_PATH_BUFLEN - 1));
goto keep_going;
}
break;
default:
pqInternalNotice(&conn->noticeHooks,
- "integer of size %lu not supported by pqGetInt",
- (unsigned long) bytes);
+ "integer of size %zu not supported by pqGetInt",
+ bytes);
return EOF;
}
break;
default:
pqInternalNotice(&conn->noticeHooks,
- "integer of size %lu not supported by pqPutInt",
- (unsigned long) bytes);
+ "integer of size %zu not supported by pqPutInt",
+ bytes);
return EOF;
}