Remove redundabt web_location_flag_.
GitOrigin-RevId: 0f24358ab873d2d49ef115ab9dbcdf86c72e0c7e
This commit is contained in:
parent
df15f8a8db
commit
d66e57a3af
@ -183,7 +183,6 @@ class FullRemoteFileLocation {
|
|||||||
private:
|
private:
|
||||||
static constexpr int32 WEB_LOCATION_FLAG = 1 << 24;
|
static constexpr int32 WEB_LOCATION_FLAG = 1 << 24;
|
||||||
static constexpr int32 FILE_REFERENCE_FLAG = 1 << 25;
|
static constexpr int32 FILE_REFERENCE_FLAG = 1 << 25;
|
||||||
bool web_location_flag_{false};
|
|
||||||
DcId dc_id_;
|
DcId dc_id_;
|
||||||
string file_reference_;
|
string file_reference_;
|
||||||
enum class LocationType : int32 { Web, Photo, Common, None };
|
enum class LocationType : int32 { Web, Photo, Common, None };
|
||||||
@ -361,7 +360,7 @@ class FullRemoteFileLocation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool is_web() const {
|
bool is_web() const {
|
||||||
return web_location_flag_;
|
return variant_.get_offset() == 0;
|
||||||
}
|
}
|
||||||
bool is_photo() const {
|
bool is_photo() const {
|
||||||
return location_type() == LocationType::Photo;
|
return location_type() == LocationType::Photo;
|
||||||
@ -502,10 +501,7 @@ class FullRemoteFileLocation {
|
|||||||
|
|
||||||
// web document
|
// web document
|
||||||
FullRemoteFileLocation(FileType file_type, string url, int64 access_hash)
|
FullRemoteFileLocation(FileType file_type, string url, int64 access_hash)
|
||||||
: file_type_(file_type)
|
: file_type_(file_type), dc_id_(), variant_(WebRemoteFileLocation{std::move(url), access_hash}) {
|
||||||
, web_location_flag_{true}
|
|
||||||
, dc_id_()
|
|
||||||
, variant_(WebRemoteFileLocation{std::move(url), access_hash}) {
|
|
||||||
CHECK(is_web());
|
CHECK(is_web());
|
||||||
CHECK(!web().url_.empty());
|
CHECK(!web().url_.empty());
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ void FullRemoteFileLocation::parse(ParserT &parser) {
|
|||||||
using ::td::parse;
|
using ::td::parse;
|
||||||
int32 raw_type;
|
int32 raw_type;
|
||||||
parse(raw_type, parser);
|
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;
|
raw_type &= ~WEB_LOCATION_FLAG;
|
||||||
bool has_file_reference = (raw_type & FILE_REFERENCE_FLAG) != 0;
|
bool has_file_reference = (raw_type & FILE_REFERENCE_FLAG) != 0;
|
||||||
raw_type &= ~FILE_REFERENCE_FLAG;
|
raw_type &= ~FILE_REFERENCE_FLAG;
|
||||||
@ -149,13 +149,17 @@ void FullRemoteFileLocation::parse(ParserT &parser) {
|
|||||||
|
|
||||||
if (has_file_reference) {
|
if (has_file_reference) {
|
||||||
parse(file_reference_, parser);
|
parse(file_reference_, parser);
|
||||||
file_reference_.clear();
|
// file_reference_.clear();
|
||||||
|
}
|
||||||
|
if (is_web) {
|
||||||
|
variant_ = WebRemoteFileLocation();
|
||||||
|
return web().parse(parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (location_type()) {
|
switch (location_type()) {
|
||||||
case LocationType::Web:
|
case LocationType::Web:
|
||||||
variant_ = WebRemoteFileLocation();
|
UNREACHABLE();
|
||||||
return web().parse(parser);
|
break;
|
||||||
case LocationType::Photo:
|
case LocationType::Photo:
|
||||||
variant_ = PhotoRemoteFileLocation();
|
variant_ = PhotoRemoteFileLocation();
|
||||||
photo().parse(parser);
|
photo().parse(parser);
|
||||||
|
Loading…
Reference in New Issue
Block a user