mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 07:19:45 +03:00
android: camera_capabilities: Fix GCC 14 warning
GCC 14 thinks `rects` is a "possibly dangling reference to a temporary": /libcamera/src/android/camera_capabilities.cpp: In member function ‘int CameraCapabilities::initializeStaticMetadata()’: /libcamera/src/android/camera_capabilities.cpp:1084:46: error: possibly dangling reference to a temporary [-Werror=dangling-reference] 1084 | const Span<const Rectangle>& rects = | ^~~~~ /libcamera/src/android/camera_capabilities.cpp:1085:83: note: the temporary was destroyed at the end of the full expression ‘(& properties)->libcamera::ControlList::get<libcamera::Span<const libcamera::Rectangle> >(libcamera::properties::PixelArrayActiveAreas).std::optional<libcamera::Span<const libcamera::Rectangle> >::value_or<libcamera::Span<const libcamera::Rectangle> >(libcamera::Span<const libcamera::Rectangle>())’ 1085 | properties.get(properties::PixelArrayActiveAreas).value_or(Span<const Rectangle>{}); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ The return value of `value_or()` is indeed a temporary, but binding it to a reference extends its lifetime. Avoid the warning by not using a reference; this does not make much difference since `value_or()` does not return a reference. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
807119d1e0
commit
c79fa47aac
1 changed files with 1 additions and 1 deletions
|
@ -1081,7 +1081,7 @@ int CameraCapabilities::initializeStaticMetadata()
|
|||
}
|
||||
|
||||
{
|
||||
const Span<const Rectangle> &rects =
|
||||
const Span<const Rectangle> rects =
|
||||
properties.get(properties::PixelArrayActiveAreas).value_or(Span<const Rectangle>{});
|
||||
std::vector<int32_t> data{
|
||||
static_cast<int32_t>(rects[0].x),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue