Skip to content

Commit

Permalink
Merge pull request #2745 from TokimiSpace/master
Browse files Browse the repository at this point in the history
Compatible with cpp17
  • Loading branch information
Ghabry authored Mar 3, 2022
2 parents a1f7859 + b009bff commit 09d0e27
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pending_message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 09d0e27

Please sign in to comment.