Fix std::...::erase return value usages.
GitOrigin-RevId: d9729ccd619e3b99554f1e1c2262d8826f0a8571
This commit is contained in:
parent
54f32ebc80
commit
35a9a93fc9
@ -224,8 +224,8 @@ class MultiTd : public Actor {
|
||||
}
|
||||
|
||||
void close(int32 td_id) {
|
||||
size_t erased = tds_.erase(td_id);
|
||||
CHECK(erased > 0);
|
||||
size_t erased_count = tds_.erase(td_id);
|
||||
CHECK(erased_count > 0);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -14426,8 +14426,8 @@ unique_ptr<MessagesManager::Message> MessagesManager::do_delete_scheduled_messag
|
||||
auto result = treap_delete_message(v);
|
||||
|
||||
if (message_id.is_scheduled_server()) {
|
||||
size_t erased = d->scheduled_message_date.erase(message_id.get_scheduled_server_message_id());
|
||||
CHECK(erased != 0);
|
||||
size_t erased_count = d->scheduled_message_date.erase(message_id.get_scheduled_server_message_id());
|
||||
CHECK(erased_count != 0);
|
||||
}
|
||||
|
||||
cancel_send_deleted_message(d->dialog_id, result.get(), is_permanently_deleted);
|
||||
@ -20909,8 +20909,8 @@ void MessagesManager::on_get_dialog_message_by_date_success(DialogId dialog_id,
|
||||
}
|
||||
|
||||
void MessagesManager::on_get_dialog_message_by_date_fail(int64 random_id) {
|
||||
auto erased = get_dialog_message_by_date_results_.erase(random_id);
|
||||
CHECK(erased > 0);
|
||||
auto erased_count = get_dialog_message_by_date_results_.erase(random_id);
|
||||
CHECK(erased_count > 0);
|
||||
}
|
||||
|
||||
tl_object_ptr<td_api::message> MessagesManager::get_dialog_message_by_date_object(int64 random_id) {
|
||||
|
@ -643,7 +643,7 @@ void PollManager::unregister_poll(PollId poll_id, FullMessageId full_message_id,
|
||||
}
|
||||
LOG(INFO) << "Unregister " << poll_id << " from " << full_message_id << " from " << source;
|
||||
auto &message_ids = poll_messages_[poll_id];
|
||||
auto is_deleted = message_ids.erase(full_message_id);
|
||||
auto is_deleted = message_ids.erase(full_message_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << " " << poll_id << " " << full_message_id;
|
||||
if (message_ids.empty()) {
|
||||
poll_messages_.erase(poll_id);
|
||||
|
@ -3558,7 +3558,7 @@ void StickersManager::unregister_dice(const string &emoji, int32 value, FullMess
|
||||
LOG(INFO) << "Unregister dice " << emoji << " with value " << value << " from " << full_message_id << " from "
|
||||
<< source;
|
||||
auto &message_ids = dice_messages_[emoji];
|
||||
auto is_deleted = message_ids.erase(full_message_id);
|
||||
auto is_deleted = message_ids.erase(full_message_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << " " << emoji << " " << value << " " << full_message_id;
|
||||
|
||||
if (message_ids.empty()) {
|
||||
|
@ -715,7 +715,7 @@ void WebPagesManager::unregister_web_page(WebPageId web_page_id, FullMessageId f
|
||||
|
||||
LOG(INFO) << "Unregister " << web_page_id << " from " << full_message_id << " from " << source;
|
||||
auto &message_ids = web_page_messages_[web_page_id];
|
||||
auto is_deleted = message_ids.erase(full_message_id);
|
||||
auto is_deleted = message_ids.erase(full_message_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << " " << web_page_id << " " << full_message_id;
|
||||
|
||||
if (message_ids.empty()) {
|
||||
|
@ -368,7 +368,7 @@ class TQueueImpl : public TQueue {
|
||||
|
||||
void schedule_queue_gc(QueueId queue_id, Queue &q, int32 gc_at) {
|
||||
if (q.gc_at != 0) {
|
||||
bool is_deleted = queue_gc_at_.erase({q.gc_at, queue_id});
|
||||
bool is_deleted = queue_gc_at_.erase({q.gc_at, queue_id}) > 0;
|
||||
CHECK(is_deleted);
|
||||
}
|
||||
q.gc_at = gc_at;
|
||||
|
@ -472,8 +472,8 @@ void FileFd::remove_local_lock(const string &path) {
|
||||
if (!path.empty()) {
|
||||
VLOG(fd) << "Unlock file \"" << path << '"';
|
||||
std::unique_lock<std::mutex> lock(in_process_lock_mutex);
|
||||
auto erased = locked_files.erase(path);
|
||||
CHECK(erased > 0);
|
||||
auto erased_count = locked_files.erase(path);
|
||||
CHECK(erased_count > 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1009,8 +1009,8 @@ TEST(Client, Close) {
|
||||
receive_count++;
|
||||
{
|
||||
std::unique_lock<std::mutex> guard(request_ids_mutex);
|
||||
size_t erase_count = request_ids.erase(response.id);
|
||||
CHECK(erase_count > 0);
|
||||
size_t erased_count = request_ids.erase(response.id);
|
||||
CHECK(erased_count > 0);
|
||||
}
|
||||
}
|
||||
if (can_stop_receive && receive_count == send_count) {
|
||||
@ -1071,8 +1071,8 @@ TEST(Client, ManagerClose) {
|
||||
receive_count++;
|
||||
{
|
||||
std::unique_lock<std::mutex> guard(request_ids_mutex);
|
||||
size_t erase_count = request_ids.erase(response.request_id);
|
||||
CHECK(erase_count > 0);
|
||||
size_t erased_count = request_ids.erase(response.request_id);
|
||||
CHECK(erased_count > 0);
|
||||
}
|
||||
}
|
||||
if (can_stop_receive && receive_count == send_count) {
|
||||
|
Loading…
Reference in New Issue
Block a user