summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/value.cpp
diff options
context:
space:
mode:
authorWaley <waley.chen@10gen.com>2016-01-27 13:48:16 -0500
committerWaley <waleycz@gmail.com>2016-02-08 11:28:07 -0500
commite34706733411e42dba63826a10b15f81e13fdd0d (patch)
tree2b29f4bcb8e43ed20ed2e2d907ff55a7bdc80214 /src/mongo/db/pipeline/value.cpp
parent93f767caeebda5ffd295f935e734e0bf02da3356 (diff)
downloadmongo-e34706733411e42dba63826a10b15f81e13fdd0d.tar.gz
SERVER-10568 SafeNum should be written in terms of explicitly sized types
Diffstat (limited to 'src/mongo/db/pipeline/value.cpp')
-rw-r--r--src/mongo/db/pipeline/value.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/db/pipeline/value.cpp b/src/mongo/db/pipeline/value.cpp
index 6c2dc767256..5d5b04ae137 100644
--- a/src/mongo/db/pipeline/value.cpp
+++ b/src/mongo/db/pipeline/value.cpp
@@ -253,9 +253,9 @@ Value Value::createIntOrLong(long long longValue) {
Decimal128 Value::getDecimal() const {
BSONType type = getType();
if (type == NumberInt)
- return Decimal128(_storage.intValue);
+ return Decimal128(static_cast<int32_t>(_storage.intValue));
if (type == NumberLong)
- return Decimal128(_storage.longValue);
+ return Decimal128(static_cast<int64_t>(_storage.longValue));
if (type == NumberDouble)
return Decimal128(_storage.doubleValue);
invariant(type == NumberDecimal);
@@ -479,10 +479,10 @@ Decimal128 Value::coerceToDecimal() const {
return _storage.getDecimal();
case NumberInt:
- return Decimal128(_storage.intValue);
+ return Decimal128(static_cast<int32_t>(_storage.intValue));
case NumberLong:
- return Decimal128(_storage.longValue);
+ return Decimal128(static_cast<int64_t>(_storage.longValue));
case NumberDouble:
return Decimal128(_storage.doubleValue);