Use correct type for file_type_size.
GitOrigin-RevId: 63baf89ab57485f0bc0f902590271c40f34cf151
This commit is contained in:
parent
e5400074ce
commit
e63d5ec20f
@ -6,7 +6,6 @@
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "td/telegram/td_api.h"
|
||||
#include "td/telegram/telegram_api.h"
|
||||
|
||||
#include "td/telegram/files/FileBitmask.h"
|
||||
|
@ -580,7 +580,7 @@ FileManager::FileManager(unique_ptr<Context> context) : context_(std::move(conte
|
||||
FileFd::open(dirs.back() + ".nomedia", FileFd::Create | FileFd::Read).ignore();
|
||||
#endif
|
||||
};
|
||||
for (int i = 0; i < file_type_size; i++) {
|
||||
for (int32 i = 0; i < file_type_size; i++) {
|
||||
auto path = get_files_dir(FileType(i));
|
||||
create_dir(path);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ void FileStats::add(FullFileInfo &&info) {
|
||||
|
||||
FileTypeStat get_nontemp_stat(const FileStats::StatByType &by_type) {
|
||||
FileTypeStat stat;
|
||||
for (size_t i = 0; i < file_type_size; i++) {
|
||||
for (int32 i = 0; i < file_type_size; i++) {
|
||||
if (FileType(i) != FileType::Temp) {
|
||||
stat.size += by_type[i].size;
|
||||
stat.cnt += by_type[i].cnt;
|
||||
@ -103,7 +103,7 @@ void FileStats::apply_dialog_limit(int32 limit) {
|
||||
if (all_dialogs.count(it->first)) {
|
||||
++it;
|
||||
} else {
|
||||
for (size_t i = 0; i < file_type_size; i++) {
|
||||
for (int32 i = 0; i < file_type_size; i++) {
|
||||
other_stats[i].size += it->second[i].size;
|
||||
other_stats[i].cnt += it->second[i].cnt;
|
||||
}
|
||||
@ -123,7 +123,7 @@ tl_object_ptr<td_api::storageStatisticsByChat> as_td_api(DialogId dialog_id,
|
||||
auto stats = make_tl_object<td_api::storageStatisticsByChat>(dialog_id.get(), 0, 0, Auto());
|
||||
int64 secure_raw_size = 0;
|
||||
int32 secure_raw_cnt = 0;
|
||||
for (size_t i = 0; i < file_type_size; i++) {
|
||||
for (int32 i = 0; i < file_type_size; i++) {
|
||||
FileType file_type = static_cast<FileType>(i);
|
||||
auto size = stat_by_type[i].size;
|
||||
auto cnt = stat_by_type[i].cnt;
|
||||
@ -200,7 +200,7 @@ StringBuilder &operator<<(StringBuilder &sb, const FileStats &file_stats) {
|
||||
}
|
||||
|
||||
sb << "[FileStat " << tag("total", total_stat);
|
||||
for (int i = 0; i < file_type_size; i++) {
|
||||
for (int32 i = 0; i < file_type_size; i++) {
|
||||
sb << tag(Slice(file_type_name[i]), file_stats.stat_by_type[i]);
|
||||
}
|
||||
sb << "]";
|
||||
@ -223,7 +223,7 @@ StringBuilder &operator<<(StringBuilder &sb, const FileStats &file_stats) {
|
||||
}
|
||||
|
||||
sb << "[FileStat " << tag("owner_dialog_id", by_type.first) << tag("total", dialog_stat);
|
||||
for (int i = 0; i < file_type_size; i++) {
|
||||
for (int32 i = 0; i < file_type_size; i++) {
|
||||
sb << tag(Slice(file_type_name[i]), by_type.second[i]);
|
||||
}
|
||||
sb << "]";
|
||||
|
@ -96,7 +96,7 @@ struct FsFileInfo {
|
||||
// long and blocking
|
||||
template <class CallbackT>
|
||||
Status scan_fs(CallbackT &&callback) {
|
||||
for (int i = 0; i < file_type_size; i++) {
|
||||
for (int32 i = 0; i < file_type_size; i++) {
|
||||
auto file_type = static_cast<FileType>(i);
|
||||
if (file_type == FileType::SecureRaw) {
|
||||
continue;
|
||||
|
@ -168,7 +168,7 @@ void NetStatsManager::add_network_stats(const NetworkStatsEntry &entry) {
|
||||
}
|
||||
add_network_stats_impl(media_net_stats_, entry);
|
||||
size_t file_type_n = static_cast<size_t>(entry.file_type);
|
||||
CHECK(file_type_n < file_type_size);
|
||||
CHECK(file_type_n < static_cast<size_t>(file_type_size));
|
||||
add_network_stats_impl(files_stats_[file_type_n], entry);
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ class NetStatsManager : public Actor {
|
||||
void for_each_stat(F &&f) {
|
||||
f(common_net_stats_, 0, CSlice("common"), FileType::None);
|
||||
f(media_net_stats_, 1, CSlice("media"), FileType::None);
|
||||
for (size_t file_type_i = 0; file_type_i < file_type_size; file_type_i++) {
|
||||
for (int32 file_type_i = 0; file_type_i < file_type_size; file_type_i++) {
|
||||
auto &stat = files_stats_[file_type_i];
|
||||
f(stat, file_type_i + 2, CSlice(file_type_name[file_type_i]), FileType(file_type_i));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user