Inline full_type to FullRemoteFileLocation::store to minimize misusage probability.

GitOrigin-RevId: 48c147f10c36a00926aa976b5272992ac1ead277
This commit is contained in:
levlam 2019-10-25 17:18:51 +03:00
parent edd3bb94a4
commit df15f8a8db
2 changed files with 7 additions and 12 deletions

View File

@ -250,16 +250,6 @@ class FullRemoteFileLocation {
}
return type;
}
int32 full_type() const {
auto type = static_cast<int32>(file_type_);
if (is_web()) {
type |= WEB_LOCATION_FLAG;
}
if (!file_reference_.empty()) {
type |= FILE_REFERENCE_FLAG;
}
return type;
}
void check_file_reference() {
if (file_reference_ == FileReferenceView::invalid_file_reference()) {

View File

@ -114,9 +114,14 @@ void CommonRemoteFileLocation::AsKey::store(StorerT &storer) const {
template <class StorerT>
void FullRemoteFileLocation::store(StorerT &storer) const {
using ::td::store;
store(full_type(), storer);
bool has_file_reference = !file_reference_.empty();
auto type = key_type();
if (has_file_reference) {
type |= FILE_REFERENCE_FLAG;
}
store(type, storer);
store(dc_id_.get_value(), storer);
if (!file_reference_.empty()) {
if (has_file_reference) {
store(file_reference_, storer);
}
variant_.visit([&](auto &&value) {