Remove redundabt web_location_flag_.

GitOrigin-RevId: 0f24358ab873d2d49ef115ab9dbcdf86c72e0c7e
This commit is contained in:
levlam 2019-10-25 17:46:35 +03:00
parent df15f8a8db
commit d66e57a3af
2 changed files with 10 additions and 10 deletions

View File

@ -183,7 +183,6 @@ class FullRemoteFileLocation {
private:
static constexpr int32 WEB_LOCATION_FLAG = 1 << 24;
static constexpr int32 FILE_REFERENCE_FLAG = 1 << 25;
bool web_location_flag_{false};
DcId dc_id_;
string file_reference_;
enum class LocationType : int32 { Web, Photo, Common, None };
@ -361,7 +360,7 @@ class FullRemoteFileLocation {
}
bool is_web() const {
return web_location_flag_;
return variant_.get_offset() == 0;
}
bool is_photo() const {
return location_type() == LocationType::Photo;
@ -502,10 +501,7 @@ class FullRemoteFileLocation {
// web document
FullRemoteFileLocation(FileType file_type, string url, int64 access_hash)
: file_type_(file_type)
, web_location_flag_{true}
, dc_id_()
, variant_(WebRemoteFileLocation{std::move(url), access_hash}) {
: file_type_(file_type), dc_id_(), variant_(WebRemoteFileLocation{std::move(url), access_hash}) {
CHECK(is_web());
CHECK(!web().url_.empty());
}

View File

@ -135,7 +135,7 @@ void FullRemoteFileLocation::parse(ParserT &parser) {
using ::td::parse;
int32 raw_type;
parse(raw_type, parser);
web_location_flag_ = (raw_type & WEB_LOCATION_FLAG) != 0;
bool is_web = (raw_type & WEB_LOCATION_FLAG) != 0;
raw_type &= ~WEB_LOCATION_FLAG;
bool has_file_reference = (raw_type & FILE_REFERENCE_FLAG) != 0;
raw_type &= ~FILE_REFERENCE_FLAG;
@ -149,13 +149,17 @@ void FullRemoteFileLocation::parse(ParserT &parser) {
if (has_file_reference) {
parse(file_reference_, parser);
file_reference_.clear();
// file_reference_.clear();
}
if (is_web) {
variant_ = WebRemoteFileLocation();
return web().parse(parser);
}
switch (location_type()) {
case LocationType::Web:
variant_ = WebRemoteFileLocation();
return web().parse(parser);
UNREACHABLE();
break;
case LocationType::Photo:
variant_ = PhotoRemoteFileLocation();
photo().parse(parser);