| Index: webrtc/base/safe_conversions.h
|
| diff --git a/webrtc/base/safe_conversions.h b/webrtc/base/safe_conversions.h
|
| index ff9cc44bc2c183ecb831acdc01fbc2ef1e7f4d66..ac0bb651f3b8646fa78e45a6f871a416b918d683 100644
|
| --- a/webrtc/base/safe_conversions.h
|
| +++ b/webrtc/base/safe_conversions.h
|
| @@ -13,64 +13,9 @@
|
| #ifndef WEBRTC_BASE_SAFE_CONVERSIONS_H_
|
| #define WEBRTC_BASE_SAFE_CONVERSIONS_H_
|
|
|
| -#include <limits>
|
|
|
| -#include "webrtc/base/checks.h"
|
| -#include "webrtc/base/safe_conversions_impl.h"
|
| -
|
| -namespace rtc {
|
| -
|
| -// Convenience function that returns true if the supplied value is in range
|
| -// for the destination type.
|
| -template <typename Dst, typename Src>
|
| -inline bool IsValueInRangeForNumericType(Src value) {
|
| - return internal::RangeCheck<Dst>(value) == internal::TYPE_VALID;
|
| -}
|
| -
|
| -// checked_cast<> and dchecked_cast<> are analogous to static_cast<> for
|
| -// numeric types, except that they [D]CHECK that the specified numeric
|
| -// conversion will not overflow or underflow. NaN source will always trigger
|
| -// the [D]CHECK.
|
| -template <typename Dst, typename Src>
|
| -inline Dst checked_cast(Src value) {
|
| - RTC_CHECK(IsValueInRangeForNumericType<Dst>(value));
|
| - return static_cast<Dst>(value);
|
| -}
|
| -template <typename Dst, typename Src>
|
| -inline Dst dchecked_cast(Src value) {
|
| - RTC_DCHECK(IsValueInRangeForNumericType<Dst>(value));
|
| - return static_cast<Dst>(value);
|
| -}
|
| -
|
| -// saturated_cast<> is analogous to static_cast<> for numeric types, except
|
| -// that the specified numeric conversion will saturate rather than overflow or
|
| -// underflow. NaN assignment to an integral will trigger a RTC_CHECK condition.
|
| -template <typename Dst, typename Src>
|
| -inline Dst saturated_cast(Src value) {
|
| - // Optimization for floating point values, which already saturate.
|
| - if (std::numeric_limits<Dst>::is_iec559)
|
| - return static_cast<Dst>(value);
|
| -
|
| - switch (internal::RangeCheck<Dst>(value)) {
|
| - case internal::TYPE_VALID:
|
| - return static_cast<Dst>(value);
|
| -
|
| - case internal::TYPE_UNDERFLOW:
|
| - return std::numeric_limits<Dst>::min();
|
| -
|
| - case internal::TYPE_OVERFLOW:
|
| - return std::numeric_limits<Dst>::max();
|
| -
|
| - // Should fail only on attempting to assign NaN to a saturated integer.
|
| - case internal::TYPE_INVALID:
|
| - FATAL();
|
| - return std::numeric_limits<Dst>::max();
|
| - }
|
| -
|
| - FATAL();
|
| - return static_cast<Dst>(value);
|
| -}
|
| -
|
| -} // namespace rtc
|
| +// This header is deprecated and is just left here temporarily during
|
| +// refactoring. See https://bugs.webrtc.org/7634 for more details.
|
| +#include "webrtc/rtc_base/safe_conversions.h"
|
|
|
| #endif // WEBRTC_BASE_SAFE_CONVERSIONS_H_
|
|
|