Minor improvements.
This commit is contained in:
parent
2b980ec215
commit
6beaf41231
@ -17,6 +17,7 @@
|
||||
#include "td/utils/port/thread.h"
|
||||
#include "td/utils/Slice.h"
|
||||
#include "td/utils/SliceBuilder.h"
|
||||
#include "td/utils/Status.h"
|
||||
#include "td/utils/ThreadSafeCounter.h"
|
||||
|
||||
#include "td/telegram/telegram_api.h"
|
||||
@ -422,7 +423,7 @@ std::atomic<td::int64> AtomicCounterBench<StrictOrder>::counter_;
|
||||
|
||||
#endif
|
||||
|
||||
class MessageIdDuplicateCheckerOld {
|
||||
class IdDuplicateCheckerOld {
|
||||
public:
|
||||
static td::string get_description() {
|
||||
return "Old";
|
||||
@ -453,7 +454,7 @@ class MessageIdDuplicateCheckerOld {
|
||||
};
|
||||
|
||||
template <size_t MAX_SAVED_MESSAGE_IDS>
|
||||
class MessageIdDuplicateCheckerNew {
|
||||
class IdDuplicateCheckerNew {
|
||||
public:
|
||||
static td::string get_description() {
|
||||
return PSTRING() << "New" << MAX_SAVED_MESSAGE_IDS;
|
||||
@ -480,7 +481,7 @@ class MessageIdDuplicateCheckerNew {
|
||||
std::set<td::int64> saved_message_ids_;
|
||||
};
|
||||
|
||||
class MessageIdDuplicateCheckerNewOther {
|
||||
class IdDuplicateCheckerNewOther {
|
||||
public:
|
||||
static td::string get_description() {
|
||||
return "NewOther";
|
||||
@ -507,7 +508,7 @@ class MessageIdDuplicateCheckerNewOther {
|
||||
std::set<td::int64> saved_message_ids_;
|
||||
};
|
||||
|
||||
class MessageIdDuplicateCheckerNewSimple {
|
||||
class IdDuplicateCheckerNewSimple {
|
||||
public:
|
||||
static td::string get_description() {
|
||||
return "NewSimple";
|
||||
@ -534,7 +535,7 @@ class MessageIdDuplicateCheckerNewSimple {
|
||||
};
|
||||
|
||||
template <size_t max_size>
|
||||
class MessageIdDuplicateCheckerArray {
|
||||
class IdDuplicateCheckerArray {
|
||||
public:
|
||||
static td::string get_description() {
|
||||
return PSTRING() << "Array" << max_size;
|
||||
@ -650,38 +651,38 @@ class DuplicateCheckerBenchEvenOdd final : public td::Benchmark {
|
||||
int main() {
|
||||
SET_VERBOSITY_LEVEL(VERBOSITY_NAME(DEBUG));
|
||||
|
||||
td::bench(DuplicateCheckerBenchEvenOdd<MessageIdDuplicateCheckerNew<1000>>());
|
||||
td::bench(DuplicateCheckerBenchEvenOdd<MessageIdDuplicateCheckerNew<300>>());
|
||||
td::bench(DuplicateCheckerBenchEvenOdd<MessageIdDuplicateCheckerArray<1000>>());
|
||||
td::bench(DuplicateCheckerBenchEvenOdd<MessageIdDuplicateCheckerArray<300>>());
|
||||
td::bench(DuplicateCheckerBenchEvenOdd<IdDuplicateCheckerNew<1000>>());
|
||||
td::bench(DuplicateCheckerBenchEvenOdd<IdDuplicateCheckerNew<300>>());
|
||||
td::bench(DuplicateCheckerBenchEvenOdd<IdDuplicateCheckerArray<1000>>());
|
||||
td::bench(DuplicateCheckerBenchEvenOdd<IdDuplicateCheckerArray<300>>());
|
||||
|
||||
td::bench(DuplicateCheckerBenchReverse<MessageIdDuplicateCheckerNew<1000>>());
|
||||
td::bench(DuplicateCheckerBenchReverse<MessageIdDuplicateCheckerNew<300>>());
|
||||
td::bench(DuplicateCheckerBenchReverse<MessageIdDuplicateCheckerArray<1000>>());
|
||||
td::bench(DuplicateCheckerBenchReverse<MessageIdDuplicateCheckerArray<300>>());
|
||||
td::bench(DuplicateCheckerBenchReverse<IdDuplicateCheckerNew<1000>>());
|
||||
td::bench(DuplicateCheckerBenchReverse<IdDuplicateCheckerNew<300>>());
|
||||
td::bench(DuplicateCheckerBenchReverse<IdDuplicateCheckerArray<1000>>());
|
||||
td::bench(DuplicateCheckerBenchReverse<IdDuplicateCheckerArray<300>>());
|
||||
|
||||
td::bench(DuplicateCheckerBenchRepeatOnly<MessageIdDuplicateCheckerNew<1000>>());
|
||||
td::bench(DuplicateCheckerBenchRepeatOnly<MessageIdDuplicateCheckerNew<300>>());
|
||||
td::bench(DuplicateCheckerBenchRepeatOnly<MessageIdDuplicateCheckerArray<1000>>());
|
||||
td::bench(DuplicateCheckerBenchRepeatOnly<MessageIdDuplicateCheckerArray<300>>());
|
||||
td::bench(DuplicateCheckerBenchRepeatOnly<IdDuplicateCheckerNew<1000>>());
|
||||
td::bench(DuplicateCheckerBenchRepeatOnly<IdDuplicateCheckerNew<300>>());
|
||||
td::bench(DuplicateCheckerBenchRepeatOnly<IdDuplicateCheckerArray<1000>>());
|
||||
td::bench(DuplicateCheckerBenchRepeatOnly<IdDuplicateCheckerArray<300>>());
|
||||
|
||||
td::bench(DuplicateCheckerBenchRepeat<MessageIdDuplicateCheckerOld>());
|
||||
td::bench(DuplicateCheckerBenchRepeat<MessageIdDuplicateCheckerNew<1000>>());
|
||||
td::bench(DuplicateCheckerBenchRepeat<MessageIdDuplicateCheckerNewOther>());
|
||||
td::bench(DuplicateCheckerBenchRepeat<MessageIdDuplicateCheckerNewSimple>());
|
||||
td::bench(DuplicateCheckerBenchRepeat<MessageIdDuplicateCheckerNew<300>>());
|
||||
td::bench(DuplicateCheckerBenchRepeat<MessageIdDuplicateCheckerArray<1000>>());
|
||||
td::bench(DuplicateCheckerBenchRepeat<MessageIdDuplicateCheckerArray<300>>());
|
||||
td::bench(DuplicateCheckerBenchRepeat<IdDuplicateCheckerOld>());
|
||||
td::bench(DuplicateCheckerBenchRepeat<IdDuplicateCheckerNew<1000>>());
|
||||
td::bench(DuplicateCheckerBenchRepeat<IdDuplicateCheckerNewOther>());
|
||||
td::bench(DuplicateCheckerBenchRepeat<IdDuplicateCheckerNewSimple>());
|
||||
td::bench(DuplicateCheckerBenchRepeat<IdDuplicateCheckerNew<300>>());
|
||||
td::bench(DuplicateCheckerBenchRepeat<IdDuplicateCheckerArray<1000>>());
|
||||
td::bench(DuplicateCheckerBenchRepeat<IdDuplicateCheckerArray<300>>());
|
||||
|
||||
td::bench(DuplicateCheckerBench<MessageIdDuplicateCheckerOld>());
|
||||
td::bench(DuplicateCheckerBench<MessageIdDuplicateCheckerNew<1000>>());
|
||||
td::bench(DuplicateCheckerBench<MessageIdDuplicateCheckerNewOther>());
|
||||
td::bench(DuplicateCheckerBench<MessageIdDuplicateCheckerNewSimple>());
|
||||
td::bench(DuplicateCheckerBench<MessageIdDuplicateCheckerNew<300>>());
|
||||
td::bench(DuplicateCheckerBench<MessageIdDuplicateCheckerNew<100>>());
|
||||
td::bench(DuplicateCheckerBench<MessageIdDuplicateCheckerNew<10>>());
|
||||
td::bench(DuplicateCheckerBench<MessageIdDuplicateCheckerArray<1000>>());
|
||||
td::bench(DuplicateCheckerBench<MessageIdDuplicateCheckerArray<300>>());
|
||||
td::bench(DuplicateCheckerBench<IdDuplicateCheckerOld>());
|
||||
td::bench(DuplicateCheckerBench<IdDuplicateCheckerNew<1000>>());
|
||||
td::bench(DuplicateCheckerBench<IdDuplicateCheckerNewOther>());
|
||||
td::bench(DuplicateCheckerBench<IdDuplicateCheckerNewSimple>());
|
||||
td::bench(DuplicateCheckerBench<IdDuplicateCheckerNew<300>>());
|
||||
td::bench(DuplicateCheckerBench<IdDuplicateCheckerNew<100>>());
|
||||
td::bench(DuplicateCheckerBench<IdDuplicateCheckerNew<10>>());
|
||||
td::bench(DuplicateCheckerBench<IdDuplicateCheckerArray<1000>>());
|
||||
td::bench(DuplicateCheckerBench<IdDuplicateCheckerArray<300>>());
|
||||
|
||||
#if !TD_THREAD_UNSUPPORTED
|
||||
for (int i = 1; i <= 16; i *= 2) {
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
|
@ -1776,7 +1776,7 @@ messagePinMessage message_id:int53 = MessageContent;
|
||||
//@description A screenshot of a message in the chat has been taken
|
||||
messageScreenshotTaken = MessageContent;
|
||||
|
||||
//@description The in the chat has been changed @theme_name New message TTL setting
|
||||
//@description A theme in the chat has been changed @theme_name If non-empty, name of the new theme set for the chat. Otherwise theme was deleted in the chat
|
||||
messageChatSetTheme theme_name:string = MessageContent;
|
||||
|
||||
//@description The TTL (Time To Live) setting for messages in the chat has been changed @ttl New message TTL setting
|
||||
|
@ -31,7 +31,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
namespace td {
|
||||
|
||||
|
@ -18,8 +18,6 @@
|
||||
#include "td/utils/logging.h"
|
||||
#include "td/utils/misc.h"
|
||||
#include "td/utils/Random.h"
|
||||
#include "td/utils/Slice.h"
|
||||
#include "td/utils/Status.h"
|
||||
#include "td/utils/Time.h"
|
||||
#include "td/utils/tl_parsers.h"
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "td/actor/PromiseFuture.h"
|
||||
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/Slice.h"
|
||||
#include "td/utils/Status.h"
|
||||
|
||||
#include <mutex>
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "td/telegram/VoiceNotesManager.h"
|
||||
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/format.h"
|
||||
#include "td/utils/HttpUrl.h"
|
||||
#include "td/utils/logging.h"
|
||||
#include "td/utils/MimeType.h"
|
||||
|
@ -84,6 +84,7 @@
|
||||
#include "td/utils/tl_helpers.h"
|
||||
#include "td/utils/utf8.h"
|
||||
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
|
||||
namespace td {
|
||||
|
@ -1873,7 +1873,7 @@ Result<vector<MessageEntity>> parse_markdown(string &text) {
|
||||
case '[': {
|
||||
string url;
|
||||
if (text[i + 1] != '(') {
|
||||
// use text as a url
|
||||
// use text as a URL
|
||||
url.assign(text, begin_pos + 1, i - begin_pos - 1);
|
||||
} else {
|
||||
i += 2;
|
||||
@ -2070,7 +2070,7 @@ static Result<vector<MessageEntity>> do_parse_markdown_v2(CSlice text, string &r
|
||||
case MessageEntity::Type::TextUrl: {
|
||||
string url;
|
||||
if (text[i + 1] != '(') {
|
||||
// use text as a url
|
||||
// use text as a URL
|
||||
url = result.substr(nested_entities.back().entity_begin_pos);
|
||||
} else {
|
||||
i += 2;
|
||||
|
@ -31,9 +31,9 @@
|
||||
#include "td/telegram/MessageId.h"
|
||||
#include "td/telegram/MessageLinkInfo.h"
|
||||
#include "td/telegram/MessageReplyInfo.h"
|
||||
#include "td/telegram/MessageThreadInfo.h"
|
||||
#include "td/telegram/MessagesDb.h"
|
||||
#include "td/telegram/MessageSearchFilter.h"
|
||||
#include "td/telegram/MessageThreadInfo.h"
|
||||
#include "td/telegram/MessageTtlSetting.h"
|
||||
#include "td/telegram/net/NetQuery.h"
|
||||
#include "td/telegram/Notification.h"
|
||||
|
@ -6,6 +6,7 @@
|
||||
//
|
||||
#include "td/telegram/SponsoredMessages.h"
|
||||
|
||||
#include "td/telegram/ChannelId.h"
|
||||
#include "td/telegram/ContactsManager.h"
|
||||
#include "td/telegram/Global.h"
|
||||
#include "td/telegram/MessageContent.h"
|
||||
@ -13,8 +14,11 @@
|
||||
#include "td/telegram/MessagesManager.h"
|
||||
#include "td/telegram/net/NetQueryCreator.h"
|
||||
#include "td/telegram/Td.h"
|
||||
#include "td/telegram/telegram_api.h"
|
||||
|
||||
//#include "td/utils/buffer.h"
|
||||
#include "td/utils/buffer.h"
|
||||
#include "td/utils/logging.h"
|
||||
#include "td/utils/Status.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "td/utils/algorithm.h"
|
||||
#include "td/utils/buffer.h"
|
||||
#include "td/utils/logging.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
@ -159,7 +160,7 @@ ThemeManager::BaseTheme ThemeManager::get_base_theme(
|
||||
ThemeManager::ThemeSettings ThemeManager::get_chat_theme_settings(
|
||||
telegram_api::object_ptr<telegram_api::themeSettings> settings) {
|
||||
ThemeSettings result;
|
||||
if (settings != nullptr && 1 <= settings->message_colors_.size() && settings->message_colors_.size() <= 4) {
|
||||
if (settings != nullptr && !settings->message_colors_.empty() && settings->message_colors_.size() <= 4) {
|
||||
auto background =
|
||||
td_->background_manager_->on_get_background(BackgroundId(), string(), std::move(settings->wallpaper_), false);
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "td/telegram/BackgroundId.h"
|
||||
#include "td/telegram/BackgroundType.h"
|
||||
#include "td/telegram/td.h"
|
||||
#include "td/telegram/td_api.h"
|
||||
#include "td/telegram/telegram_api.h"
|
||||
|
||||
#include "td/actor/actor.h"
|
||||
|
@ -51,6 +51,8 @@
|
||||
#include "td/utils/tl_helpers.h"
|
||||
#include "td/utils/utf8.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace td {
|
||||
|
||||
class GetWebPagePreviewQuery final : public Td::ResultHandler {
|
||||
|
@ -13,7 +13,6 @@ static void check_phone_number_info(const td::string &phone_number_prefix, const
|
||||
const td::string &calling_code, const td::string &formatted_phone_number) {
|
||||
auto result = td::CountryInfoManager::get_phone_number_info_sync(td::string(), phone_number_prefix);
|
||||
CHECK(result != nullptr);
|
||||
// LOG(ERROR) << phone_number_prefix << ' ' << to_string(result);
|
||||
if (result->country_ == nullptr) {
|
||||
CHECK(country_code.empty());
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user