libcamera: controls: Check size of enum
Only enums whose sizes match that of `int32_t` can be directly supported. Otherwise the expected size and the real size would disagree, leading to an assertion failure in `ControlValue::set()`. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
a17df1be5e
commit
b3272f7827
1 changed files with 1 additions and 1 deletions
|
@ -125,7 +125,7 @@ struct control_type<Span<T, N>> : public control_type<std::remove_cv_t<T>> {
|
|||
};
|
||||
|
||||
template<typename T>
|
||||
struct control_type<T, std::enable_if_t<std::is_enum_v<T>>> : public control_type<int32_t> {
|
||||
struct control_type<T, std::enable_if_t<std::is_enum_v<T> && sizeof(T) == sizeof(int32_t)>> : public control_type<int32_t> {
|
||||
};
|
||||
|
||||
} /* namespace details */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue