Fixed several bugs found by PVS-Studio by @SvyatoslavRazmyslov.

GitOrigin-RevId: 768d822ff74740fe71c16ea1bba3c6fb74f01b15
This commit is contained in:
levlam 2018-03-20 15:18:16 +03:00
parent 20f2088690
commit e0924ea333
3 changed files with 3 additions and 6 deletions

View File

@ -2565,10 +2565,7 @@ class CliClient final : public Actor {
std::tie(chat_id, args) = split(args);
std::tie(user_id, status_str) = split(args);
if (status_str == "admin") {
status =
make_tl_object<td_api::chatMemberStatusAdministrator>(true, true, true, true, true, true, true, true, true);
} else if (status_str == "member") {
if (status_str == "member") {
status = make_tl_object<td_api::chatMemberStatusMember>();
} else if (status_str == "left") {
status = make_tl_object<td_api::chatMemberStatusLeft>();

View File

@ -122,7 +122,7 @@ void FileGcWorker::run_gc(const FileGcParameters &parameters, std::vector<FullFi
files.end());
// sort by max(atime, mtime)
std::sort(files.begin(), files.end(), [](const auto &a, const auto &b) { return a.atime_nsec < a.atime_nsec; });
std::sort(files.begin(), files.end(), [](const auto &a, const auto &b) { return a.atime_nsec < b.atime_nsec; });
// 1. Total memory must be less than max_memory
// 2. Total file count must be less than MAX_FILE_COUNT

View File

@ -923,7 +923,7 @@ Result<FileId> FileManager::merge(FileId x_file_id, FileId y_file_id, bool no_sy
if (!y_file_id.is_valid()) {
return x_node->main_file_id_;
}
FileNodePtr y_node = no_sync ? get_file_node(y_file_id) : get_file_node(y_file_id);
FileNodePtr y_node = get_file_node(y_file_id);
if (!y_node) {
return Status::Error(PSLICE() << "Can't merge files. Second id is invalid: " << x_file_id << " and " << y_file_id);
}