diff options
author | shawnsingh@google.com <shawnsingh@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-29 21:42:03 +0000 |
---|---|---|
committer | shawnsingh@google.com <shawnsingh@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-29 21:42:03 +0000 |
commit | 81d20544b54bdc302d06315428b6be7311d7d784 (patch) | |
tree | d76bbc26e0b698f0f4ea0eaaab30286152a173fb /cc/debug | |
parent | ee38bc4084d0812df5fa0d9a615f8a8193e04ab2 (diff) | |
download | chromium_src-81d20544b54bdc302d06315428b6be7311d7d784.zip chromium_src-81d20544b54bdc302d06315428b6be7311d7d784.tar.gz chromium_src-81d20544b54bdc302d06315428b6be7311d7d784.tar.bz2 |
Add PRESUBMIT check to cc to ensure that C++ std::abs is used
This is try #2, previous patch r214144 was reverted in r214149.
Before this patch, it is possible to use abs() without the std::
namespace qualifier, which may link to the C standard library
implementation of abs(). Thus, someone using abs(float) may get
wrong results because C standard version will convert the float
to an int. This patch updates the occurrences of of abs() and
fabs() in cc/ (though technically none were incorrect, thankfully)
and adds a PRESUBMIT to enforce that all uses of abs from now on
have an explicit std:: to resolve them correctly.
BUG=261900
R=enne@chromium.org
Review URL: https://codereview.chromium.org/21061004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214225 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/debug')
-rw-r--r-- | cc/debug/overdraw_metrics.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cc/debug/overdraw_metrics.cc b/cc/debug/overdraw_metrics.cc index 0b3e838..5b19370 100644 --- a/cc/debug/overdraw_metrics.cc +++ b/cc/debug/overdraw_metrics.cc @@ -39,7 +39,7 @@ static inline float PolygonArea(gfx::PointF points[8], int num_points) { float area = 0; for (int i = 0; i < num_points; ++i) area += WedgeProduct(points[i], points[(i+1)%num_points]); - return fabs(0.5f * area); + return std::abs(0.5f * area); } // Takes a given quad, maps it by the given transformation, and gives the area |