summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2014-10-02 19:58:07 -0400
committerKeith Bostic <keith@wiredtiger.com>2014-10-02 19:58:07 -0400
commitf2c75a3060b572d0fc42c8aaddf915ba38f38bd9 (patch)
tree6371bf53a1591ff46c8e153e8a074356a8f870e3
parent50b1e57a98b068a7c1147d44647dd504f719fe2d (diff)
downloadmongo-f2c75a3060b572d0fc42c8aaddf915ba38f38bd9.tar.gz
Minor cleanups: complain if we see off_t from now, hardwire tests for the
size of size_t and off_t before we compile.
-rw-r--r--dist/s_style5
-rw-r--r--src/btree/bt_handle.c8
-rw-r--r--src/conn/conn_api.c4
-rw-r--r--src/include/verify_build.h9
-rw-r--r--test/format/salvage.c2
5 files changed, 14 insertions, 14 deletions
diff --git a/dist/s_style b/dist/s_style
index 09b1b9460d2..9238acbbe2a 100644
--- a/dist/s_style
+++ b/dist/s_style
@@ -58,9 +58,9 @@ for f in \
cat $t
fi
- egrep 'u_quad' $f | sed '/@u_quad_decl@/d' > $t
+ egrep -w 'off_t' $f > $t
test -s $t && {
- echo "$f: old-style type declaration: u_XXX_t or u_quad"
+ echo "$f: off_t type declaration, use wt_off_t"
cat $t
}
@@ -130,6 +130,7 @@ for f in \
-e 's/\([ ,]\)u_int16_t\([ ,]\)/\1uint16_t\2/g' \
-e 's/\([ ,]\)u_int32_t\([ ,]\)/\1uint32_t\2/g' \
-e 's/\([ ,]\)u_int64_t\([ ,]\)/\1uint64_t\2/g' \
+ -e 's/\([ ,]\)u_quad\([ ,]\)/\1uint64_t\2/g' \
-e 's/\([|&=+-]\) *\([^*]\)/\1 \2/' \
-e 's/(void) \([a-zA-Z_]\)/(void)\1/' \
-e '/for /!s/;;$/;/' \
diff --git a/src/btree/bt_handle.c b/src/btree/bt_handle.c
index 65ff9097e6e..a21d6d277d3 100644
--- a/src/btree/bt_handle.c
+++ b/src/btree/bt_handle.c
@@ -79,10 +79,10 @@ __wt_btree_open(WT_SESSION_IMPL *session, const char *op_cfg[])
* sized address cookie that a block manager will ever return. There's
* a limit of WT_BTREE_MAX_ADDR_COOKIE, but at 255B, it's too large for
* a Btree with 512B internal pages. The default block manager packs
- * an off_t (wt_off_t) and 2 uint32_t's into its cookie, so there's no
- * problem now, but when we create a block manager extension API, we
- * need some way to consider the block manager's maximum cookie size
- * versus the minimum Btree internal node size.
+ * a wt_off_t and 2 uint32_t's into its cookie, so there's no problem
+ * now, but when we create a block manager extension API, we need some
+ * way to consider the block manager's maximum cookie size versus the
+ * minimum Btree internal node size.
*/
btree->block_header = bm->block_header(bm);
diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c
index ff94709a354..83f9ea31aa5 100644
--- a/src/conn/conn_api.c
+++ b/src/conn/conn_api.c
@@ -984,7 +984,7 @@ __conn_single(WT_SESSION_IMPL *session, const char *cfg[])
WT_ERR(__wt_open(session, WT_WIREDTIGER, 1, 0, 0, &fh));
len = (size_t)snprintf(buf, sizeof(buf),
"%s\n%s\n", WT_WIREDTIGER, WIREDTIGER_VERSION_STRING);
- WT_ERR(__wt_write(session, fh, (off_t)0, len, buf));
+ WT_ERR(__wt_write(session, fh, (wt_off_t)0, len, buf));
WT_ERR(__wt_close(session, fh));
fh = NULL;
@@ -993,7 +993,7 @@ __conn_single(WT_SESSION_IMPL *session, const char *cfg[])
* this isn't necessary, but zero-length files make me nervous.
*/
#define WT_SINGLETHREAD_STRING "WiredTiger lock file\n"
- WT_ERR(__wt_write(session, conn->lock_fh, (off_t)0,
+ WT_ERR(__wt_write(session, conn->lock_fh, (wt_off_t)0,
strlen(WT_SINGLETHREAD_STRING), WT_SINGLETHREAD_STRING));
created = 1;
diff --git a/src/include/verify_build.h b/src/include/verify_build.h
index 4ccedc4507a..adb262fd927 100644
--- a/src/include/verify_build.h
+++ b/src/include/verify_build.h
@@ -56,17 +56,16 @@ __wt_verify_build(void)
* The btree code encodes key/value pairs in size_t's, and requires at
* least 8B size_t's.
*/
- STATIC_ASSERT(sizeof(size_t) >= sizeof(int64_t));
+ STATIC_ASSERT(sizeof(size_t) >= 8);
/*
- * We require an off_t fit into an 8B chunk because 8B is the largest
+ * We require a wt_off_t fit into an 8B chunk because 8B is the largest
* integral value we can encode into an address cookie.
*
- * WiredTiger has never been tested on a system with 4B off_t types,
+ * WiredTiger has never been tested on a system with 4B file offsets,
* disallow them for now.
*/
- STATIC_ASSERT(sizeof(off_t) == sizeof(int64_t));
- STATIC_ASSERT(sizeof(wt_off_t) == sizeof(int64_t));
+ STATIC_ASSERT(sizeof(wt_off_t) == 8);
}
#undef ALIGN_CHECK
diff --git a/test/format/salvage.c b/test/format/salvage.c
index d371a93de03..9fccf880a68 100644
--- a/test/format/salvage.c
+++ b/test/format/salvage.c
@@ -58,8 +58,8 @@ corrupt(void)
{
FILE *fp;
struct stat sb;
- off_t offset;
size_t len, nw;
+ wt_off_t offset;
int fd, ret;
char buf[8 * 1024], copycmd[2 * 1024];