Minor fixes.

This commit is contained in:
levlam 2022-08-14 15:04:08 +03:00
parent 103c6ad1e8
commit 8f433070df
16 changed files with 26 additions and 12 deletions

View File

@ -7,12 +7,16 @@
#include "td/telegram/AudiosManager.h"
#include "td/telegram/AuthManager.h"
#include "td/telegram/DialogId.h"
#include "td/telegram/files/FileManager.h"
#include "td/telegram/files/FileType.h"
#include "td/telegram/Global.h"
#include "td/telegram/PhotoFormat.h"
#include "td/telegram/secret_api.h"
#include "td/telegram/Td.h"
#include "td/actor/actor.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/PathView.h"

View File

@ -15,6 +15,7 @@
#include "td/telegram/files/FileLocation.h"
#include "td/telegram/files/FileManager.h"
#include "td/telegram/files/FileType.h"
#include "td/telegram/Global.h"
#include "td/telegram/misc.h"
#include "td/telegram/net/DcId.h"
#include "td/telegram/PhotoSizeSource.h"
@ -29,6 +30,8 @@
#include "td/telegram/VideosManager.h"
#include "td/telegram/VoiceNotesManager.h"
#include "td/actor/actor.h"
#include "td/utils/common.h"
#include "td/utils/HttpUrl.h"
#include "td/utils/logging.h"

View File

@ -12,7 +12,6 @@
#include "td/telegram/PhotoSize.hpp"
#include "td/telegram/Version.h"
#include "td/utils/logging.h"
#include "td/utils/tl_helpers.h"
namespace td {

View File

@ -15,7 +15,6 @@
#include "td/utils/common.h"
#include "td/utils/Promise.h"
#include "td/utils/Status.h"
namespace td {

View File

@ -15,6 +15,7 @@
#include "td/actor/actor.h"
#include "td/utils/common.h"
#include "td/utils/Promise.h"
#include <memory>

View File

@ -9,6 +9,7 @@
#include "td/telegram/ConfigShared.h"
#include "td/telegram/ContactsManager.h"
#include "td/telegram/Dependencies.h"
#include "td/telegram/Global.h"
#include "td/telegram/LinkManager.h"
#include "td/telegram/misc.h"
#include "td/telegram/SecretChatLayer.h"
@ -21,6 +22,7 @@
#include "td/utils/format.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/Promise.h"
#include "td/utils/SliceBuilder.h"
#include "td/utils/unicode.h"
#include "td/utils/utf8.h"

View File

@ -14,7 +14,6 @@
#include "td/telegram/DialogId.h"
#include "td/telegram/Global.h"
#include "td/telegram/logevent/LogEvent.h"
#include "td/telegram/logevent/LogEventHelper.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/misc.h"
#include "td/telegram/PollId.hpp"

View File

@ -14,7 +14,6 @@
#include "td/telegram/Document.h"
#include "td/telegram/DocumentsManager.h"
#include "td/telegram/Global.h"
#include "td/telegram/JsonValue.h"
#include "td/telegram/MessageEntity.h"
#include "td/telegram/Payments.h"
#include "td/telegram/Td.h"

View File

@ -10,8 +10,8 @@
#include "td/telegram/Payments.h"
#include "td/utils/common.h"
#include "td/utils/logging.h"
#include <limits>
#include <tuple>
namespace td {

View File

@ -147,15 +147,15 @@ bool is_sticker_format_vector(StickerFormat sticker_format) {
}
int64 get_max_sticker_file_size(StickerFormat sticker_format, StickerType sticker_type, bool for_thumbnail) {
bool is_emoji = sticker_type == StickerType::CustomEmoji;
bool is_custom_emoji = sticker_type == StickerType::CustomEmoji;
switch (sticker_format) {
case StickerFormat::Unknown:
case StickerFormat::Webp:
return for_thumbnail ? (1 << 17) : (is_emoji ? (1 << 17) : (1 << 19));
return for_thumbnail ? (1 << 17) : (is_custom_emoji ? (1 << 17) : (1 << 19));
case StickerFormat::Tgs:
return for_thumbnail ? (1 << 15) : (1 << 16);
case StickerFormat::Webm:
return for_thumbnail ? (1 << 15) : (is_emoji ? (1 << 16) : (1 << 18));
return for_thumbnail ? (1 << 15) : (is_custom_emoji ? (1 << 16) : (1 << 18));
default:
UNREACHABLE();
return 0;

View File

@ -8,12 +8,15 @@
#include "td/telegram/AuthManager.h"
#include "td/telegram/files/FileManager.h"
#include "td/telegram/Global.h"
#include "td/telegram/PhotoFormat.h"
#include "td/telegram/secret_api.h"
#include "td/telegram/Td.h"
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
#include "td/actor/actor.h"
#include "td/utils/logging.h"
#include "td/utils/Status.h"

View File

@ -8,12 +8,15 @@
#include "td/telegram/AuthManager.h"
#include "td/telegram/files/FileManager.h"
#include "td/telegram/Global.h"
#include "td/telegram/PhotoFormat.h"
#include "td/telegram/secret_api.h"
#include "td/telegram/Td.h"
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
#include "td/actor/actor.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/Status.h"

View File

@ -26,7 +26,6 @@
#include "td/utils/common.h"
#include "td/utils/Container.h"
#include "td/utils/Enumerator.h"
#include "td/utils/FlatHashMap.h"
#include "td/utils/FlatHashSet.h"
#include "td/utils/logging.h"
#include "td/utils/optional.h"

View File

@ -15,6 +15,7 @@
#include "td/utils/ObjectPool.h"
#include "td/utils/port/detail/PollableFd.h"
#include "td/utils/port/PollFlags.h"
#include "td/utils/Promise.h"
#include "td/utils/Slice.h"
#include "td/utils/Time.h"

View File

@ -43,7 +43,7 @@ class WaitFreeHashMap {
return const_cast<WaitFreeHashMap *>(this)->get_storage(key);
}
void split() {
void split_storage() {
CHECK(wait_free_storage_ == nullptr);
wait_free_storage_ = make_unique<WaitFreeStorage>();
for (auto &it : default_map_) {
@ -57,7 +57,7 @@ class WaitFreeHashMap {
auto &storage = get_storage(key);
storage[key] = std::move(value);
if (default_map_.size() == MAX_STORAGE_SIZE) {
split();
split_storage();
}
}
@ -103,7 +103,7 @@ class WaitFreeHashMap {
return result;
}
split();
split_storage();
}
return get_wait_free_storage(key)[key];

View File

@ -8,6 +8,8 @@
#include "td/utils/common.h"
#include <utility>
namespace td {
template <class T>