summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/base/utils.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libcamera/base/utils.cpp b/src/libcamera/base/utils.cpp
index 4a239427..3b73b442 100644
--- a/src/libcamera/base/utils.cpp
+++ b/src/libcamera/base/utils.cpp
@@ -464,6 +464,8 @@ std::string toAscii(const std::string &str)
* \a b
*/
+#if HAVE_LOCALE_T
+
namespace {
/*
@@ -493,6 +495,8 @@ Locale cLocale("C");
} /* namespace */
+#endif /* HAVE_LOCALE_T */
+
/**
* \brief Convert a string to a double independently of the current locale
* \param[in] nptr The string to convert
@@ -506,7 +510,15 @@ Locale cLocale("C");
*/
double strtod(const char *__restrict nptr, char **__restrict endptr)
{
+#if HAVE_LOCALE_T
return strtod_l(nptr, endptr, cLocale.locale());
+#else
+ /*
+ * If the libc implementation doesn't provide locale object support,
+ * assume that strtod() is locale-independent.
+ */
+ return strtod(nptr, endptr);
+#endif
}
} /* namespace utils */