summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-01-05 14:07:54 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-01-10 15:39:18 +0200
commit0e3b8d71f590d93540b2e6a6500cc7739f7199e9 (patch)
tree5d0665694004bf0963bb91cce133f29b578b764a /include
parent2535e31d9ec548aacbbee8307f4ab6f330d7c17d (diff)
base: utils: Add and use strtod() helper
The strtod() function is locale-dependent, and thus ill-suited to parse numbers coming from, for instance, YAML files. The YamlObject class uses strtod_l() to fix that issue, but that function is not available with all libc implementations. Correctly handling this problem is becoming out of scope for the YamlObject class. As a first step, add a strtod() helper function in the utils namespace that copies the implementation from YamlObject, and use it in YamlObject. The core issue will then be fixed in utils::strtod(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/base/utils.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h
index eb7bcdf4..37d9af60 100644
--- a/include/libcamera/base/utils.h
+++ b/include/libcamera/base/utils.h
@@ -367,6 +367,8 @@ decltype(auto) abs_diff(const T &a, const T &b)
return a - b;
}
+double strtod(const char *__restrict nptr, char **__restrict endptr);
+
} /* namespace utils */
#ifndef __DOXYGEN__