From a7c76bb1bdbb728597049f0d73d8f07f1cfcc5c9 Mon Sep 17 00:00:00 2001 From: Qijia Liu Date: Tue, 14 Jan 2025 21:46:03 -0500 Subject: [PATCH 1/2] fix: iterator is not pointer --- src/lib/fcitx-utils/semver.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/fcitx-utils/semver.cpp b/src/lib/fcitx-utils/semver.cpp index 057fae8f..627d3d15 100644 --- a/src/lib/fcitx-utils/semver.cpp +++ b/src/lib/fcitx-utils/semver.cpp @@ -33,7 +33,7 @@ bool isIdChar(char c) { } std::optional consumeNumericIdentifier(std::string_view &str) { - const auto *endOfNum = + auto endOfNum = std::find_if_not(str.begin(), str.end(), charutils::isdigit); auto length = std::distance(str.begin(), endOfNum); if (length == 0) { @@ -45,8 +45,8 @@ std::optional consumeNumericIdentifier(std::string_view &str) { auto numberStr = str.substr(0, length); uint32_t number; - if (auto [p, ec] = - std::from_chars(numberStr.begin(), numberStr.end(), number); + if (auto [p, ec] = std::from_chars( + numberStr.data(), numberStr.data() + numberStr.size(), number); ec == std::errc()) { str.remove_prefix(length); return number; From b71f7b2fd89a0f6efd96194e3c3753a36cce4b5e Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Wed, 15 Jan 2025 19:03:34 -0800 Subject: [PATCH 2/2] Use explicit type to avoid clang-tidy complain --- src/lib/fcitx-utils/semver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/fcitx-utils/semver.cpp b/src/lib/fcitx-utils/semver.cpp index 627d3d15..867f1372 100644 --- a/src/lib/fcitx-utils/semver.cpp +++ b/src/lib/fcitx-utils/semver.cpp @@ -33,7 +33,7 @@ bool isIdChar(char c) { } std::optional consumeNumericIdentifier(std::string_view &str) { - auto endOfNum = + std::string_view::iterator endOfNum = std::find_if_not(str.begin(), str.end(), charutils::isdigit); auto length = std::distance(str.begin(), endOfNum); if (length == 0) {