[fuzzer] Check enum type at compile time
I think this originally was done due to int / unsigned
differences between Linux in Windows. In hindsight, that
was short-sighted.
Bug: oss-fuzz:11281,oss-fuzz:11282,oss-fuzz:11283
Change-Id: I06e38cb663f84278f479eb7fee3118c1068eeaa8
Reviewed-on: https://skia-review.googlesource.com/c/169244
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
diff --git a/fuzz/Fuzz.h b/fuzz/Fuzz.h
index bfee1b3..294bbdf 100644
--- a/fuzz/Fuzz.h
+++ b/fuzz/Fuzz.h
@@ -132,7 +132,8 @@
template <typename T, typename Min, typename Max>
inline void Fuzz::nextEnum(T* value, Min rmin, Max rmax) {
- this->nextRange((uint32_t*)value, (uint32_t)rmin, (uint32_t)rmax);
+ using U = skstd::underlying_type_t<T>;
+ this->nextRange((U*)value, (U)rmin, (U)rmax);
}
template <typename T>