From de0614891df51986fdb2ce0f95a094dd7110a78c Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 3 May 2018 12:00:35 +0300 Subject: [PATCH] Fix g++ CE and warning. GitOrigin-RevId: 14b43cc16c2eac069bb19b6fe5a6adb964068970 --- td/telegram/SecureValue.cpp | 26 +++++++++++++------------- td/telegram/net/ConnectionCreator.cpp | 5 +---- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/td/telegram/SecureValue.cpp b/td/telegram/SecureValue.cpp index 3d944083..6b64c30a 100644 --- a/td/telegram/SecureValue.cpp +++ b/td/telegram/SecureValue.cpp @@ -1334,26 +1334,26 @@ static auto credentials_as_jsonable(const std::vector &c bool with_selfie) { return json_object([&credentials, payload, with_selfie](auto &o) { o("secure_data", json_object([&credentials, with_selfie](auto &o) { - for (auto &c : credentials) { - if (c.type == SecureValueType::PhoneNumber || c.type == SecureValueType::EmailAddress) { + for (auto &cred : credentials) { + if (cred.type == SecureValueType::PhoneNumber || cred.type == SecureValueType::EmailAddress) { continue; } - o(secure_value_type_as_slice(c.type), json_object([&credentials = c, with_selfie](auto &o) { - if (credentials.data) { - o("data", as_jsonable(credentials.data.value())); + o(secure_value_type_as_slice(cred.type), json_object([&cred, with_selfie](auto &o) { + if (cred.data) { + o("data", as_jsonable(cred.data.value())); } - if (!credentials.files.empty()) { - o("files", as_jsonable(credentials.files)); + if (!cred.files.empty()) { + o("files", as_jsonable(cred.files)); } - if (credentials.front_side) { - o("front_side", as_jsonable(credentials.front_side.value())); + if (cred.front_side) { + o("front_side", as_jsonable(cred.front_side.value())); } - if (credentials.reverse_side) { - o("reverse_side", as_jsonable(credentials.reverse_side.value())); + if (cred.reverse_side) { + o("reverse_side", as_jsonable(cred.reverse_side.value())); } - if (credentials.selfie && with_selfie) { - o("selfie", as_jsonable(credentials.selfie.value())); + if (cred.selfie && with_selfie) { + o("selfie", as_jsonable(cred.selfie.value())); } })); } diff --git a/td/telegram/net/ConnectionCreator.cpp b/td/telegram/net/ConnectionCreator.cpp index 7b420af6..8ae8a3cb 100644 --- a/td/telegram/net/ConnectionCreator.cpp +++ b/td/telegram/net/ConnectionCreator.cpp @@ -382,10 +382,7 @@ void ConnectionCreator::client_loop(ClientInfo &client) { if (info.use_http) { transport_type = {mtproto::TransportType::Http, 0, ""}; } else { - int16 raw_dc_id = narrow_cast(dc_id.get_raw_id()); - if (info.option->is_media_only()) { - raw_dc_id = -raw_dc_id; - } + int16 raw_dc_id = narrow_cast(info.option->is_media_only() ? -dc_id.get_raw_id() : dc_id.get_raw_id()); transport_type = {mtproto::TransportType::ObfuscatedTcp, raw_dc_id, info.option->get_secret().str()}; } check_mode |= info.should_check;