From dddfdad6ebb4e7172ff36f5a0db8a5cbf58d45f3 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 30 Nov 2017 15:42:00 +0000 Subject: Run clang-tidy modernize-use-auto on //third_party/pdfium See the bugs and cxx post for justification and details: https://groups.google.com/a/chromium.org/forum/#!topic/cxx/RkOHzIK6Tq8 This change was done using clang-tidy as described here: https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md Bug: chromium:776257 Change-Id: I1f6637cde8b3e41825993a736bed6763dd7beacb Reviewed-on: https://pdfium-review.googlesource.com/19971 Reviewed-by: Lei Zhang Commit-Queue: dsinclair --- third_party/base/numerics/safe_math_impl.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'third_party/base/numerics') diff --git a/third_party/base/numerics/safe_math_impl.h b/third_party/base/numerics/safe_math_impl.h index 5ad79ce192..4bcc67188c 100644 --- a/third_party/base/numerics/safe_math_impl.h +++ b/third_party/base/numerics/safe_math_impl.h @@ -59,9 +59,9 @@ bool CheckedAddImpl(T x, T y, T* result) { // it using the unsigned type of the same size. using UnsignedDst = typename std::make_unsigned::type; using SignedDst = typename std::make_signed::type; - UnsignedDst ux = static_cast(x); - UnsignedDst uy = static_cast(y); - UnsignedDst uresult = static_cast(ux + uy); + auto ux = static_cast(x); + auto uy = static_cast(y); + auto uresult = static_cast(ux + uy); *result = static_cast(uresult); // Addition is valid if the sign of (x + y) is equal to either that of x or // that of y. @@ -110,9 +110,9 @@ bool CheckedSubImpl(T x, T y, T* result) { // it using the unsigned type of the same size. using UnsignedDst = typename std::make_unsigned::type; using SignedDst = typename std::make_signed::type; - UnsignedDst ux = static_cast(x); - UnsignedDst uy = static_cast(y); - UnsignedDst uresult = static_cast(ux - uy); + auto ux = static_cast(x); + auto uy = static_cast(y); + auto uresult = static_cast(ux - uy); *result = static_cast(uresult); // Subtraction is valid if either x and y have same sign, or (x-y) and x have // the same sign. @@ -163,7 +163,7 @@ bool CheckedMulImpl(T x, T y, T* result) { using SignedDst = typename std::make_signed::type; const UnsignedDst ux = SafeUnsignedAbs(x); const UnsignedDst uy = SafeUnsignedAbs(y); - UnsignedDst uresult = static_cast(ux * uy); + auto uresult = static_cast(ux * uy); const bool is_negative = std::is_signed::value && static_cast(x ^ y) < 0; *result = is_negative ? 0 - uresult : uresult; @@ -308,7 +308,7 @@ struct CheckedLshOp::type; static const ShiftType kBitWidth = IntegerBitsPlusSign::value; - const ShiftType real_shift = static_cast(shift); + const auto real_shift = static_cast(shift); // Signed shift is not legal on negative values. if (!IsValueNegative(x) && real_shift < kBitWidth) { // Just use a multiplication because it's easy. -- cgit v1.2.3