From 5c5c496b605886b286d1b99e0f9e28ec02117ad5 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Fri, 17 Oct 2025 14:06:48 +0800 Subject: Use std::from_chars. --- src/platform/graphics/Geometry.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/platform/graphics/Geometry.cpp') diff --git a/src/platform/graphics/Geometry.cpp b/src/platform/graphics/Geometry.cpp index e88577ce..4189ef72 100644 --- a/src/platform/graphics/Geometry.cpp +++ b/src/platform/graphics/Geometry.cpp @@ -1,7 +1,7 @@ #include "cru/platform/graphics/Geometry.h" #include "cru/base/Exception.h" -#include "cru/base/String.h" +#include "cru/base/StringUtil.h" #include "cru/platform/Exception.h" #include "cru/platform/graphics/Factory.h" @@ -235,17 +235,15 @@ void IGeometryBuilder::ParseAndApplySvgPathData(std::string_view path_d) { ++position; } - Index processed_count = 0; - auto result = String::FromUtf8(path_d.substr(position)) - .ParseToFloat(&processed_count, - StringToNumberFlags::kAllowTrailingJunk); + auto result = cru::string::ParseToNumber( + path_d.substr(position), cru::string::ParseToNumberFlags::AllowTrailingJunk); - if (std::isnan(result)) throw Exception("Invalid svg path data number."); + if (!result.valid) throw Exception("Invalid svg path data number."); - position += processed_count; + position += result.processed_char_count; - return result; + return result.value; }; auto read_point = [&] { -- cgit v1.2.3