diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2015-11-11 10:29:50 +0200 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2015-11-11 14:04:02 +0000 |
commit | 942aa12f77b6f2351ea2400a0a91a1e861fc19e8 (patch) | |
tree | 6dcf59686b32dd4ebab724715e1b7ba5c4016117 /src/shared/json | |
parent | 0f9e2baa1b9d6c6dd15185c45b1520bbe9b69a0e (diff) |
JSON: Fix MSVC2013 warnings
json.cpp(221) : warning C4800: 'uint64_t' : forcing value to bool 'true' or 'false' (performance warning)
json.cpp(322) : warning C4800: 'uint32_t' : forcing value to bool 'true' or 'false' (performance warning)
json.cpp(756) : warning C4244: '=' : conversion from 'int64_t' to 'double', possible loss of data
json.cpp(953) : warning C4244: 'return' : conversion from 'const double' to 'int', possible loss of data
json.cpp(4408) : warning C4244: 'argument' : conversion from '__int64' to 'int', possible loss of data
Change-Id: I2a24f90f7615aeb47f747ecbe3b580f23773ebda
Reviewed-by: hjk <hjk@theqtcompany.com>
Diffstat (limited to 'src/shared/json')
-rw-r--r-- | src/shared/json/json.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/shared/json/json.cpp b/src/shared/json/json.cpp index b7e9fec66b..c40aa3dc1f 100644 --- a/src/shared/json/json.cpp +++ b/src/shared/json/json.cpp @@ -218,7 +218,7 @@ static int compressedNumber(double d) if (non_int) return INT_MAX; - bool neg = (val >> 63); + bool neg = (val >> 63) != 0; val &= fraction_mask; val |= ((uint64_t)1 << 52); int res = (int)(val >> (52 - exp)); @@ -319,7 +319,7 @@ public: offset tableOffset; // content follows here - bool isObject() const { return is_object; } + bool isObject() const { return !!is_object; } bool isArray() const { return !isObject(); } offset *table() const { return (offset *) (((char *) this) + tableOffset); } @@ -753,7 +753,7 @@ JsonValue::JsonValue(int n) JsonValue::JsonValue(int64_t n) : d(0), t(Double) { - this->dbl = n; + this->dbl = double(n); } /*! @@ -950,7 +950,7 @@ bool JsonValue::toBool(bool defaultValue) const int JsonValue::toInt(int defaultValue) const { if (t == Double && int(dbl) == dbl) - return dbl; + return int(dbl); return defaultValue; } @@ -4405,7 +4405,7 @@ bool Parser::parseNumber(Value *val, int baseOffset) char *endptr = const_cast<char *>(json); long long int n = strtoll(start, &endptr, 0); if (endptr != start && n < (1<<25) && n > -(1<<25)) { - val->int_value = n; + val->int_value = int(n); val->intValue = true; END; return true; |