aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorlevlam <levlam@telegram.org>2023-03-06 16:59:18 +0300
committerlevlam <levlam@telegram.org>2023-03-06 16:59:18 +0300
commitd4646d4cd91274f9667ea77fc7bb0a140dc7db12 (patch)
treed799f15a4119cefe79a24d8107f115731310dbe2
parent36701d3acd3aab56844de07882fe7e283c6ada3d (diff)
Minor improvements.
-rw-r--r--.gitattributes1
-rw-r--r--td/generate/scheme/td_api.tl6
-rw-r--r--td/telegram/AttachMenuManager.cpp2
-rw-r--r--td/telegram/AutosaveManager.cpp9
-rw-r--r--td/telegram/EmojiGroup.cpp1
-rw-r--r--td/telegram/FileReferenceManager.cpp2
-rw-r--r--td/telegram/StickersManager.cpp5
-rw-r--r--td/telegram/WebApp.h1
-rw-r--r--tddb/td/db/binlog/BinlogEvent.cpp2
-rw-r--r--tdutils/td/utils/port/FileFd.cpp2
-rw-r--r--tdutils/td/utils/port/sleep.cpp6
-rw-r--r--test/link.cpp2
12 files changed, 21 insertions, 18 deletions
diff --git a/.gitattributes b/.gitattributes
index 06e5328a4..f657278f3 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -10,7 +10,6 @@
*.sh text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent eol=lf
*.php text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
*.ps1 text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent eol=crlf
-*.yml text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
*.cmake text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
*.md text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
*.in text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl
index 2011f5d7e..5b092b62e 100644
--- a/td/generate/scheme/td_api.tl
+++ b/td/generate/scheme/td_api.tl
@@ -6145,7 +6145,7 @@ getMessageLinkInfo url:string = MessageLinkInfo;
//@description Translates a text to the given language. If the current user is a Telegram Premium user, then text formatting is preserved
//@text Text to translate
-//@to_language_code ISO language code of the language to which the message is translated. Must be one of
+//@to_language_code Language code of the language to which the message is translated. Must be one of
//-"af", "sq", "am", "ar", "hy", "az", "eu", "be", "bn", "bs", "bg", "ca", "ceb", "zh-CN", "zh", "zh-Hans", "zh-TW", "zh-Hant", "co", "hr", "cs", "da", "nl", "en", "eo", "et",
//-"fi", "fr", "fy", "gl", "ka", "de", "el", "gu", "ht", "ha", "haw", "he", "iw", "hi", "hmn", "hu", "is", "ig", "id", "in", "ga", "it", "ja", "jv", "kn", "kk", "km", "rw", "ko",
//-"ku", "ky", "lo", "la", "lv", "lt", "lb", "mk", "mg", "ms", "ml", "mt", "mi", "mr", "mn", "my", "ne", "no", "ny", "or", "ps", "fa", "pl", "pt", "pa", "ro", "ru", "sm", "gd", "sr",
@@ -6155,7 +6155,7 @@ translateText text:formattedText to_language_code:string = FormattedText;
//@description Extracts text or caption of the given message and translates it to the given language. If the current user is a Telegram Premium user, then text formatting is preserved
//@chat_id Identifier of the chat to which the message belongs
//@message_id Identifier of the message
-//@to_language_code ISO language code of the language to which the message is translated. Must be one of
+//@to_language_code Language code of the language to which the message is translated. Must be one of
//-"af", "sq", "am", "ar", "hy", "az", "eu", "be", "bn", "bs", "bg", "ca", "ceb", "zh-CN", "zh", "zh-Hans", "zh-TW", "zh-Hant", "co", "hr", "cs", "da", "nl", "en", "eo", "et",
//-"fi", "fr", "fy", "gl", "ka", "de", "el", "gu", "ht", "ha", "haw", "he", "iw", "hi", "hmn", "hu", "is", "ig", "id", "in", "ga", "it", "ja", "jv", "kn", "kk", "km", "rw", "ko",
//-"ku", "ky", "lo", "la", "lv", "lt", "lb", "mk", "mg", "ms", "ml", "mt", "mi", "mr", "mn", "my", "ne", "no", "ny", "or", "ps", "fa", "pl", "pt", "pa", "ro", "ru", "sm", "gd", "sr",
@@ -8070,7 +8070,7 @@ checkStickerSetName name:string = CheckStickerSetNameResult;
//@name Sticker set name. Can contain only English letters, digits and underscores. Must end with *"_by_<bot username>"* (*<bot_username>* is case insensitive) for bots; 1-64 characters
//@sticker_format Format of the stickers in the set
//@sticker_type Type of the stickers in the set
-//@needs_repainting True, if stickers in the sticker set must be repainted; for custom emoji sticker sets only
+//@needs_repainting Pass true if stickers in the sticker set must be repainted; for custom emoji sticker sets only
//@stickers List of stickers to be added to the set; must be non-empty. All stickers must have the same format. For TGS stickers, uploadStickerFile must be used before the sticker is shown
//@source Source of the sticker set; may be empty if unknown
createNewStickerSet user_id:int53 title:string name:string sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool stickers:vector<inputSticker> source:string = StickerSet;
diff --git a/td/telegram/AttachMenuManager.cpp b/td/telegram/AttachMenuManager.cpp
index 54f7f15df..ecac42570 100644
--- a/td/telegram/AttachMenuManager.cpp
+++ b/td/telegram/AttachMenuManager.cpp
@@ -1161,7 +1161,7 @@ FileSourceId AttachMenuManager::get_web_app_file_source_id(UserId user_id, const
if (!source_id.is_valid()) {
source_id = td_->file_reference_manager_->create_web_app_file_source(user_id, short_name);
}
- VLOG(file_references) << "Return " << source_id << " for web app " << user_id << '/' << short_name;
+ VLOG(file_references) << "Return " << source_id << " for Web App " << user_id << '/' << short_name;
return source_id;
}
diff --git a/td/telegram/AutosaveManager.cpp b/td/telegram/AutosaveManager.cpp
index d96b3e8de..5d578841b 100644
--- a/td/telegram/AutosaveManager.cpp
+++ b/td/telegram/AutosaveManager.cpp
@@ -19,11 +19,11 @@
namespace td {
-class GetAutosaveSettingsQuery final : public Td::ResultHandler {
+class GetAutoSaveSettingsQuery final : public Td::ResultHandler {
Promise<telegram_api::object_ptr<telegram_api::account_autoSaveSettings>> promise_;
public:
- explicit GetAutosaveSettingsQuery(Promise<telegram_api::object_ptr<telegram_api::account_autoSaveSettings>> &&promise)
+ explicit GetAutoSaveSettingsQuery(Promise<telegram_api::object_ptr<telegram_api::account_autoSaveSettings>> &&promise)
: promise_(std::move(promise)) {
}
@@ -350,11 +350,13 @@ void AutosaveManager::reload_autosave_settings() {
[actor_id = actor_id(this)](Result<telegram_api::object_ptr<telegram_api::account_autoSaveSettings>> r_settings) {
send_closure(actor_id, &AutosaveManager::on_get_autosave_settings, std::move(r_settings));
});
- td_->create_handler<GetAutosaveSettingsQuery>(std::move(query_promise))->send();
+ td_->create_handler<GetAutoSaveSettingsQuery>(std::move(query_promise))->send();
}
void AutosaveManager::on_get_autosave_settings(
Result<telegram_api::object_ptr<telegram_api::account_autoSaveSettings>> r_settings) {
+ G()->ignore_result_if_closing(r_settings);
+
CHECK(settings_.are_being_reloaded_);
settings_.are_being_reloaded_ = false;
SCOPE_EXIT {
@@ -363,7 +365,6 @@ void AutosaveManager::on_get_autosave_settings(
reload_autosave_settings();
}
};
- G()->ignore_result_if_closing(r_settings);
if (r_settings.is_error()) {
return fail_promises(load_settings_queries_, r_settings.move_as_error());
}
diff --git a/td/telegram/EmojiGroup.cpp b/td/telegram/EmojiGroup.cpp
index d3c94ef38..693696af6 100644
--- a/td/telegram/EmojiGroup.cpp
+++ b/td/telegram/EmojiGroup.cpp
@@ -5,6 +5,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include "td/telegram/EmojiGroup.h"
+
#include "td/telegram/StickersManager.h"
#include "td/utils/algorithm.h"
diff --git a/td/telegram/FileReferenceManager.cpp b/td/telegram/FileReferenceManager.cpp
index 7a0fbc2c8..bd9d89c9e 100644
--- a/td/telegram/FileReferenceManager.cpp
+++ b/td/telegram/FileReferenceManager.cpp
@@ -158,7 +158,7 @@ FileSourceId FileReferenceManager::create_attach_menu_bot_file_source(UserId use
FileSourceId FileReferenceManager::create_web_app_file_source(UserId user_id, const string &short_name) {
FileSourceWebApp source{user_id, short_name};
- return add_file_source_id(source, PSLICE() << "web app " << user_id << '/' << short_name);
+ return add_file_source_id(source, PSLICE() << "Web App " << user_id << '/' << short_name);
}
FileReferenceManager::Node &FileReferenceManager::add_node(NodeId node_id) {
diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp
index 726abc915..22b30cabc 100644
--- a/td/telegram/StickersManager.cpp
+++ b/td/telegram/StickersManager.cpp
@@ -6792,10 +6792,11 @@ void StickersManager::on_get_default_dialog_photo_custom_emoji_ids(
if (!are_default_dialog_photo_custom_emoji_ids_loaded_[for_user]) {
on_get_default_dialog_photo_custom_emoji_ids_success(for_user, {}, 0);
}
- for (auto &promise : default_dialog_photo_custom_emoji_ids_load_queries_[for_user]) {
+ auto promises = std::move(default_dialog_photo_custom_emoji_ids_load_queries_[for_user]);
+ reset_to_empty(default_dialog_photo_custom_emoji_ids_load_queries_[for_user]);
+ for (auto &promise : promises) {
CHECK(!promise);
}
- reset_to_empty(default_dialog_photo_custom_emoji_ids_load_queries_[for_user]);
return;
}
CHECK(constructor_id == telegram_api::emojiList::ID);
diff --git a/td/telegram/WebApp.h b/td/telegram/WebApp.h
index 15e8ef78d..182ad4eb9 100644
--- a/td/telegram/WebApp.h
+++ b/td/telegram/WebApp.h
@@ -18,7 +18,6 @@
namespace td {
-class ContactsManager;
class Td;
class WebApp {
diff --git a/tddb/td/db/binlog/BinlogEvent.cpp b/tddb/td/db/binlog/BinlogEvent.cpp
index c74acd2b7..f1ff50ab9 100644
--- a/tddb/td/db/binlog/BinlogEvent.cpp
+++ b/tddb/td/db/binlog/BinlogEvent.cpp
@@ -38,7 +38,7 @@ Status BinlogEvent::validate() const {
return Status::Error("Too small event");
}
TlParser parser(as_slice(raw_event_));
- uint32 size = static_cast<uint32>(parser.fetch_int());
+ auto size = static_cast<uint32>(parser.fetch_int());
if (size_ != size || size_ != raw_event_.size()) {
return Status::Error(PSLICE() << "Size of event changed: " << tag("was", size_) << tag("now", size));
}
diff --git a/tdutils/td/utils/port/FileFd.cpp b/tdutils/td/utils/port/FileFd.cpp
index b78a82d7c..179d06c1a 100644
--- a/tdutils/td/utils/port/FileFd.cpp
+++ b/tdutils/td/utils/port/FileFd.cpp
@@ -157,7 +157,7 @@ Result<FileFd> FileFd::open(CSlice filepath, int32 flags, int32 mode) {
}
#endif
- while (1) {
+ while (true) {
int native_fd =
detail::skip_eintr([&] { return ::open(filepath.c_str(), native_flags, static_cast<mode_t>(mode)); });
if (native_fd < 0) {
diff --git a/tdutils/td/utils/port/sleep.cpp b/tdutils/td/utils/port/sleep.cpp
index ee693537c..3352ff67d 100644
--- a/tdutils/td/utils/port/sleep.cpp
+++ b/tdutils/td/utils/port/sleep.cpp
@@ -8,14 +8,16 @@
#include "td/utils/port/config.h"
+#if TD_PORT_WINDOWS
+#include "td/utils/port/Clocks.h"
+#endif
+
#if TD_PORT_POSIX
#if _POSIX_C_SOURCE >= 199309L
#include <time.h>
#else
#include <unistd.h>
#endif
-#else
-#include "td/utils/port/Clocks.h"
#endif
namespace td {
diff --git a/test/link.cpp b/test/link.cpp
index 7ee7b2174..633a746fe 100644
--- a/test/link.cpp
+++ b/test/link.cpp
@@ -112,7 +112,7 @@ static void parse_internal_link(const td::string &url, td::td_api::object_ptr<td
continue;
}
if (r_link.error().message() == "Deep link is unavailable for the link type") {
- // some links are http-only
+ // some links are HTTP-only
continue;
}
if (r_link.error().message() == "WALLPAPER_INVALID") {