Bug 832788. Part 4: PrimitiveConversions should avoid implicit narrowing casts to avoid compiler warnings; make them explicit. r=bzbarsky

--HG--
extra : rebase_source : 276f7834714ded347bd9d368258bc049f24787c4
This commit is contained in:
Robert O'Callahan 2013-01-29 16:14:40 +13:00
parent 2532cb1a6a
commit f181913ea5

View File

@ -273,7 +273,7 @@ PrimitiveConversionTraits_Clamp(JSContext* cx, const double& d, T* retval)
// the correct result. If N is even, plus or minus N is the correct result.
double toTruncate = (d < 0) ? d - 0.5 : d + 0.5;
T truncated(toTruncate);
T truncated = static_cast<T>(toTruncate);
if (truncated == toTruncate) {
/*
@ -339,8 +339,8 @@ bool ValueToPrimitive(JSContext* cx, JS::Value v, T* retval)
if (!PrimitiveConversionTraits<T, B>::converter(cx, v, &t))
return false;
*retval =
static_cast<typename PrimitiveConversionTraits<T, B>::intermediateType>(t);
*retval = static_cast<T>(
static_cast<typename PrimitiveConversionTraits<T, B>::intermediateType>(t));
return true;
}