Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatible with cpp17 #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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