diff options
author | Barnabás Pőcze <barnabas.pocze@ideasonboard.com> | 2025-02-05 17:05:38 +0100 |
---|---|---|
committer | Barnabás Pőcze <barnabas.pocze@ideasonboard.com> | 2025-03-25 12:41:17 +0100 |
commit | b3272f78278ab18cf9467e06d676eb7f1e27b669 (patch) | |
tree | 124e74779035af4956d6d739fcc2f063a8e77bb5 | |
parent | a17df1be5e9d6cba75f939e5e7e9f52cb51395d8 (diff) |
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>
-rw-r--r-- | include/libcamera/controls.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 7c7828ae..4bfe9615 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -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 */ |