aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorlevlam <levlam@telegram.org>2021-11-11 17:39:09 +0300
committerlevlam <levlam@telegram.org>2021-11-11 17:39:09 +0300
commitb731414d42c0766bd106fcbd137406586af2e7ba (patch)
treeae23ee7faa9ad2c580326714c6c7bcaf14ec22fe
parent712197ad6d8db03549d8fe10af5e8231b818e2b2 (diff)
Init some fields just in case.
-rw-r--r--benchmark/bench_http.cpp2
-rw-r--r--td/mtproto/HttpTransport.h2
-rw-r--r--td/mtproto/PacketInfo.h16
-rw-r--r--td/mtproto/SessionConnection.h6
-rw-r--r--td/mtproto/TcpTransport.h8
-rw-r--r--td/mtproto/TlsInit.cpp4
-rw-r--r--td/telegram/AuthManager.h2
-rw-r--r--td/telegram/BackgroundManager.cpp13
-rw-r--r--td/telegram/BackgroundManager.h10
-rw-r--r--td/telegram/ConfigManager.cpp2
-rw-r--r--td/telegram/ContactsManager.h2
-rw-r--r--td/telegram/DialogAction.h2
-rw-r--r--td/telegram/DraftMessage.h2
-rw-r--r--td/telegram/FileReferenceManager.h4
-rw-r--r--td/telegram/Global.h4
-rw-r--r--td/telegram/Location.cpp7
-rw-r--r--td/telegram/Location.h7
-rw-r--r--td/telegram/MessagesManager.h2
-rw-r--r--td/telegram/PasswordManager.h4
-rw-r--r--td/telegram/PhoneNumberManager.h2
-rw-r--r--td/telegram/PhotoSizeSource.h2
-rw-r--r--td/telegram/SecretChatActor.h6
-rw-r--r--td/telegram/SecureValue.h2
-rw-r--r--td/telegram/StickersManager.h6
-rw-r--r--td/telegram/Td.cpp4
-rw-r--r--td/telegram/ThemeManager.h2
-rw-r--r--td/telegram/UpdatesManager.h2
-rw-r--r--td/telegram/cli.cpp2
-rw-r--r--td/telegram/files/FileLoader.h12
-rw-r--r--td/telegram/files/FileManager.h2
-rw-r--r--td/telegram/files/FileUploader.h6
-rw-r--r--td/telegram/files/PartsManager.h36
-rw-r--r--td/telegram/files/ResourceManager.h2
-rw-r--r--td/telegram/net/ConnectionCreator.cpp18
-rw-r--r--td/telegram/net/ConnectionCreator.h4
-rw-r--r--td/telegram/net/DcAuthManager.h4
-rw-r--r--td/telegram/net/DcOptionsSet.h2
-rw-r--r--td/telegram/net/MtprotoHeader.h2
-rw-r--r--td/telegram/net/Session.h4
-rw-r--r--td/telegram/net/SessionProxy.h2
-rw-r--r--tdactor/td/actor/ConcurrentScheduler.h2
-rw-r--r--tdactor/td/actor/PromiseFuture.h2
-rw-r--r--tddb/td/db/binlog/Binlog.h2
-rw-r--r--tdnet/td/net/GetHostByNameActor.h2
-rw-r--r--tdutils/td/utils/TsFileLog.cpp4
-rw-r--r--tdutils/test/ConcurrentHashMap.cpp3
46 files changed, 120 insertions, 116 deletions
diff --git a/benchmark/bench_http.cpp b/benchmark/bench_http.cpp
index 2ec548a53..f1147c01c 100644
--- a/benchmark/bench_http.cpp
+++ b/benchmark/bench_http.cpp
@@ -61,7 +61,7 @@ class HttpClient final : public td::HttpOutboundConnection::Callback {
}
td::ActorOwn<td::HttpOutboundConnection> connection_;
- int cnt_;
+ int cnt_ = 0;
};
int main() {
diff --git a/td/mtproto/HttpTransport.h b/td/mtproto/HttpTransport.h
index e246a0428..25db38102 100644
--- a/td/mtproto/HttpTransport.h
+++ b/td/mtproto/HttpTransport.h
@@ -49,7 +49,7 @@ class Transport final : public IStreamTransport {
string secret_;
HttpReader reader_;
HttpQuery http_query_;
- ChainBufferWriter *output_;
+ ChainBufferWriter *output_ = nullptr;
enum { Write, Read } turn_ = Write;
};
diff --git a/td/mtproto/PacketInfo.h b/td/mtproto/PacketInfo.h
index 17b3f2c52..a6907eee3 100644
--- a/td/mtproto/PacketInfo.h
+++ b/td/mtproto/PacketInfo.h
@@ -14,17 +14,17 @@ namespace mtproto {
struct PacketInfo {
enum { Common, EndToEnd } type = Common;
- uint64 auth_key_id;
- uint32 message_ack;
- UInt128 message_key;
+ uint64 auth_key_id{0};
+ uint32 message_ack{0};
+ UInt128 message_key{};
- uint64 salt;
- uint64 session_id;
+ uint64 salt{0};
+ uint64 session_id{0};
- uint64 message_id;
- int32 seq_no;
+ uint64 message_id{0};
+ int32 seq_no{0};
int32 version{1};
- bool no_crypto_flag;
+ bool no_crypto_flag{false};
bool is_creator{false};
bool check_mod4{true};
bool use_random_padding{false};
diff --git a/td/mtproto/SessionConnection.h b/td/mtproto/SessionConnection.h
index f1a927aa6..413defd64 100644
--- a/td/mtproto/SessionConnection.h
+++ b/td/mtproto/SessionConnection.h
@@ -188,8 +188,8 @@ class SessionConnection final
uint64 last_ping_message_id_ = 0;
uint64 last_ping_container_id_ = 0;
- bool need_destroy_auth_key_{false};
- bool sent_destroy_auth_key_{false};
+ bool need_destroy_auth_key_ = false;
+ bool sent_destroy_auth_key_ = false;
double wakeup_at_ = 0;
double flush_packet_at_ = 0;
@@ -206,7 +206,7 @@ class SessionConnection final
unique_ptr<RawConnection> raw_connection_;
AuthData *auth_data_;
SessionConnection::Callback *callback_ = nullptr;
- BufferSlice *current_buffer_slice_;
+ BufferSlice *current_buffer_slice_ = nullptr;
BufferSlice as_buffer_slice(Slice packet);
auto set_buffer_slice(BufferSlice *buffer_slice) TD_WARN_UNUSED_RESULT {
diff --git a/td/mtproto/TcpTransport.h b/td/mtproto/TcpTransport.h
index 4a2b918d9..d2fbc3e01 100644
--- a/td/mtproto/TcpTransport.h
+++ b/td/mtproto/TcpTransport.h
@@ -122,8 +122,8 @@ class OldTransport final : public IStreamTransport {
private:
TransportImpl impl_{false};
- ChainBufferReader *input_;
- ChainBufferWriter *output_;
+ ChainBufferReader *input_{nullptr};
+ ChainBufferWriter *output_{nullptr};
};
class ObfuscatedTransport final : public IStreamTransport {
@@ -193,9 +193,9 @@ class ObfuscatedTransport final : public IStreamTransport {
// TODO: use ByteFlow?
// One problem is that BufferedFd owns output_buffer_
// The other problem is that first 56 bytes must be sent unencrypted.
- UInt256 output_key_;
+ UInt256 output_key_{};
AesCtrState output_state_;
- ChainBufferWriter *output_;
+ ChainBufferWriter *output_ = nullptr;
void do_write_tls(BufferWriter &&message);
void do_write_tls(BufferBuilder &&builder);
diff --git a/td/mtproto/TlsInit.cpp b/td/mtproto/TlsInit.cpp
index 21591de49..a41dd1a35 100644
--- a/td/mtproto/TlsInit.cpp
+++ b/td/mtproto/TlsInit.cpp
@@ -128,7 +128,6 @@ class TlsHello {
Op::string("\x03\x04\x03\x03\x03\x02\x03\x01"),
Op::grease(3),
Op::string("\x00\x01\x00\x00\x15")};
- res.grease_size_ = 7;
#else
res.ops_ = {
Op::string("\x16\x03\x01\x02\x00\x01\x00\x01\xfc\x03\x03"),
@@ -163,7 +162,6 @@ class TlsHello {
Op::string("\x03\x04\x03\x03\x03\x02\x03\x01\x00\x1b\x00\x03\x02\x00\x02"),
Op::grease(3),
Op::string("\x00\x01\x00\x00\x15")};
- res.grease_size_ = 7;
#endif
return res;
}();
@@ -180,7 +178,7 @@ class TlsHello {
private:
std::vector<Op> ops_;
- size_t grease_size_;
+ size_t grease_size_ = 7;
};
class TlsHelloContext {
diff --git a/td/telegram/AuthManager.h b/td/telegram/AuthManager.h
index cdff296c6..d8d58ab82 100644
--- a/td/telegram/AuthManager.h
+++ b/td/telegram/AuthManager.h
@@ -211,7 +211,7 @@ class AuthManager final : public NetActor {
bool was_check_bot_token_ = false;
bool is_bot_ = false;
uint64 net_query_id_ = 0;
- NetQueryType net_query_type_;
+ NetQueryType net_query_type_ = NetQueryType::None;
vector<uint64> pending_get_authorization_state_requests_;
diff --git a/td/telegram/BackgroundManager.cpp b/td/telegram/BackgroundManager.cpp
index 95aaba445..58241e1ee 100644
--- a/td/telegram/BackgroundManager.cpp
+++ b/td/telegram/BackgroundManager.cpp
@@ -809,8 +809,9 @@ void BackgroundManager::save_local_backgrounds(bool for_dark_theme) {
void BackgroundManager::upload_background_file(FileId file_id, const BackgroundType &type, bool for_dark_theme,
Promise<Unit> &&promise) {
auto upload_file_id = td_->file_manager_->dup_file_id(file_id);
-
- being_uploaded_files_[upload_file_id] = {type, for_dark_theme, std::move(promise)};
+ bool is_inserted =
+ being_uploaded_files_.emplace(upload_file_id, UploadedFileInfo(type, for_dark_theme, std::move(promise))).second;
+ CHECK(is_inserted);
LOG(INFO) << "Ask to upload background file " << upload_file_id;
td_->file_manager_->upload(upload_file_id, upload_background_file_callback_, 1, 0);
}
@@ -821,9 +822,9 @@ void BackgroundManager::on_upload_background_file(FileId file_id, tl_object_ptr<
auto it = being_uploaded_files_.find(file_id);
CHECK(it != being_uploaded_files_.end());
- auto type = it->second.type;
- auto for_dark_theme = it->second.for_dark_theme;
- auto promise = std::move(it->second.promise);
+ auto type = it->second.type_;
+ auto for_dark_theme = it->second.for_dark_theme_;
+ auto promise = std::move(it->second.promise_);
being_uploaded_files_.erase(it);
@@ -842,7 +843,7 @@ void BackgroundManager::on_upload_background_file_error(FileId file_id, Status s
auto it = being_uploaded_files_.find(file_id);
CHECK(it != being_uploaded_files_.end());
- auto promise = std::move(it->second.promise);
+ auto promise = std::move(it->second.promise_);
being_uploaded_files_.erase(it);
diff --git a/td/telegram/BackgroundManager.h b/td/telegram/BackgroundManager.h
index 267ac4eab..91bf339ac 100644
--- a/td/telegram/BackgroundManager.h
+++ b/td/telegram/BackgroundManager.h
@@ -182,9 +182,13 @@ class BackgroundManager final : public Actor {
std::shared_ptr<UploadBackgroundFileCallback> upload_background_file_callback_;
struct UploadedFileInfo {
- BackgroundType type;
- bool for_dark_theme;
- Promise<Unit> promise;
+ BackgroundType type_;
+ bool for_dark_theme_;
+ Promise<Unit> promise_;
+
+ UploadedFileInfo(BackgroundType type, bool for_dark_theme, Promise<Unit> &&promise)
+ : type_(type), for_dark_theme_(for_dark_theme), promise_(std::move(promise)) {
+ }
};
std::unordered_map<FileId, UploadedFileInfo, FileIdHash> being_uploaded_files_;
diff --git a/td/telegram/ConfigManager.cpp b/td/telegram/ConfigManager.cpp
index b41fec66a..89dd43e11 100644
--- a/td/telegram/ConfigManager.cpp
+++ b/td/telegram/ConfigManager.cpp
@@ -728,7 +728,7 @@ class ConfigRecoverer final : public Actor {
DcOptions dc_options_; // dc_options_update_ + simple_config_
double dc_options_at_{0};
- size_t dc_options_i_;
+ size_t dc_options_i_{0};
size_t date_option_i_{0};
diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h
index 574f905dd..dbc2ccc4b 100644
--- a/td/telegram/ContactsManager.h
+++ b/td/telegram/ContactsManager.h
@@ -907,7 +907,7 @@ class ContactsManager final : public Actor {
struct SecretChat {
int64 access_hash = 0;
UserId user_id;
- SecretChatState state;
+ SecretChatState state = SecretChatState::Unknown;
string key_hash;
int32 ttl = 0;
int32 date = 0;
diff --git a/td/telegram/DialogAction.h b/td/telegram/DialogAction.h
index bfae5f1b7..d325bc96b 100644
--- a/td/telegram/DialogAction.h
+++ b/td/telegram/DialogAction.h
@@ -79,7 +79,7 @@ class DialogAction {
string get_watching_animations_emoji() const;
struct ClickingAnimateEmojiInfo {
- int32 message_id;
+ int32 message_id = 0;
string emoji;
string data;
};
diff --git a/td/telegram/DraftMessage.h b/td/telegram/DraftMessage.h
index 65f8806cd..74c79d6ad 100644
--- a/td/telegram/DraftMessage.h
+++ b/td/telegram/DraftMessage.h
@@ -21,7 +21,7 @@ class ContactsManager;
class DraftMessage {
public:
- int32 date;
+ int32 date = 0;
MessageId reply_to_message_id;
InputMessageText input_message_text;
};
diff --git a/td/telegram/FileReferenceManager.h b/td/telegram/FileReferenceManager.h
index 980df045d..f9129cac3 100644
--- a/td/telegram/FileReferenceManager.h
+++ b/td/telegram/FileReferenceManager.h
@@ -80,13 +80,13 @@ class FileReferenceManager final : public Actor {
return node_id.empty();
}
NodeId node_id;
- int64 generation;
+ int64 generation{0};
};
struct Query {
std::vector<Promise<>> promises;
int32 active_queries{0};
Destination proxy;
- int64 generation;
+ int64 generation{0};
};
struct Node {
diff --git a/td/telegram/Global.h b/td/telegram/Global.h
index 9bdee22bc..1cefd0e4e 100644
--- a/td/telegram/Global.h
+++ b/td/telegram/Global.h
@@ -452,8 +452,8 @@ class Global final : public ActorContext {
unique_ptr<MtprotoHeader> mtproto_header_;
TdParameters parameters_;
- int32 gc_scheduler_id_;
- int32 slow_net_scheduler_id_;
+ int32 gc_scheduler_id_ = 0;
+ int32 slow_net_scheduler_id_ = 0;
std::atomic<bool> store_all_files_in_files_directory_{false};
diff --git a/td/telegram/Location.cpp b/td/telegram/Location.cpp
index 2d5d4f854..f2ad1e717 100644
--- a/td/telegram/Location.cpp
+++ b/td/telegram/Location.cpp
@@ -157,12 +157,7 @@ Result<InputMessageLocation> process_input_message_location(
return Status::Error(400, "Wrong live location proximity alert radius specified");
}
- InputMessageLocation result;
- result.location = std::move(location);
- result.live_period = period;
- result.heading = heading;
- result.proximity_alert_radius = proximity_alert_radius;
- return std::move(result);
+ return InputMessageLocation(std::move(location), period, heading, proximity_alert_radius);
}
} // namespace td
diff --git a/td/telegram/Location.h b/td/telegram/Location.h
index 6f27d7e68..1d094bf21 100644
--- a/td/telegram/Location.h
+++ b/td/telegram/Location.h
@@ -126,6 +126,13 @@ struct InputMessageLocation {
int32 live_period;
int32 heading;
int32 proximity_alert_radius;
+
+ InputMessageLocation(Location &&location, int32 live_period, int32 heading, int32 proximity_alert_radius)
+ : location(std::move(location))
+ , live_period(live_period)
+ , heading(heading)
+ , proximity_alert_radius(proximity_alert_radius) {
+ }
};
Result<InputMessageLocation> process_input_message_location(
td_api::object_ptr<td_api::InputMessageContent> &&input_message_content) TD_WARN_UNUSED_RESULT;
diff --git a/td/telegram/MessagesManager.h b/td/telegram/MessagesManager.h
index 13065b69d..81312d929 100644
--- a/td/telegram/MessagesManager.h
+++ b/td/telegram/MessagesManager.h
@@ -1035,7 +1035,7 @@ class MessagesManager final : public Actor {
// Do not forget to update MessagesManager::update_message and all make_unique<Message> when this class is changed
struct Message {
- int32 random_y;
+ int32 random_y = 0;
MessageId message_id;
UserId sender_user_id;
diff --git a/td/telegram/PasswordManager.h b/td/telegram/PasswordManager.h
index d622352db..c63fcb901 100644
--- a/td/telegram/PasswordManager.h
+++ b/td/telegram/PasswordManager.h
@@ -112,10 +112,10 @@ class PasswordManager final : public NetQueryCallback {
string current_client_salt;
string current_server_salt;
- int32 current_srp_g;
+ int32 current_srp_g = 0;
string current_srp_p;
string current_srp_B;
- int64 current_srp_id;
+ int64 current_srp_id = 0;
NewPasswordState new_state;
diff --git a/td/telegram/PhoneNumberManager.h b/td/telegram/PhoneNumberManager.h
index d0cf5ee52..387742590 100644
--- a/td/telegram/PhoneNumberManager.h
+++ b/td/telegram/PhoneNumberManager.h
@@ -42,7 +42,7 @@ class PhoneNumberManager final : public NetActor {
ActorShared<> parent_;
uint64 query_id_ = 0;
uint64 net_query_id_ = 0;
- NetQueryType net_query_type_;
+ NetQueryType net_query_type_ = NetQueryType::None;
SendCodeHelper send_code_helper_;
diff --git a/td/telegram/PhotoSizeSource.h b/td/telegram/PhotoSizeSource.h
index 731f5ae85..6af2f0ef3 100644
--- a/td/telegram/PhotoSizeSource.h
+++ b/td/telegram/PhotoSizeSource.h
@@ -45,7 +45,7 @@ struct PhotoSizeSource {
Thumbnail(FileType file_type, int32 thumbnail_type) : file_type(file_type), thumbnail_type(thumbnail_type) {
}
- FileType file_type;
+ FileType file_type = FileType::None;
int32 thumbnail_type = 0;
};
diff --git a/td/telegram/SecretChatActor.h b/td/telegram/SecretChatActor.h
index fb1311a1f..02225109d 100644
--- a/td/telegram/SecretChatActor.h
+++ b/td/telegram/SecretChatActor.h
@@ -520,7 +520,7 @@ class SecretChatActor final : public NetQueryCallback {
return sb;
}
- int32 message_id;
+ int32 message_id = 0;
private:
std::string data;
@@ -537,7 +537,7 @@ class SecretChatActor final : public NetQueryCallback {
};
ChangesProcessor<StateChange> changes_processor_;
- int32 saved_pfs_state_message_id_;
+ int32 saved_pfs_state_message_id_ = 0;
SeqNoState seq_no_state_;
bool seq_no_state_changed_ = false;
@@ -559,7 +559,7 @@ class SecretChatActor final : public NetQueryCallback {
bool save_changes_finish = false;
bool save_message_finish = false;
LogEvent::Id log_event_id = 0;
- int32 message_id;
+ int32 message_id = 0;
};
Container<InboundMessageState> inbound_message_states_;
diff --git a/td/telegram/SecureValue.h b/td/telegram/SecureValue.h
index e177609e6..c60f9e29e 100644
--- a/td/telegram/SecureValue.h
+++ b/td/telegram/SecureValue.h
@@ -183,7 +183,7 @@ struct SecureFileCredentials {
};
struct SecureValueCredentials {
- SecureValueType type;
+ SecureValueType type = SecureValueType::None;
string hash;
optional<SecureDataCredentials> data;
std::vector<SecureFileCredentials> files;
diff --git a/td/telegram/StickersManager.h b/td/telegram/StickersManager.h
index dd9e1e13e..e0a96f0a5 100644
--- a/td/telegram/StickersManager.h
+++ b/td/telegram/StickersManager.h
@@ -396,8 +396,8 @@ class StickersManager final : public Actor {
UserId user_id;
string title;
string short_name;
- bool is_masks;
- bool is_animated;
+ bool is_masks = false;
+ bool is_animated = false;
vector<FileId> file_ids;
vector<tl_object_ptr<td_api::InputSticker>> stickers;
string software;
@@ -789,7 +789,7 @@ class StickersManager final : public Actor {
struct StickerSetLoadRequest {
Promise<Unit> promise;
Status error;
- size_t left_queries;
+ size_t left_queries = 0;
};
std::unordered_map<uint32, StickerSetLoadRequest> sticker_set_load_requests_;
diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp
index ca1df6e55..eb67ef91d 100644
--- a/td/telegram/Td.cpp
+++ b/td/telegram/Td.cpp
@@ -2114,7 +2114,7 @@ class GetArchivedStickerSetsRequest final : public RequestActor<> {
StickerSetId offset_sticker_set_id_;
int32 limit_;
- int32 total_count_;
+ int32 total_count_ = -1;
vector<StickerSetId> sticker_set_ids_;
void do_run(Promise<Unit> &&promise) final {
@@ -2555,7 +2555,7 @@ class GetEmojiSuggestionsUrlRequest final : public RequestOnceActor {
public:
GetEmojiSuggestionsUrlRequest(ActorShared<Td> td, uint64 request_id, string &&language_code)
- : RequestOnceActor(std::move(td), request_id), language_code_(std::move(language_code)) {
+ : RequestOnceActor(std::move(td), request_id), language_code_(std::move(language_code)), random_id_(0) {
}
};
diff --git a/td/telegram/ThemeManager.h b/td/telegram/ThemeManager.h
index f39698665..77cec47a6 100644
--- a/td/telegram/ThemeManager.h
+++ b/td/telegram/ThemeManager.h
@@ -42,7 +42,7 @@ class ThemeManager final : public Actor {
int32 message_accent_color = 0;
BackgroundId background_id;
BackgroundType background_type;
- BaseTheme base_theme;
+ BaseTheme base_theme = BaseTheme::Classic;
vector<int32> message_colors;
bool animate_message_colors = false;
diff --git a/td/telegram/UpdatesManager.h b/td/telegram/UpdatesManager.h
index ee80cc0d6..44413f860 100644
--- a/td/telegram/UpdatesManager.h
+++ b/td/telegram/UpdatesManager.h
@@ -174,7 +174,7 @@ class UpdatesManager final : public Actor {
class PendingQtsUpdate {
public:
- double receive_time;
+ double receive_time = 0.0;
tl_object_ptr<telegram_api::Update> update;
vector<Promise<Unit>> promises;
};
diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp
index bdfbced33..74574165b 100644
--- a/td/telegram/cli.cpp
+++ b/td/telegram/cli.cpp
@@ -675,7 +675,7 @@ class CliClient final : public Actor {
}
struct SearchQuery {
- int32 limit;
+ int32 limit = 0;
string query;
};
diff --git a/td/telegram/files/FileLoader.h b/td/telegram/files/FileLoader.h
index 848447c81..089d7976f 100644
--- a/td/telegram/files/FileLoader.h
+++ b/td/telegram/files/FileLoader.h
@@ -49,14 +49,14 @@ class FileLoader : public FileLoaderActor {
bool is_ready = false;
};
struct FileInfo {
- int64 size;
+ int64 size{0};
int64 expected_size{0};
- bool is_size_final;
- int32 part_size;
+ bool is_size_final{false};
+ int32 part_size{0};
std::vector<int> ready_parts;
- bool use_part_count_limit = true;
- bool only_check = false;
- bool need_delay = false;
+ bool use_part_count_limit{true};
+ bool only_check{false};
+ bool need_delay{false};
int64 offset{0};
int64 limit{0};
bool is_upload{false};
diff --git a/td/telegram/files/FileManager.h b/td/telegram/files/FileManager.h
index a7d4e925b..0de499320 100644
--- a/td/telegram/files/FileManager.h
+++ b/td/telegram/files/FileManager.h
@@ -538,7 +538,7 @@ class FileManager final : public FileLoadManager::Callback {
int8 download_priority_{0};
int8 upload_priority_{0};
- uint64 upload_order_;
+ uint64 upload_order_{0};
std::shared_ptr<DownloadCallback> download_callback_;
std::shared_ptr<UploadCallback> upload_callback_;
diff --git a/td/telegram/files/FileUploader.h b/td/telegram/files/FileUploader.h
index 321cb07fb..4b7daa463 100644
--- a/td/telegram/files/FileUploader.h
+++ b/td/telegram/files/FileUploader.h
@@ -47,7 +47,7 @@ class FileUploader final : public FileLoader {
FileType file_type_ = FileType::Temp;
std::vector<UInt256> iv_map_;
- UInt256 iv_;
+ UInt256 iv_{};
string generate_iv_;
int64 generate_offset_ = 0;
int64 next_offset_ = 0;
@@ -55,8 +55,8 @@ class FileUploader final : public FileLoader {
FileFd fd_;
string fd_path_;
bool is_temp_ = false;
- int64 file_id_;
- bool big_flag_;
+ int64 file_id_ = 0;
+ bool big_flag_ = false;
Result<FileInfo> init() final TD_WARN_UNUSED_RESULT;
Status on_ok(int64 size) final TD_WARN_UNUSED_RESULT;
diff --git a/td/telegram/files/PartsManager.h b/td/telegram/files/PartsManager.h
index 0efeb27d4..da4131f7d 100644
--- a/td/telegram/files/PartsManager.h
+++ b/td/telegram/files/PartsManager.h
@@ -65,28 +65,28 @@ class PartsManager {
int64 checked_prefix_size_{0};
bool known_prefix_flag_{false};
- int64 known_prefix_size_;
-
- int64 size_;
- int64 expected_size_;
- int64 min_size_;
- int64 max_size_;
- bool unknown_size_flag_;
- int64 ready_size_;
- int64 streaming_ready_size_;
-
- size_t part_size_;
- int part_count_;
- int pending_count_;
- int first_empty_part_;
- int first_not_ready_part_;
+ int64 known_prefix_size_{0};
+
+ int64 size_{0};
+ int64 expected_size_{0};
+ int64 min_size_{0};
+ int64 max_size_{0};
+ bool unknown_size_flag_{false};
+ int64 ready_size_{0};
+ int64 streaming_ready_size_{0};
+
+ size_t part_size_{0};
+ int part_count_{0};
+ int pending_count_{0};
+ int first_empty_part_{0};
+ int first_not_ready_part_{0};
int64 streaming_offset_{0};
int64 streaming_limit_{0};
- int first_streaming_empty_part_;
- int first_streaming_not_ready_part_;
+ int first_streaming_empty_part_{0};
+ int first_streaming_not_ready_part_{0};
vector<PartStatus> part_status_;
Bitmask bitmask_;
- bool use_part_count_limit_;
+ bool use_part_count_limit_{false};
Status init_common(const vector<int> &ready_parts);
Status init_known_prefix(int64 known_prefix, size_t part_size,
diff --git a/td/telegram/files/ResourceManager.h b/td/telegram/files/ResourceManager.h
index 31f5b8b93..d021457dd 100644
--- a/td/telegram/files/ResourceManager.h
+++ b/td/telegram/files/ResourceManager.h
@@ -35,7 +35,7 @@ class ResourceManager final : public Actor {
Mode mode_;
using NodeId = uint64;
struct Node final : public HeapNode {
- NodeId node_id;
+ NodeId node_id = 0;
ResourceState resource_state_;
ActorShared<FileLoaderActor> callback_;
diff --git a/td/telegram/net/ConnectionCreator.cpp b/td/telegram/net/ConnectionCreator.cpp
index 0ad54029a..9d307d58f 100644
--- a/td/telegram/net/ConnectionCreator.cpp
+++ b/td/telegram/net/ConnectionCreator.cpp
@@ -936,13 +936,13 @@ void ConnectionCreator::client_loop(ClientInfo &client) {
client.checking_connections++;
}
- auto promise = PromiseCreator::lambda([actor_id = actor_id(this), check_mode, transport_type = extra.transport_type,
- hash = client.hash, debug_str = extra.debug_str,
- network_generation =
- network_generation_](Result<ConnectionData> r_connection_data) mutable {
- send_closure(std::move(actor_id), &ConnectionCreator::client_create_raw_connection, std::move(r_connection_data),
- check_mode, std::move(transport_type), hash, std::move(debug_str), network_generation);
- });
+ auto promise = PromiseCreator::lambda(
+ [actor_id = actor_id(this), check_mode, transport_type = extra.transport_type, hash = client.hash,
+ debug_str = extra.debug_str,
+ network_generation = network_generation_](Result<ConnectionData> r_connection_data) mutable {
+ send_closure(actor_id, &ConnectionCreator::client_create_raw_connection, std::move(r_connection_data),
+ check_mode, std::move(transport_type), hash, std::move(debug_str), network_generation);
+ });
auto stats_callback =
td::make_unique<detail::StatsCallback>(client.is_media ? media_net_stats_callback_ : common_net_stats_callback_,
@@ -983,7 +983,7 @@ void ConnectionCreator::client_create_raw_connection(Result<ConnectionData> r_co
VLOG(connections) << "Failed connection (" << (check_mode ? "" : "un") << "checked) " << result.error() << ' '
<< debug_str;
}
- send_closure(std::move(actor_id), &ConnectionCreator::client_add_connection, hash, std::move(result), check_mode,
+ send_closure(actor_id, &ConnectionCreator::client_add_connection, hash, std::move(result), check_mode,
auth_data_generation, session_id);
});
@@ -1283,7 +1283,7 @@ void ConnectionCreator::loop() {
send_closure(
get_dns_resolver(), &GetHostByNameActor::run, proxy.server().str(), proxy.port(), prefer_ipv6,
PromiseCreator::lambda([actor_id = create_reference(resolve_proxy_query_token_)](Result<IPAddress> result) {
- send_closure(std::move(actor_id), &ConnectionCreator::on_proxy_resolved, std::move(result), false);
+ send_closure(actor_id, &ConnectionCreator::on_proxy_resolved, std::move(result), false);
}));
}
} else {
diff --git a/td/telegram/net/ConnectionCreator.h b/td/telegram/net/ConnectionCreator.h
index 520c0708a..50bc4c3a4 100644
--- a/td/telegram/net/ConnectionCreator.h
+++ b/td/telegram/net/ConnectionCreator.h
@@ -161,8 +161,8 @@ class ConnectionCreator final : public NetQueryCallback {
bool inited{false};
size_t hash{0};
DcId dc_id;
- bool allow_media_only;
- bool is_media;
+ bool allow_media_only{false};
+ bool is_media{false};
std::set<int64> session_ids_;
unique_ptr<mtproto::AuthData> auth_data;
uint64 auth_data_generation{0};
diff --git a/td/telegram/net/DcAuthManager.h b/td/telegram/net/DcAuthManager.h
index 435b522d8..e9c4e21d3 100644
--- a/td/telegram/net/DcAuthManager.h
+++ b/td/telegram/net/DcAuthManager.h
@@ -39,8 +39,8 @@ class DcAuthManager final : public NetQueryCallback {
enum class State : int32 { Waiting, Export, Import, BeforeOk, Ok };
State state = State::Waiting;
- uint64 wait_id;
- int64 export_id;
+ uint64 wait_id = 0;
+ int64 export_id = 0;
BufferSlice export_bytes;
};
diff --git a/td/telegram/net/DcOptionsSet.h b/td/telegram/net/DcOptionsSet.h
index 65584eb24..fd594c723 100644
--- a/td/telegram/net/DcOptionsSet.h
+++ b/td/telegram/net/DcOptionsSet.h
@@ -78,7 +78,7 @@ class DcOptionsSet {
struct DcOptionInfo {
DcOption option;
- int64 stat_id;
+ int64 stat_id = -1;
size_t pos;
size_t order = 0;
diff --git a/td/telegram/net/MtprotoHeader.h b/td/telegram/net/MtprotoHeader.h
index f6d1f83ee..ae80dd6d3 100644
--- a/td/telegram/net/MtprotoHeader.h
+++ b/td/telegram/net/MtprotoHeader.h
@@ -16,7 +16,7 @@ namespace td {
class MtprotoHeader {
public:
struct Options {
- int32 api_id;
+ int32 api_id = -1;
string system_language_code;
string device_model;
string system_version;
diff --git a/td/telegram/net/Session.h b/td/telegram/net/Session.h
index 41ccdf234..c5ff10f10 100644
--- a/td/telegram/net/Session.h
+++ b/td/telegram/net/Session.h
@@ -140,8 +140,8 @@ class Session final
ListNode sent_queries_list_;
struct ConnectionInfo {
- int8 connection_id;
- Mode mode;
+ int8 connection_id = 0;
+ Mode mode = Mode::Tcp;
enum class State : int8 { Empty, Connecting, Ready } state = State::Empty;
CancellationTokenSource cancellation_token_source_;
unique_ptr<mtproto::SessionConnection> connection;
diff --git a/td/telegram/net/SessionProxy.h b/td/telegram/net/SessionProxy.h
index fef984f9d..d82ce9a98 100644
--- a/td/telegram/net/SessionProxy.h
+++ b/td/telegram/net/SessionProxy.h
@@ -40,7 +40,7 @@ class SessionProxy final : public Actor {
private:
unique_ptr<Callback> callback_;
std::shared_ptr<AuthDataShared> auth_data_;
- AuthKeyState auth_key_state_;
+ AuthKeyState auth_key_state_ = AuthKeyState::Empty;
bool is_main_;
bool allow_media_only_;
bool is_media_;
diff --git a/tdactor/td/actor/ConcurrentScheduler.h b/tdactor/td/actor/ConcurrentScheduler.h
index e940e632c..e9b35fe7f 100644
--- a/tdactor/td/actor/ConcurrentScheduler.h
+++ b/tdactor/td/actor/ConcurrentScheduler.h
@@ -95,7 +95,7 @@ class ConcurrentScheduler final : private Scheduler::Callback {
unique_ptr<detail::Iocp> iocp_;
td::thread iocp_thread_;
#endif
- int32 extra_scheduler_;
+ int32 extra_scheduler_ = 0;
void on_finish() final;
diff --git a/tdactor/td/actor/PromiseFuture.h b/tdactor/td/actor/PromiseFuture.h
index 2b47b1d48..fe0464e0a 100644
--- a/tdactor/td/actor/PromiseFuture.h
+++ b/tdactor/td/actor/PromiseFuture.h
@@ -597,7 +597,7 @@ class FutureActor final : public Actor {
private:
EventFull event_;
Result<T> result_ = Status::Error(500, "Empty FutureActor");
- State state_;
+ State state_ = State::Waiting;
void set_value(T &&value) {
set_result(std::move(value));
diff --git a/tddb/td/db/binlog/Binlog.h b/tddb/td/db/binlog/Binlog.h
index 1cc50c13e..b3018722b 100644
--- a/tddb/td/db/binlog/Binlog.h
+++ b/tddb/td/db/binlog/Binlog.h
@@ -134,7 +134,7 @@ class Binlog {
// AesCtrEncryption
BufferSlice aes_ctr_key_salt_;
- UInt256 aes_ctr_key_;
+ UInt256 aes_ctr_key_{};
AesCtrState aes_ctr_state_;
bool byte_flow_flag_ = false;
diff --git a/tdnet/td/net/GetHostByNameActor.h b/tdnet/td/net/GetHostByNameActor.h
index 2edceb648..eb096c44b 100644
--- a/tdnet/td/net/GetHostByNameActor.h
+++ b/tdnet/td/net/GetHostByNameActor.h
@@ -62,7 +62,7 @@ class GetHostByNameActor final : public Actor {
ActorOwn<> query;
size_t pos = 0;
string real_host;
- double begin_time;
+ double begin_time = 0.0;
std::vector<std::pair<int, Promise<IPAddress>>> promises;
};
std::unordered_map<string, Query> active_queries_[2];
diff --git a/tdutils/td/utils/TsFileLog.cpp b/tdutils/td/utils/TsFileLog.cpp
index bdb54e5a1..aa761d138 100644
--- a/tdutils/td/utils/TsFileLog.cpp
+++ b/tdutils/td/utils/TsFileLog.cpp
@@ -49,8 +49,8 @@ class TsFileLog final : public LogInterface {
};
static constexpr size_t MAX_THREAD_ID = 128;
- int64 rotate_threshold_;
- bool redirect_stderr_;
+ int64 rotate_threshold_ = 0;
+ bool redirect_stderr_ = false;
std::string path_;
std::array<Info, MAX_THREAD_ID> logs_;
std::mutex init_mutex_;
diff --git a/tdutils/test/ConcurrentHashMap.cpp b/tdutils/test/ConcurrentHashMap.cpp
index c9c9b42b1..da7e1fa8a 100644
--- a/tdutils/test/ConcurrentHashMap.cpp
+++ b/tdutils/test/ConcurrentHashMap.cpp
@@ -186,9 +186,8 @@ class HashMapBenchmark final : public td::Benchmark {
td::unique_ptr<HashMap> hash_map;
size_t threads_n = 16;
- int mod_;
static constexpr size_t MUL = 7273; //1000000000 + 7;
- int n_;
+ int n_ = 0;
public:
explicit HashMapBenchmark(size_t threads_n) : threads_n(threads_n) {