JSON: Fix MSVC2013 warnings
json_p.h(283) : warning C4800: 'uint64_t' : forcing value to bool 'true' or 'false' (performance warning) json_p.h(546) : warning C4800: 'uint32_t' : forcing value to bool 'true' or 'false' (performance warning) qjsonvalue.cpp(176) : warning C4244: '=' : conversion from 'int64_t' to 'double', possible loss of data qjsonvalue.cpp(518) : warning C4244: 'return' : conversion from 'const double' to 'int', possible loss of data Change-Id: I2a24f90f7615aeb47f747ecbe3b580f23773ebda Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: hjk <hjk@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This commit is contained in:
parent
351853e04d
commit
bee361209f
@ -280,7 +280,7 @@ static inline int compressedNumber(double d)
|
|||||||
if (non_int)
|
if (non_int)
|
||||||
return INT_MAX;
|
return INT_MAX;
|
||||||
|
|
||||||
bool neg = (val >> 63);
|
bool neg = (val >> 63) != 0;
|
||||||
val &= fraction_mask;
|
val &= fraction_mask;
|
||||||
val |= ((quint64)1 << 52);
|
val |= ((quint64)1 << 52);
|
||||||
int res = (int)(val >> (52 - exp));
|
int res = (int)(val >> (52 - exp));
|
||||||
@ -543,7 +543,7 @@ public:
|
|||||||
offset tableOffset;
|
offset tableOffset;
|
||||||
// content follows here
|
// content follows here
|
||||||
|
|
||||||
inline bool isObject() const { return is_object; }
|
inline bool isObject() const { return !!is_object; }
|
||||||
inline bool isArray() const { return !isObject(); }
|
inline bool isArray() const { return !isObject(); }
|
||||||
|
|
||||||
inline offset *table() const { return (offset *) (((char *) this) + tableOffset); }
|
inline offset *table() const { return (offset *) (((char *) this) + tableOffset); }
|
||||||
|
@ -173,7 +173,7 @@ QJsonValue::QJsonValue(int n)
|
|||||||
QJsonValue::QJsonValue(qint64 n)
|
QJsonValue::QJsonValue(qint64 n)
|
||||||
: d(0), t(Double)
|
: d(0), t(Double)
|
||||||
{
|
{
|
||||||
this->dbl = n;
|
this->dbl = double(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -515,7 +515,7 @@ bool QJsonValue::toBool(bool defaultValue) const
|
|||||||
int QJsonValue::toInt(int defaultValue) const
|
int QJsonValue::toInt(int defaultValue) const
|
||||||
{
|
{
|
||||||
if (t == Double && int(dbl) == dbl)
|
if (t == Double && int(dbl) == dbl)
|
||||||
return dbl;
|
return int(dbl);
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user