From b009bffeb7ee21ddf3451ba4396845947c3c1744 Mon Sep 17 00:00:00 2001 From: xiaodao Date: Thu, 3 Mar 2022 00:52:26 +0800 Subject: [PATCH] Compatible with cpp17 --- src/pending_message.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pending_message.cpp b/src/pending_message.cpp index 9541ef4de5..ffd46497e9 100644 --- a/src/pending_message.cpp +++ b/src/pending_message.cpp @@ -76,10 +76,10 @@ std::string PendingMessage::ApplyTextInsertingCommands(std::string input, uint32 std::string output; - auto iter = input.data(); + const char* iter = input.data(); const auto end = input.data() + input.size(); - auto start_copy = iter; + const char* start_copy = iter; while (iter != end) { auto ret = Utils::UTF8Next(iter, end); if (ret.ch != escape_char) { @@ -92,7 +92,7 @@ std::string PendingMessage::ApplyTextInsertingCommands(std::string input, uint32 break; } - output.append(start_copy, iter); + output.append(start_copy, iter - start_copy); start_copy = iter; iter = ret.next; @@ -132,7 +132,7 @@ std::string PendingMessage::ApplyTextInsertingCommands(std::string input, uint32 // Fast path - no substitutions occured, so just move the input into the return value. output = std::move(input); } else { - output.append(start_copy, end); + output.append(start_copy, end - start_copy); } return output;