Commit b6ec7c92 authored by Tom Lane's avatar Tom Lane

Fix some remaining int64 vestiges in contrib/test_shm_mq.

Andres Freund and Tom Lane
parent c676ac0f
...@@ -92,7 +92,7 @@ setup_dynamic_shared_memory(int64 queue_size, int nworkers, ...@@ -92,7 +92,7 @@ setup_dynamic_shared_memory(int64 queue_size, int nworkers,
{ {
shm_toc_estimator e; shm_toc_estimator e;
int i; int i;
uint64 segsize; Size segsize;
dsm_segment *seg; dsm_segment *seg;
shm_toc *toc; shm_toc *toc;
test_shm_mq_header *hdr; test_shm_mq_header *hdr;
...@@ -101,8 +101,12 @@ setup_dynamic_shared_memory(int64 queue_size, int nworkers, ...@@ -101,8 +101,12 @@ setup_dynamic_shared_memory(int64 queue_size, int nworkers,
if (queue_size < 0 || ((uint64) queue_size) < shm_mq_minimum_size) if (queue_size < 0 || ((uint64) queue_size) < shm_mq_minimum_size)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("queue size must be at least %lu bytes", errmsg("queue size must be at least %zu bytes",
(unsigned long) shm_mq_minimum_size))); shm_mq_minimum_size)));
if (queue_size != ((Size) queue_size))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("queue size overflows size_t")));
/* /*
* Estimate how much shared memory we need. * Estimate how much shared memory we need.
...@@ -116,7 +120,7 @@ setup_dynamic_shared_memory(int64 queue_size, int nworkers, ...@@ -116,7 +120,7 @@ setup_dynamic_shared_memory(int64 queue_size, int nworkers,
shm_toc_initialize_estimator(&e); shm_toc_initialize_estimator(&e);
shm_toc_estimate_chunk(&e, sizeof(test_shm_mq_header)); shm_toc_estimate_chunk(&e, sizeof(test_shm_mq_header));
for (i = 0; i <= nworkers; ++i) for (i = 0; i <= nworkers; ++i)
shm_toc_estimate_chunk(&e, queue_size); shm_toc_estimate_chunk(&e, (Size) queue_size);
shm_toc_estimate_keys(&e, 2 + nworkers); shm_toc_estimate_keys(&e, 2 + nworkers);
segsize = shm_toc_estimate(&e); segsize = shm_toc_estimate(&e);
...@@ -138,7 +142,8 @@ setup_dynamic_shared_memory(int64 queue_size, int nworkers, ...@@ -138,7 +142,8 @@ setup_dynamic_shared_memory(int64 queue_size, int nworkers,
{ {
shm_mq *mq; shm_mq *mq;
mq = shm_mq_create(shm_toc_allocate(toc, queue_size), queue_size); mq = shm_mq_create(shm_toc_allocate(toc, (Size) queue_size),
(Size) queue_size);
shm_toc_insert(toc, i + 1, mq); shm_toc_insert(toc, i + 1, mq);
if (i == 0) if (i == 0)
......
...@@ -254,12 +254,12 @@ verify_message(Size origlen, char *origdata, Size newlen, char *newdata) ...@@ -254,12 +254,12 @@ verify_message(Size origlen, char *origdata, Size newlen, char *newdata)
if (origlen != newlen) if (origlen != newlen)
ereport(ERROR, ereport(ERROR,
(errmsg("message corrupted"), (errmsg("message corrupted"),
errdetail("The original message was " UINT64_FORMAT " bytes but the final message is " UINT64_FORMAT " bytes.", errdetail("The original message was %zu bytes but the final message is %zu bytes.",
origlen, newlen))); origlen, newlen)));
for (i = 0; i < origlen; ++i) for (i = 0; i < origlen; ++i)
if (origdata[i] != newdata[i]) if (origdata[i] != newdata[i])
ereport(ERROR, ereport(ERROR,
(errmsg("message corrupted"), (errmsg("message corrupted"),
errdetail("The new and original messages differ at byte " UINT64_FORMAT " of " UINT64_FORMAT ".", i, origlen))); errdetail("The new and original messages differ at byte %zu of %zu.", i, origlen)));
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment