From 3d7e50fd715dee709da9e2a8c9ccd4892f4d5f75 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 21 Jun 2024 15:00:37 +0300 Subject: libcamera: yaml_parser: Add support for float types The YamlObject::get() function template has a specialization for double but not for float. When used in an IPA module, the issue is caught at module load time only, when dynamic links are resolved, causing errors such as Failed to open IPA module shared object: /usr/lib/libcamera/ipa_rkisp1.so: undefined symbol: _ZNK9libcamera10YamlObject6GetterIfE3getERK_ Fix it by adding a float specialization. The alternative would be to use double only in IPA modules, but the lack of enforcement at compile time makes this dangerous. Signed-off-by: Laurent Pinchart Tested-by: Jacopo Mondi Reviewed-by: Stefan Klug --- src/libcamera/yaml_parser.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp index 56670ba7..025006bc 100644 --- a/src/libcamera/yaml_parser.cpp +++ b/src/libcamera/yaml_parser.cpp @@ -278,6 +278,13 @@ YamlObject::Getter::get(const YamlObject &obj) const return value; } +template<> +std::optional +YamlObject::Getter::get(const YamlObject &obj) const +{ + return obj.get(); +} + template<> std::optional YamlObject::Getter::get(const YamlObject &obj) const @@ -349,6 +356,7 @@ YamlObject::Getter::get(const YamlObject &obj) const template || + std::is_same_v || std::is_same_v || std::is_same_v || std::is_same_v || @@ -377,6 +385,7 @@ std::optional> YamlObject::getList() const } template std::optional> YamlObject::getList() const; +template std::optional> YamlObject::getList() const; template std::optional> YamlObject::getList() const; template std::optional> YamlObject::getList() const; template std::optional> YamlObject::getList() const; -- cgit v1.2.1