Fix g++ CE and warning.

GitOrigin-RevId: 14b43cc16c2eac069bb19b6fe5a6adb964068970
This commit is contained in:
levlam 2018-05-03 12:00:35 +03:00
parent 1b64400167
commit de0614891d
2 changed files with 14 additions and 17 deletions

View File

@ -1334,26 +1334,26 @@ static auto credentials_as_jsonable(const std::vector<SecureValueCredentials> &c
bool with_selfie) { bool with_selfie) {
return json_object([&credentials, payload, with_selfie](auto &o) { return json_object([&credentials, payload, with_selfie](auto &o) {
o("secure_data", json_object([&credentials, with_selfie](auto &o) { o("secure_data", json_object([&credentials, with_selfie](auto &o) {
for (auto &c : credentials) { for (auto &cred : credentials) {
if (c.type == SecureValueType::PhoneNumber || c.type == SecureValueType::EmailAddress) { if (cred.type == SecureValueType::PhoneNumber || cred.type == SecureValueType::EmailAddress) {
continue; continue;
} }
o(secure_value_type_as_slice(c.type), json_object([&credentials = c, with_selfie](auto &o) { o(secure_value_type_as_slice(cred.type), json_object([&cred, with_selfie](auto &o) {
if (credentials.data) { if (cred.data) {
o("data", as_jsonable(credentials.data.value())); o("data", as_jsonable(cred.data.value()));
} }
if (!credentials.files.empty()) { if (!cred.files.empty()) {
o("files", as_jsonable(credentials.files)); o("files", as_jsonable(cred.files));
} }
if (credentials.front_side) { if (cred.front_side) {
o("front_side", as_jsonable(credentials.front_side.value())); o("front_side", as_jsonable(cred.front_side.value()));
} }
if (credentials.reverse_side) { if (cred.reverse_side) {
o("reverse_side", as_jsonable(credentials.reverse_side.value())); o("reverse_side", as_jsonable(cred.reverse_side.value()));
} }
if (credentials.selfie && with_selfie) { if (cred.selfie && with_selfie) {
o("selfie", as_jsonable(credentials.selfie.value())); o("selfie", as_jsonable(cred.selfie.value()));
} }
})); }));
} }

View File

@ -382,10 +382,7 @@ void ConnectionCreator::client_loop(ClientInfo &client) {
if (info.use_http) { if (info.use_http) {
transport_type = {mtproto::TransportType::Http, 0, ""}; transport_type = {mtproto::TransportType::Http, 0, ""};
} else { } else {
int16 raw_dc_id = narrow_cast<int16>(dc_id.get_raw_id()); int16 raw_dc_id = narrow_cast<int16>(info.option->is_media_only() ? -dc_id.get_raw_id() : dc_id.get_raw_id());
if (info.option->is_media_only()) {
raw_dc_id = -raw_dc_id;
}
transport_type = {mtproto::TransportType::ObfuscatedTcp, raw_dc_id, info.option->get_secret().str()}; transport_type = {mtproto::TransportType::ObfuscatedTcp, raw_dc_id, info.option->get_secret().str()};
} }
check_mode |= info.should_check; check_mode |= info.should_check;