Remove MIN and MAX checking for hidl_enum in UserHalHelper native library. am: bfaf79c9c6

Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/12663093

Change-Id: Icf2fa91a0bf466ce93c4b8365773801c8d7c9755
This commit is contained in:
Lakshman Annadorai
2020-09-25 05:24:55 +00:00
committed by Automerger Merge Worker

View File

@@ -141,11 +141,6 @@ Result<void> parseUserAssociations(const hidl_vec<int32_t>& int32Values, size_t
template <typename T>
Result<T> verifyAndCast(int32_t value) {
T castValue = static_cast<T>(value);
const auto iter = hidl_enum_range<T>();
if (castValue < *iter.begin() || castValue > *std::prev(iter.end())) {
return Error() << "Value " << value << " not in range [" << toString(*iter.begin()) << ", "
<< toString(*std::prev(iter.end())) << "]";
}
for (const auto& v : hidl_enum_range<T>()) {
if (castValue == v) {
return castValue;