forked from pool/kseexpr
44 lines
1.4 KiB
Diff
44 lines
1.4 KiB
Diff
From 1e8e6c8da1e22c4d32e50d8999705fd370824736 Mon Sep 17 00:00:00 2001
|
|
From: "L. E. Segovia" <amy@amyspark.me>
|
|
Date: Tue, 1 Jun 2021 23:35:40 +0000
|
|
Subject: [PATCH] Fix charconv support with MSVC/GCC11
|
|
|
|
BUG: 437890
|
|
---
|
|
src/KSeExpr/Utils.cpp | 5 +++--
|
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/KSeExpr/Utils.cpp b/src/KSeExpr/Utils.cpp
|
|
index 22e6cd8..e48cfe9 100644
|
|
--- a/src/KSeExpr/Utils.cpp
|
|
+++ b/src/KSeExpr/Utils.cpp
|
|
@@ -6,6 +6,7 @@
|
|
|
|
#if defined(KSeExpr_HAVE_CHARCONV_WITH_DOUBLES)
|
|
#include <charconv>
|
|
+#include <cstring>
|
|
|
|
double_t KSeExpr::Utils::atof(const char *num)
|
|
{
|
|
@@ -21,7 +22,7 @@ double_t KSeExpr::Utils::atof(const char *num)
|
|
double_t KSeExpr::Utils::atof(const std::string &num)
|
|
{
|
|
double_t v;
|
|
- auto [p, ec] = std::from_chars(val.data(), val.data() + val.size(), v);
|
|
+ auto [p, ec] = std::from_chars(num.data(), num.data() + num.size(), v);
|
|
if (ec == std::errc()) {
|
|
return v;
|
|
} else {
|
|
@@ -32,7 +33,7 @@ double_t KSeExpr::Utils::atof(const std::string &num)
|
|
int32_t KSeExpr::Utils::strtol(const std::string &num)
|
|
{
|
|
int32_t v;
|
|
- auto [p, ec] = std::from_chars(val.data(), val.data() + val.size(), v);
|
|
+ auto [p, ec] = std::from_chars(num.data(), num.data() + num.size(), v);
|
|
if (ec == std::errc()) {
|
|
return v;
|
|
} else if (ec == std::errc::result_out_of_range) {
|
|
--
|
|
2.31.1
|
|
|