summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2016-03-16 11:34:27 -0400
committerKeith Bostic <keith@wiredtiger.com>2016-03-16 11:34:27 -0400
commite782e1ce92c9786f3ed41277f386192cb683abba (patch)
tree475f7895b5e29533e0a99a22120842e4675e8671
parent1a698c5f5495555d51cc7bf5d3209433e3b9a083 (diff)
downloadmongo-e782e1ce92c9786f3ed41277f386192cb683abba.tar.gz
WT-2492 Change printf format specifier to be Windows compatible.
Windows doesn't like %td, use the maximum unsigned integer format instead, PRIuMAX. Get rid of the temporary variable I introduced in cc0d34b, there's no need for one.
-rw-r--r--dist/s_string.ok1
-rw-r--r--src/config/config.c14
2 files changed, 8 insertions, 7 deletions
diff --git a/dist/s_string.ok b/dist/s_string.ok
index 43eb7861b23..6762521ca76 100644
--- a/dist/s_string.ok
+++ b/dist/s_string.ok
@@ -878,6 +878,7 @@ ps
psp
pthread
ptr
+ptrdiff
pushms
putK
putV
diff --git a/src/config/config.c b/src/config/config.c
index 4eadaf2f008..a50c4d29f65 100644
--- a/src/config/config.c
+++ b/src/config/config.c
@@ -15,14 +15,14 @@
static int
__config_err(WT_CONFIG *conf, const char *msg, int err)
{
- uint64_t offset;
-
- /* Cast because printing a pointer diff isn't platform portable */
- offset = (uint64_t)(conf->cur - conf->orig);
-
+ /*
+ * Cast the string offset to uintmax_t because the %td format to print
+ * a type ptrdiff_t isn't supported under MSVC.
+ */
WT_RET_MSG(conf->session, err,
- "Error parsing '%.*s' at offset %" PRIu64 ": %s",
- (int)(conf->end - conf->orig), conf->orig, offset, msg);
+ "Error parsing '%.*s' at offset %" PRIuMAX ": %s",
+ (int)(conf->end - conf->orig), conf->orig,
+ (uintmax_t)(conf->cur - conf->orig), msg);
}
/*