Remove expect_jpeg_minithumbnail parameter from get_photo_size.
This commit is contained in:
parent
1d9b817c9f
commit
8430ba6d19
@ -265,9 +265,9 @@ Document DocumentsManager::on_get_document(RemoteDocument remote_document, Dialo
|
||||
|
||||
if (document_type != Document::Type::VoiceNote) {
|
||||
for (auto &thumb : document->thumbs_) {
|
||||
auto photo_size = get_photo_size(td_->file_manager_.get(), {FileType::Thumbnail, 0}, id, access_hash,
|
||||
file_reference, DcId::create(dc_id), owner_dialog_id, std::move(thumb),
|
||||
thumbnail_format, document_type != Document::Type::Sticker);
|
||||
auto photo_size =
|
||||
get_photo_size(td_->file_manager_.get(), {FileType::Thumbnail, 0}, id, access_hash, file_reference,
|
||||
DcId::create(dc_id), owner_dialog_id, std::move(thumb), thumbnail_format);
|
||||
if (photo_size.get_offset() == 0) {
|
||||
if (!thumbnail.file_id.is_valid()) {
|
||||
thumbnail = std::move(photo_size.get<0>());
|
||||
|
@ -359,7 +359,7 @@ PhotoSize get_secret_thumbnail_photo_size(FileManager *file_manager, BufferSlice
|
||||
Variant<PhotoSize, string> get_photo_size(FileManager *file_manager, PhotoSizeSource source, int64 id,
|
||||
int64 access_hash, std::string file_reference, DcId dc_id,
|
||||
DialogId owner_dialog_id, tl_object_ptr<telegram_api::PhotoSize> &&size_ptr,
|
||||
PhotoFormat format, bool expect_jpeg_minithumbnail) {
|
||||
PhotoFormat format) {
|
||||
CHECK(size_ptr != nullptr);
|
||||
|
||||
tl_object_ptr<telegram_api::fileLocationToBeDeprecated> location;
|
||||
@ -394,8 +394,8 @@ Variant<PhotoSize, string> get_photo_size(FileManager *file_manager, PhotoSizeSo
|
||||
}
|
||||
case telegram_api::photoStrippedSize::ID: {
|
||||
auto size = move_tl_object_as<telegram_api::photoStrippedSize>(size_ptr);
|
||||
if (!expect_jpeg_minithumbnail) {
|
||||
LOG(ERROR) << "Receive unexpected JPEG minithumbnail";
|
||||
if (format != PhotoFormat::Jpeg) {
|
||||
LOG(ERROR) << "Receive unexpected JPEG minithumbnail in photo of format " << format;
|
||||
return std::move(res);
|
||||
}
|
||||
return size->bytes_.as_slice().str();
|
||||
@ -420,8 +420,8 @@ Variant<PhotoSize, string> get_photo_size(FileManager *file_manager, PhotoSizeSo
|
||||
}
|
||||
case telegram_api::photoPathSize::ID: {
|
||||
auto size = move_tl_object_as<telegram_api::photoPathSize>(size_ptr);
|
||||
if (expect_jpeg_minithumbnail) {
|
||||
LOG(ERROR) << "Receive unexpected SVG minithumbnail";
|
||||
if (format != PhotoFormat::Tgs && format != PhotoFormat::Webp) {
|
||||
LOG(ERROR) << "Receive unexpected SVG minithumbnail in photo of format " << format;
|
||||
return std::move(res);
|
||||
}
|
||||
return size->bytes_.as_slice().str();
|
||||
@ -717,7 +717,7 @@ Photo get_photo(FileManager *file_manager, tl_object_ptr<telegram_api::photo> &&
|
||||
for (auto &size_ptr : photo->sizes_) {
|
||||
auto photo_size = get_photo_size(file_manager, {FileType::Photo, 0}, photo->id_, photo->access_hash_,
|
||||
photo->file_reference_.as_slice().str(), dc_id, owner_dialog_id,
|
||||
std::move(size_ptr), PhotoFormat::Jpeg, true);
|
||||
std::move(size_ptr), PhotoFormat::Jpeg);
|
||||
if (photo_size.get_offset() == 0) {
|
||||
PhotoSize &size = photo_size.get<0>();
|
||||
if (size.type == 0 || size.type == 't' || size.type == 'i' || size.type == 'u' || size.type == 'v') {
|
||||
|
@ -113,7 +113,7 @@ PhotoSize get_secret_thumbnail_photo_size(FileManager *file_manager, BufferSlice
|
||||
Variant<PhotoSize, string> get_photo_size(FileManager *file_manager, PhotoSizeSource source, int64 id,
|
||||
int64 access_hash, string file_reference, DcId dc_id,
|
||||
DialogId owner_dialog_id, tl_object_ptr<telegram_api::PhotoSize> &&size_ptr,
|
||||
PhotoFormat format, bool expect_jpeg_minithumbnail);
|
||||
PhotoFormat format);
|
||||
AnimationSize get_animation_size(FileManager *file_manager, PhotoSizeSource source, int64 id, int64 access_hash,
|
||||
string file_reference, DcId dc_id, DialogId owner_dialog_id,
|
||||
tl_object_ptr<telegram_api::videoSize> &&size);
|
||||
|
@ -1888,7 +1888,7 @@ std::pair<int64, FileId> StickersManager::on_get_sticker_document(
|
||||
auto photo_size =
|
||||
get_photo_size(td_->file_manager_.get(), {FileType::Thumbnail, 0}, document_id, document->access_hash_,
|
||||
document->file_reference_.as_slice().str(), dc_id, DialogId(), std::move(thumb),
|
||||
has_webp_thumbnail(sticker) ? PhotoFormat::Webp : PhotoFormat::Jpeg, false);
|
||||
has_webp_thumbnail(sticker) ? PhotoFormat::Webp : PhotoFormat::Jpeg);
|
||||
if (photo_size.get_offset() == 0) {
|
||||
if (!thumbnail.file_id.is_valid()) {
|
||||
thumbnail = std::move(photo_size.get<0>());
|
||||
@ -2420,7 +2420,7 @@ StickerSetId StickersManager::on_get_sticker_set(tl_object_ptr<telegram_api::sti
|
||||
for (auto &thumb : set->thumbs_) {
|
||||
auto photo_size = get_photo_size(td_->file_manager_.get(), {set_id.get(), s->access_hash}, 0, 0, "",
|
||||
DcId::create(set->thumb_dc_id_), DialogId(), std::move(thumb),
|
||||
is_animated ? PhotoFormat::Tgs : PhotoFormat::Webp, false);
|
||||
is_animated ? PhotoFormat::Tgs : PhotoFormat::Webp);
|
||||
if (photo_size.get_offset() == 0) {
|
||||
if (!thumbnail.file_id.is_valid()) {
|
||||
thumbnail = std::move(photo_size.get<0>());
|
||||
|
Loading…
Reference in New Issue
Block a user