Bug 1073716: Use C++ std::abs() instead of C abs(), for non-'int'-typed values, to address clang warning. r=ehsan

This commit is contained in:
Daniel Holbert 2014-09-28 09:59:46 -07:00
parent 8c09c51078
commit fa4545efef
4 changed files with 9 additions and 9 deletions

View File

@ -1310,7 +1310,7 @@ void MediaDecoderStateMachine::UpdateEstimatedDuration(int64_t aDuration)
AssertCurrentThreadInMonitor();
int64_t duration = GetDuration();
if (aDuration != duration &&
abs(aDuration - duration) > ESTIMATED_DURATION_FUZZ_FACTOR_USECS) {
std::abs(aDuration - duration) > ESTIMATED_DURATION_FUZZ_FACTOR_USECS) {
SetDuration(aDuration);
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(mDecoder, &MediaDecoder::DurationChanged);

View File

@ -2173,8 +2173,8 @@ TabChild::UpdateTapState(const WidgetTouchEvent& aEvent, nsEventStatus aStatus)
int64_t time = aEvent.time;
switch (aEvent.message) {
case NS_TOUCH_MOVE:
if (abs(currentPoint.x - mGestureDownPoint.x) > sDragThreshold.width ||
abs(currentPoint.y - mGestureDownPoint.y) > sDragThreshold.height) {
if (std::abs(currentPoint.x - mGestureDownPoint.x) > sDragThreshold.width ||
std::abs(currentPoint.y - mGestureDownPoint.y) > sDragThreshold.height) {
CancelTapTracking();
}
return;

View File

@ -252,7 +252,7 @@ FlattenBezierCurveSegment(const BezierControlPoints &aControlPoints,
Float s3 = (cp31.x * cp21.y - cp31.y * cp21.x) / hypotf(cp21.x, cp21.y);
t = 2 * Float(sqrt(aTolerance / (3. * abs(s3))));
t = 2 * Float(sqrt(aTolerance / (3. * std::abs(s3))));
if (t >= 1.0f) {
aSink->LineTo(aControlPoints.mCP4);
@ -281,8 +281,8 @@ FindInflectionApproximationRange(BezierControlPoints aControlPoints,
// Use the absolute value so that Min and Max will correspond with the
// minimum and maximum of the range.
*aMin = aT - CubicRoot(abs(aTolerance / (cp41.x - cp41.y)));
*aMax = aT + CubicRoot(abs(aTolerance / (cp41.x - cp41.y)));
*aMin = aT - CubicRoot(std::abs(aTolerance / (cp41.x - cp41.y)));
*aMax = aT + CubicRoot(std::abs(aTolerance / (cp41.x - cp41.y)));
return;
}
@ -297,7 +297,7 @@ FindInflectionApproximationRange(BezierControlPoints aControlPoints,
return;
}
Float tf = CubicRoot(abs(aTolerance / s3));
Float tf = CubicRoot(std::abs(aTolerance / s3));
*aMin = aT - tf * (1 - aT);
*aMax = aT + tf * (1 - aT);

View File

@ -1320,7 +1320,7 @@ ResultChangeRegionForPrimitive(const FilterPrimitiveDescription& aDescription,
case PrimitiveType::DisplacementMap:
{
int32_t scale = ceil(abs(atts.GetFloat(eDisplacementMapScale)));
int32_t scale = ceil(std::abs(atts.GetFloat(eDisplacementMapScale)));
return aInputChangeRegions[0].Inflated(nsIntMargin(scale, scale, scale, scale));
}
@ -1549,7 +1549,7 @@ SourceNeededRegionForPrimitive(const FilterPrimitiveDescription& aDescription,
if (aInputIndex == 1) {
return aResultNeededRegion;
}
int32_t scale = ceil(abs(atts.GetFloat(eDisplacementMapScale)));
int32_t scale = ceil(std::abs(atts.GetFloat(eDisplacementMapScale)));
return aResultNeededRegion.Inflated(nsIntMargin(scale, scale, scale, scale));
}