diff --git a/td/telegram/PhotoSize.cpp b/td/telegram/PhotoSize.cpp index 673821b5d..c705f7f8e 100644 --- a/td/telegram/PhotoSize.cpp +++ b/td/telegram/PhotoSize.cpp @@ -126,7 +126,7 @@ FileId register_photo_size(FileManager *file_manager, const PhotoSizeSource &sou PhotoFormat format) { LOG(DEBUG) << "Receive " << format << " photo " << id << " of type " << source.get_file_type("register_photo_size") << " from " << dc_id; - auto suggested_name = PSTRING() << source.get_unique_name(id) << '.' << format; + auto suggested_name = PSTRING() << source.get_unique_name(id, "register_photo_size") << '.' << format; auto file_location_source = owner_dialog_id.get_type() == DialogType::SecretChat ? FileLocationSource::FromUser : FileLocationSource::FromServer; return file_manager->register_remote( diff --git a/td/telegram/PhotoSizeSource.cpp b/td/telegram/PhotoSizeSource.cpp index 8bc8cd5f9..9218af27d 100644 --- a/td/telegram/PhotoSizeSource.cpp +++ b/td/telegram/PhotoSizeSource.cpp @@ -64,11 +64,11 @@ FileType PhotoSizeSource::get_file_type(const char *source) const { } } -string PhotoSizeSource::get_unique() const { +string PhotoSizeSource::get_unique(const char *source) const { auto ptr = StackAllocator::alloc(16); MutableSlice data = ptr.as_slice(); TlStorerUnsafe storer(data.ubegin()); - switch (get_type("get_unique")) { + switch (get_type(source)) { case Type::Legacy: UNREACHABLE(); break; @@ -128,8 +128,8 @@ string PhotoSizeSource::get_unique() const { return string(data.begin(), size); } -string PhotoSizeSource::get_unique_name(int64 photo_id) const { - switch (get_type("get_unique_name")) { +string PhotoSizeSource::get_unique_name(int64 photo_id, const char *source) const { + switch (get_type(source)) { case Type::Thumbnail: CHECK(0 <= thumbnail().thumbnail_type && thumbnail().thumbnail_type <= 127); return PSTRING() << photo_id << '_' << thumbnail().thumbnail_type; diff --git a/td/telegram/PhotoSizeSource.h b/td/telegram/PhotoSizeSource.h index 67be7d800..d3dd2d227 100644 --- a/td/telegram/PhotoSizeSource.h +++ b/td/telegram/PhotoSizeSource.h @@ -242,10 +242,10 @@ struct PhotoSizeSource { } // returns unique representation of the source - string get_unique() const; + string get_unique(const char *source) const; // can't be called for Legacy sources - string get_unique_name(int64 photo_id) const; + string get_unique_name(int64 photo_id, const char *source) const; template void store(StorerT &storer) const; diff --git a/td/telegram/files/FileLocation.h b/td/telegram/files/FileLocation.h index 5d3d07a11..c307dc454 100644 --- a/td/telegram/files/FileLocation.h +++ b/td/telegram/files/FileLocation.h @@ -102,10 +102,12 @@ struct PhotoRemoteFileLocation { if (id_ != other.id_) { return id_ < other.id_; } - return source_.get_unique() < other.source_.get_unique(); + return source_.get_unique("PhotoRemoteFileLocation::operator<") < + other.source_.get_unique("PhotoRemoteFileLocation::operator<"); } bool operator==(const PhotoRemoteFileLocation &other) const { - return id_ == other.id_ && source_.get_unique() == other.source_.get_unique(); + return id_ == other.id_ && source_.get_unique("PhotoRemoteFileLocation::operator==") == + other.source_.get_unique("PhotoRemoteFileLocation::operator=="); } }; diff --git a/td/telegram/files/FileLocation.hpp b/td/telegram/files/FileLocation.hpp index 978a21a55..5c8cf53e8 100644 --- a/td/telegram/files/FileLocation.hpp +++ b/td/telegram/files/FileLocation.hpp @@ -105,7 +105,7 @@ void PhotoRemoteFileLocation::parse(ParserT &parser) { template void PhotoRemoteFileLocation::AsKey::store(StorerT &storer) const { using td::store; - auto unique = key.source_.get_unique(); + auto unique = key.source_.get_unique("PhotoRemoteFileLocation::AsKey::store"); switch (key.source_.get_type("PhotoRemoteFileLocation::AsKey::store")) { case PhotoSizeSource::Type::Legacy: case PhotoSizeSource::Type::StickerSetThumbnail: