Bug 1204061 - check return values from some methods r=dholbert

This commit is contained in:
Robert Longson 2015-10-06 13:19:03 +01:00
parent a034e8c41a
commit e9f6e9d5eb

View File

@ -233,7 +233,7 @@ AddWeightedPathSegs(double aCoeff1,
* identity, in which case we'll grow it to the right
* size. Also allowed to be the same list as aList1.
*/
static void
static nsresult
AddWeightedPathSegLists(double aCoeff1, const SVGPathDataAndInfo& aList1,
double aCoeff2, const SVGPathDataAndInfo& aList2,
SVGPathDataAndInfo& aResult)
@ -264,8 +264,9 @@ AddWeightedPathSegLists(double aCoeff1, const SVGPathDataAndInfo& aList1,
// because in that case, we will have already set iter1 to nullptr above, to
// record that our first operand is an identity value.)
if (aResult.IsIdentity()) {
DebugOnly<bool> success = aResult.SetLength(aList2.Length());
MOZ_ASSERT(success, "infallible nsTArray::SetLength should succeed");
if (!aResult.SetLength(aList2.Length())) {
return NS_ERROR_OUT_OF_MEMORY;
}
aResult.SetElement(aList2.Element()); // propagate target element info!
}
@ -281,6 +282,7 @@ AddWeightedPathSegLists(double aCoeff1, const SVGPathDataAndInfo& aList1,
iter2 == end2 &&
resultIter == aResult.end(),
"Very, very bad - path data corrupt");
return NS_OK;
}
static void
@ -430,9 +432,7 @@ SVGPathSegListSMILType::Add(nsSMILValue& aDest,
}
}
AddWeightedPathSegLists(1.0, dest, aCount, valueToAdd, dest);
return NS_OK;
return AddWeightedPathSegLists(1.0, dest, aCount, valueToAdd, dest);
}
nsresult
@ -483,8 +483,9 @@ SVGPathSegListSMILType::Interpolate(const nsSMILValue& aStartVal,
if (check == eRequiresConversion) {
// Can't convert |start| in-place, since it's const. Instead, we copy it
// into |result|, converting the types as we go, and use that as our start.
DebugOnly<bool> success = result.SetLength(end.Length());
MOZ_ASSERT(success, "infallible nsTArray::SetLength should succeed");
if (!result.SetLength(end.Length())) {
return NS_ERROR_OUT_OF_MEMORY;
}
result.SetElement(end.Element()); // propagate target element info!
ConvertAllPathSegmentData(start.begin(), start.end(),
@ -493,10 +494,8 @@ SVGPathSegListSMILType::Interpolate(const nsSMILValue& aStartVal,
startListToUse = &result;
}
AddWeightedPathSegLists(1.0 - aUnitDistance, *startListToUse,
aUnitDistance, end, result);
return NS_OK;
return AddWeightedPathSegLists(1.0 - aUnitDistance, *startListToUse,
aUnitDistance, end, result);
}
} // namespace mozilla