Use preincrement for iterators.
This commit is contained in:
parent
f8ab675ad1
commit
d985e3cc84
@ -1440,7 +1440,7 @@ static void remove_entities_intersecting_blockquote(vector<MessageEntity> &entit
|
|||||||
while (blockquote_it != blockquote_entities.end() &&
|
while (blockquote_it != blockquote_entities.end() &&
|
||||||
(blockquote_it->type != MessageEntity::Type::BlockQuote ||
|
(blockquote_it->type != MessageEntity::Type::BlockQuote ||
|
||||||
blockquote_it->offset + blockquote_it->length <= entities[i].offset)) {
|
blockquote_it->offset + blockquote_it->length <= entities[i].offset)) {
|
||||||
blockquote_it++;
|
++blockquote_it;
|
||||||
}
|
}
|
||||||
if (blockquote_it != blockquote_entities.end() &&
|
if (blockquote_it != blockquote_entities.end() &&
|
||||||
(blockquote_it->offset + blockquote_it->length < entities[i].offset + entities[i].length ||
|
(blockquote_it->offset + blockquote_it->length < entities[i].offset + entities[i].length ||
|
||||||
@ -1546,17 +1546,17 @@ static vector<MessageEntity> merge_entities(vector<MessageEntity> old_entities,
|
|||||||
for (auto &old_entity : old_entities) {
|
for (auto &old_entity : old_entities) {
|
||||||
while (new_it != new_end && new_it->offset + new_it->length <= old_entity.offset) {
|
while (new_it != new_end && new_it->offset + new_it->length <= old_entity.offset) {
|
||||||
result.push_back(std::move(*new_it));
|
result.push_back(std::move(*new_it));
|
||||||
new_it++;
|
++new_it;
|
||||||
}
|
}
|
||||||
auto old_entity_end = old_entity.offset + old_entity.length;
|
auto old_entity_end = old_entity.offset + old_entity.length;
|
||||||
result.push_back(std::move(old_entity));
|
result.push_back(std::move(old_entity));
|
||||||
while (new_it != new_end && new_it->offset < old_entity_end) {
|
while (new_it != new_end && new_it->offset < old_entity_end) {
|
||||||
new_it++;
|
++new_it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (new_it != new_end) {
|
while (new_it != new_end) {
|
||||||
result.push_back(std::move(*new_it));
|
result.push_back(std::move(*new_it));
|
||||||
new_it++;
|
++new_it;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -441,8 +441,8 @@ void SetSecureValue::start_up() {
|
|||||||
for (auto it = secure_value_.files.begin(); it != secure_value_.files.end();) {
|
for (auto it = secure_value_.files.begin(); it != secure_value_.files.end();) {
|
||||||
auto file_id = file_manager->get_file_view(it->file_id).file_id();
|
auto file_id = file_manager->get_file_view(it->file_id).file_id();
|
||||||
bool is_duplicate = false;
|
bool is_duplicate = false;
|
||||||
for (auto pit = secure_value_.files.begin(); pit != it; pit++) {
|
for (auto other_it = secure_value_.files.begin(); other_it != it; ++other_it) {
|
||||||
if (file_id == file_manager->get_file_view(pit->file_id).file_id()) {
|
if (file_id == file_manager->get_file_view(other_it->file_id).file_id()) {
|
||||||
is_duplicate = true;
|
is_duplicate = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -458,8 +458,8 @@ void SetSecureValue::start_up() {
|
|||||||
for (auto it = secure_value_.translations.begin(); it != secure_value_.translations.end();) {
|
for (auto it = secure_value_.translations.begin(); it != secure_value_.translations.end();) {
|
||||||
auto file_id = file_manager->get_file_view(it->file_id).file_id();
|
auto file_id = file_manager->get_file_view(it->file_id).file_id();
|
||||||
bool is_duplicate = file_id == front_side_file_id || file_id == reverse_side_file_id || file_id == selfie_file_id;
|
bool is_duplicate = file_id == front_side_file_id || file_id == reverse_side_file_id || file_id == selfie_file_id;
|
||||||
for (auto pit = secure_value_.translations.begin(); pit != it; pit++) {
|
for (auto other_it = secure_value_.translations.begin(); other_it != it; ++other_it) {
|
||||||
if (file_id == file_manager->get_file_view(pit->file_id).file_id()) {
|
if (file_id == file_manager->get_file_view(other_it->file_id).file_id()) {
|
||||||
is_duplicate = true;
|
is_duplicate = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -136,8 +136,8 @@ void update_suggested_actions(vector<SuggestedAction> &suggested_actions,
|
|||||||
} else if (old_it == suggested_actions.end() || *new_it < *old_it) {
|
} else if (old_it == suggested_actions.end() || *new_it < *old_it) {
|
||||||
added_actions.push_back(*new_it++);
|
added_actions.push_back(*new_it++);
|
||||||
} else {
|
} else {
|
||||||
old_it++;
|
++old_it;
|
||||||
new_it++;
|
++new_it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CHECK(!added_actions.empty() || !removed_actions.empty());
|
CHECK(!added_actions.empty() || !removed_actions.empty());
|
||||||
|
Loading…
Reference in New Issue
Block a user