diff options
author | Keith Bostic <keith@wiredtiger.com> | 2013-03-12 09:06:23 -0400 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2013-03-12 09:06:23 -0400 |
commit | adb56742e2e9a88232c0dd215e8901a6a5ffc19a (patch) | |
tree | 68cfde8e895244fd3e921a2e6e7a549bb22f6c2e | |
parent | d08476bb4631961b0761baa0132c4dcc24f4bb7f (diff) | |
download | mongo-adb56742e2e9a88232c0dd215e8901a6a5ffc19a.tar.gz |
A better fix for 7e1bf2482d0bec220dc20de45427428193f96134; WT_ALIGN
"returns" a uintmax_t, which may or may not be the size of a size_t,
but is almost certainly not a uint32_t, and better gcc's than mine
complain. WT_ALIGN isn't used in that many places, cast them all
explicitly.
-rw-r--r-- | src/block/block_write.c | 5 | ||||
-rw-r--r-- | src/btree/bt_handle.c | 3 | ||||
-rw-r--r-- | src/include/misc.h | 3 |
3 files changed, 5 insertions, 6 deletions
diff --git a/src/block/block_write.c b/src/block/block_write.c index a950cadf3bd..13cb0f25f0e 100644 --- a/src/block/block_write.c +++ b/src/block/block_write.c @@ -28,7 +28,8 @@ __wt_block_write_size(WT_SESSION_IMPL *session, WT_BLOCK *block, size_t *sizep) { WT_UNUSED(session); - *sizep = WT_ALIGN(*sizep + WT_BLOCK_HEADER_BYTE_SIZE, block->allocsize); + *sizep = (size_t) + WT_ALIGN(*sizep + WT_BLOCK_HEADER_BYTE_SIZE, block->allocsize); return (0); } @@ -87,7 +88,7 @@ __wt_block_write_off(WT_SESSION_IMPL *session, WT_BLOCK *block, * boundary, this is one of the reasons the btree layer must find out * from the block-manager layer the maximum size of the eventual write. */ - align_size = WT_ALIGN(buf->size, block->allocsize); + align_size = (uint32_t)WT_ALIGN(buf->size, block->allocsize); if (align_size > buf->memsize) { WT_ASSERT(session, align_size <= buf->memsize); WT_RET_MSG(session, EINVAL, diff --git a/src/btree/bt_handle.c b/src/btree/bt_handle.c index 6eaeb762c09..091bc3046a3 100644 --- a/src/btree/bt_handle.c +++ b/src/btree/bt_handle.c @@ -655,7 +655,8 @@ __wt_split_page_size(WT_BTREE *btree, uint32_t maxpagesize) * we don't waste space when we write). */ a = maxpagesize; /* Don't overflow. */ - split_size = WT_ALIGN((a * btree->split_pct) / 100, btree->allocsize); + split_size = + (uint32_t)WT_ALIGN((a * btree->split_pct) / 100, btree->allocsize); /* * If the result of that calculation is the same as the allocation unit diff --git a/src/include/misc.h b/src/include/misc.h index 2757eb363f5..53dbdc6544b 100644 --- a/src/include/misc.h +++ b/src/include/misc.h @@ -35,9 +35,6 @@ * Align an unsigned value of any type to a specified power-of-2, including the * offset result of a pointer subtraction; do the calculation using the largest * unsigned integer type available. - * - * Optionally cast the result to a uint32_t because that's the size of a piece - * of data in the WiredTiger engine. */ #define WT_ALIGN(n, v) \ ((((uintmax_t)(n)) + ((v) - 1)) & ~(((uintmax_t)(v)) - 1)) |