diff --git a/benchmark/bench_http_reader.cpp b/benchmark/bench_http_reader.cpp index a37c9718c..3babb748a 100644 --- a/benchmark/bench_http_reader.cpp +++ b/benchmark/bench_http_reader.cpp @@ -22,7 +22,7 @@ class HttpReaderBench final : public td::Benchmark { } void run(int n) final { - int cnt = static_cast(block_size / http_query.size()); + auto cnt = static_cast(block_size / http_query.size()); td::HttpQuery q; int parsed = 0; int sent = 0; @@ -58,7 +58,7 @@ class BufferBench final : public td::Benchmark { } void run(int n) final { - int cnt = static_cast(block_size / http_query.size()); + auto cnt = static_cast(block_size / http_query.size()); for (int i = 0; i < n; i += cnt) { for (int j = 0; j < cnt; j++) { writer_.append(http_query); @@ -84,7 +84,7 @@ class FindBoundaryBench final : public td::Benchmark { } void run(int n) final { - int cnt = static_cast(block_size / http_query.size()); + auto cnt = static_cast(block_size / http_query.size()); for (int i = 0; i < n; i += cnt) { for (int j = 0; j < cnt; j++) { writer_.append(http_query); diff --git a/benchmark/bench_queue.cpp b/benchmark/bench_queue.cpp index a442cfb26..f9a724fd3 100644 --- a/benchmark/bench_queue.cpp +++ b/benchmark/bench_queue.cpp @@ -591,7 +591,7 @@ class QueueBenchmark2 final : public td::Benchmark { void server_process(qvalue_t value) { int no = value & 0x00FFFFFF; - int co = static_cast(static_cast(value) >> 24); + auto co = static_cast(static_cast(value) >> 24); // std::fprintf(stderr, "-->%d %d\n", co, no); if (co < 0 || co >= connections_n || no != server_conn[co]++) { std::fprintf(stderr, "%d %d\n", co, no); @@ -632,7 +632,7 @@ class QueueBenchmark2 final : public td::Benchmark { void client_process(qvalue_t value) { int no = value & 0x00FFFFFF; - int co = static_cast(static_cast(value) >> 24); + auto co = static_cast(static_cast(value) >> 24); // std::fprintf(stderr, "<--%d %d\n", co, no); if (co < 0 || co >= connections_n || no != client_conn[co]++) { std::fprintf(stderr, "%d %d\n", co, no); @@ -733,7 +733,7 @@ class QueueBenchmark final : public td::Benchmark { while (active_connections > 0) { qvalue_t value = server.get(); int no = value & 0x00FFFFFF; - int co = static_cast(value >> 24); + auto co = static_cast(value >> 24); // std::fprintf(stderr, "-->%d %d\n", co, no); if (co < 0 || co >= connections_n || no != conn[co]++) { std::fprintf(stderr, "%d %d\n", co, no); @@ -764,7 +764,7 @@ class QueueBenchmark final : public td::Benchmark { while (active_connections > 0) { qvalue_t value = client.get(); int no = value & 0x00FFFFFF; - int co = static_cast(value >> 24); + auto co = static_cast(value >> 24); // std::fprintf(stderr, "<--%d %d\n", co, no); if (co < 0 || co >= connections_n || no != conn[co]++) { std::fprintf(stderr, "%d %d\n", co, no); @@ -797,7 +797,7 @@ class QueueBenchmark final : public td::Benchmark { for (int i = 0; i < connections_n; i++) { qvalue_t value = client.get(); int no = value & 0x00FFFFFF; - int co = static_cast(value >> 24); + auto co = static_cast(value >> 24); // std::fprintf(stderr, "<--%d %d\n", co, no); if (co < 0 || co >= connections_n || no != conn[co]++) { std::fprintf(stderr, "%d %d\n", co, no); diff --git a/example/java/td_jni.cpp b/example/java/td_jni.cpp index 7e2974feb..02d142896 100644 --- a/example/java/td_jni.cpp +++ b/example/java/td_jni.cpp @@ -50,10 +50,10 @@ static jint Client_nativeClientReceive(JNIEnv *env, jclass clazz, jintArray clie auto *manager = get_manager(); auto response = manager->receive(timeout); while (response.object) { - jint client_id = static_cast(response.client_id); + auto client_id = static_cast(response.client_id); env->SetIntArrayRegion(client_ids, result_size, 1, &client_id); - jlong request_id = static_cast(response.request_id); + auto request_id = static_cast(response.request_id); env->SetLongArrayRegion(ids, result_size, 1, &request_id); jobject object; diff --git a/memprof/memprof.cpp b/memprof/memprof.cpp index 7277b0bc5..b33d11943 100644 --- a/memprof/memprof.cpp +++ b/memprof/memprof.cpp @@ -58,7 +58,7 @@ static int fast_backtrace(void **buffer, int size) { void *ip; }; - stack_frame *bp = reinterpret_cast(get_bp()); + auto *bp = reinterpret_cast(get_bp()); int i = 0; while (i < size && #if TD_LINUX @@ -153,7 +153,7 @@ std::size_t get_ht_size() { std::int32_t get_ht_pos(const Backtrace &bt, bool force = false) { auto hash = get_hash(bt); - std::int32_t pos = static_cast(hash % ht.size()); + auto pos = static_cast(hash % ht.size()); bool was_overflow = false; while (true) { auto pos_hash = ht[pos].hash.load(); @@ -237,7 +237,7 @@ static void *malloc_with_frame(std::size_t size, const Backtrace &frame) { } static malloc_info *get_info(void *data_void) { - char *data = static_cast(data_void); + auto *data = static_cast(data_void); auto *buf = data - RESERVED_SIZE; auto *info = reinterpret_cast(buf); diff --git a/td/telegram/CallActor.cpp b/td/telegram/CallActor.cpp index 6b4174878..225ac6605 100644 --- a/td/telegram/CallActor.cpp +++ b/td/telegram/CallActor.cpp @@ -457,7 +457,7 @@ void CallActor::on_begin_exchanging_key() { call_state_.type = CallState::Type::ExchangingKey; call_state_need_flush_ = true; int64 call_receive_timeout_ms = G()->shared_config().get_option_integer("call_receive_timeout_ms", 20000); - double timeout = static_cast(call_receive_timeout_ms) * 0.001; + auto timeout = static_cast(call_receive_timeout_ms) * 0.001; LOG(INFO) << "Set call timeout to " << timeout; set_timeout_in(timeout); } @@ -636,7 +636,7 @@ void CallActor::try_send_request_query() { auto query = G()->net_query_creator().create(tl_query); state_ = State::WaitRequestResult; int64 call_receive_timeout_ms = G()->shared_config().get_option_integer("call_receive_timeout_ms", 20000); - double timeout = static_cast(call_receive_timeout_ms) * 0.001; + auto timeout = static_cast(call_receive_timeout_ms) * 0.001; LOG(INFO) << "Set call timeout to " << timeout; set_timeout_in(timeout); query->total_timeout_limit_ = max(timeout, 10.0); diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index f47191e82..e4d991dd6 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -16389,7 +16389,7 @@ std::pair> MessagesManager::get_recently_opened_dialogs( vector MessagesManager::sort_dialogs_by_order(const vector &dialog_ids, int32 limit) const { CHECK(!td_->auth_manager_->is_bot()); - int64 fake_order = static_cast(dialog_ids.size()) + 1; + auto fake_order = static_cast(dialog_ids.size()) + 1; auto dialog_dates = transform(dialog_ids, [this, &fake_order](DialogId dialog_id) { const Dialog *d = get_dialog(dialog_id); CHECK(d != nullptr); diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index 92151d7f7..b4fb66d62 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -6631,7 +6631,7 @@ double StickersManager::get_emoji_language_code_last_difference_time(const strin return it->second; } auto &result = emoji_language_code_last_difference_times_[language_code]; - int32 old_unix_time = to_integer(G()->td_db()->get_sqlite_sync_pmc()->get( + auto old_unix_time = to_integer(G()->td_db()->get_sqlite_sync_pmc()->get( get_emoji_language_code_last_difference_time_database_key(language_code))); int32 passed_time = max(static_cast(0), G()->unix_time() - old_unix_time); result = Time::now_cached() - passed_time; diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index f2f1a411f..61205ed52 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -4314,7 +4314,7 @@ class CliClient final : public Actor { << stats.virtual_size_ << ", peak VSZ = " << stats.virtual_size_peak_; } } else if (op == "cpu") { - uint32 inc_count = to_integer(args); + auto inc_count = to_integer(args); while (inc_count-- > 0) { cpu_counter_++; } diff --git a/td/telegram/files/FileLoaderUtils.cpp b/td/telegram/files/FileLoaderUtils.cpp index 4556909a1..a3631a3e7 100644 --- a/td/telegram/files/FileLoaderUtils.cpp +++ b/td/telegram/files/FileLoaderUtils.cpp @@ -66,7 +66,7 @@ StringBuilder &operator<<(StringBuilder &sb, const Ext &ext) { Result> open_temp_file(FileType file_type) { auto pmc = G()->td_db()->get_binlog_pmc(); // TODO: CAS? - int32 file_id = to_integer(pmc->get("tmp_file_id")); + auto file_id = to_integer(pmc->get("tmp_file_id")); pmc->set("tmp_file_id", to_string(file_id + 1)); auto temp_dir = get_files_temp_dir(file_type); @@ -94,7 +94,7 @@ bool for_suggested_file_name(CSlice name, bool use_pmc, bool use_random, F &&cal } } else if (use_pmc) { auto pmc = G()->td_db()->get_binlog_pmc(); - int32 file_id = to_integer(pmc->get("perm_file_id")); + auto file_id = to_integer(pmc->get("perm_file_id")); pmc->set("perm_file_id", to_string(file_id + 1)); active = callback(PSLICE() << "file_" << file_id << Ext{ext}); if (active) { diff --git a/td/telegram/net/NetQueryDispatcher.cpp b/td/telegram/net/NetQueryDispatcher.cpp index 6329cc055..0660af35b 100644 --- a/td/telegram/net/NetQueryDispatcher.cpp +++ b/td/telegram/net/NetQueryDispatcher.cpp @@ -298,7 +298,7 @@ void NetQueryDispatcher::try_fix_migrate(NetQueryPtr &net_query) { static constexpr CSlice prefixes[] = {"PHONE_MIGRATE_", "NETWORK_MIGRATE_", "USER_MIGRATE_"}; for (auto &prefix : prefixes) { if (msg.substr(0, prefix.size()) == prefix) { - int32 new_main_dc_id = to_integer(msg.substr(prefix.size())); + auto new_main_dc_id = to_integer(msg.substr(prefix.size())); set_main_dc_id(new_main_dc_id); if (!net_query->dc_id().is_main()) { diff --git a/td/tl/tl_jni_object.cpp b/td/tl/tl_jni_object.cpp index 2ce2c073e..5bae3de49 100644 --- a/td/tl/tl_jni_object.cpp +++ b/td/tl/tl_jni_object.cpp @@ -213,7 +213,7 @@ std::string fetch_string(JNIEnv *env, jobject o, jfieldID id) { std::string from_jstring(JNIEnv *env, jstring s) { if (!s) { - return ""; + return std::string(); } jsize s_len = env->GetStringLength(s); const jchar *p = env->GetStringChars(s, nullptr); @@ -264,7 +264,7 @@ std::string from_bytes(JNIEnv *env, jbyteArray arr) { jbyteArray to_bytes(JNIEnv *env, const std::string &b) { static_assert(sizeof(char) == sizeof(jbyte), "Mismatched jbyte size"); - jsize length = narrow_cast(b.size()); + auto length = narrow_cast(b.size()); jbyteArray arr = env->NewByteArray(length); if (arr != nullptr && length != 0) { env->SetByteArrayRegion(arr, 0, length, reinterpret_cast(b.data())); @@ -274,7 +274,7 @@ jbyteArray to_bytes(JNIEnv *env, const std::string &b) { jintArray store_vector(JNIEnv *env, const std::vector &v) { static_assert(sizeof(std::int32_t) == sizeof(jint), "Mismatched jint size"); - jsize length = narrow_cast(v.size()); + auto length = narrow_cast(v.size()); jintArray arr = env->NewIntArray(length); if (arr != nullptr && length != 0) { env->SetIntArrayRegion(arr, 0, length, reinterpret_cast(&v[0])); @@ -284,7 +284,7 @@ jintArray store_vector(JNIEnv *env, const std::vector &v) { jlongArray store_vector(JNIEnv *env, const std::vector &v) { static_assert(sizeof(std::int64_t) == sizeof(jlong), "Mismatched jlong size"); - jsize length = narrow_cast(v.size()); + auto length = narrow_cast(v.size()); jlongArray arr = env->NewLongArray(length); if (arr != nullptr && length != 0) { env->SetLongArrayRegion(arr, 0, length, reinterpret_cast(&v[0])); @@ -294,7 +294,7 @@ jlongArray store_vector(JNIEnv *env, const std::vector &v) { jdoubleArray store_vector(JNIEnv *env, const std::vector &v) { static_assert(sizeof(double) == sizeof(jdouble), "Mismatched jdouble size"); - jsize length = narrow_cast(v.size()); + auto length = narrow_cast(v.size()); jdoubleArray arr = env->NewDoubleArray(length); if (arr != nullptr && length != 0) { env->SetDoubleArrayRegion(arr, 0, length, reinterpret_cast(&v[0])); @@ -303,7 +303,7 @@ jdoubleArray store_vector(JNIEnv *env, const std::vector &v) { } jobjectArray store_vector(JNIEnv *env, const std::vector &v) { - jsize length = narrow_cast(v.size()); + auto length = narrow_cast(v.size()); jobjectArray arr = env->NewObjectArray(length, StringClass, 0); if (arr != nullptr) { for (jsize i = 0; i < length; i++) { diff --git a/td/tl/tl_jni_object.h b/td/tl/tl_jni_object.h index d2f81b350..b1e7dde5a 100644 --- a/td/tl/tl_jni_object.h +++ b/td/tl/tl_jni_object.h @@ -107,7 +107,7 @@ jobjectArray store_vector(JNIEnv *env, const std::vector &v); template jobjectArray store_vector(JNIEnv *env, const std::vector &v) { - jint length = static_cast(v.size()); + auto length = static_cast(v.size()); jobjectArray arr = env->NewObjectArray(length, T::element_type::Class, jobject()); if (arr != nullptr) { for (jint i = 0; i < length; i++) { @@ -155,7 +155,7 @@ class get_array_class { template jobjectArray store_vector(JNIEnv *env, const std::vector> &v) { - jint length = static_cast(v.size()); + auto length = static_cast(v.size()); jobjectArray arr = env->NewObjectArray(length, get_array_class::get(), 0); if (arr != nullptr) { for (jint i = 0; i < length; i++) { diff --git a/tdactor/td/actor/impl/Scheduler.cpp b/tdactor/td/actor/impl/Scheduler.cpp index 4e32cb33a..74013ab6c 100644 --- a/tdactor/td/actor/impl/Scheduler.cpp +++ b/tdactor/td/actor/impl/Scheduler.cpp @@ -435,7 +435,7 @@ void Scheduler::set_actor_timeout_at(ActorInfo *actor_info, double timeout_at) { void Scheduler::run_poll(Timestamp timeout) { // we can't wait for less than 1ms - int timeout_ms = static_cast(clamp(timeout.in(), 0.0, 1000000.0) * 1000 + 1); + auto timeout_ms = static_cast(clamp(timeout.in(), 0.0, 1000000.0) * 1000 + 1); #if TD_PORT_WINDOWS CHECK(inbound_queue_); inbound_queue_->reader_get_event_fd().wait(timeout_ms); diff --git a/tddb/td/db/binlog/Binlog.cpp b/tddb/td/db/binlog/Binlog.cpp index 9e5215ca8..873cfd6c8 100644 --- a/tddb/td/db/binlog/Binlog.cpp +++ b/tddb/td/db/binlog/Binlog.cpp @@ -680,7 +680,7 @@ void Binlog::do_reindex() { << detail::file_size(new_path) << ' ' << fd_events_ << ' ' << path_; } - double ratio = static_cast(start_size) / static_cast(finish_size + 1); + auto ratio = static_cast(start_size) / static_cast(finish_size + 1); [&](Slice msg) { if (start_size > (10 << 20) || finish_time - start_time > 1) { diff --git a/tdnet/td/net/HttpReader.cpp b/tdnet/td/net/HttpReader.cpp index 2d2478b27..59d770068 100644 --- a/tdnet/td/net/HttpReader.cpp +++ b/tdnet/td/net/HttpReader.cpp @@ -19,6 +19,7 @@ #include "td/utils/port/path.h" #include "td/utils/SliceBuilder.h" +#include #include namespace td { @@ -114,14 +115,14 @@ Result HttpReader::read_next(HttpQuery *query, bool can_be_slow) { return Status::Error(400, "Bad Request: boundary not found"); } p += 8; - ptrdiff_t offset = p - content_type_lowercased_.c_str(); + std::ptrdiff_t offset = p - content_type_lowercased_.c_str(); p = static_cast( std::memchr(content_type_.begin() + offset, '=', content_type_.size() - offset)); if (p == nullptr) { return Status::Error(400, "Bad Request: boundary value not found"); } p++; - const char *end_p = static_cast(std::memchr(p, ';', content_type_.end() - p)); + auto end_p = static_cast(std::memchr(p, ';', content_type_.end() - p)); if (end_p == nullptr) { end_p = content_type_.end(); } diff --git a/tdnet/td/net/SslStream.cpp b/tdnet/td/net/SslStream.cpp index 614baefc1..a392afbe1 100644 --- a/tdnet/td/net/SslStream.cpp +++ b/tdnet/td/net/SslStream.cpp @@ -486,7 +486,7 @@ int strm_read(BIO *b, char *buf, int len) { CHECK(stream != nullptr); BIO_clear_retry_flags(b); CHECK(buf != nullptr); - int res = narrow_cast(stream->flow_read(MutableSlice(buf, len))); + auto res = narrow_cast(stream->flow_read(MutableSlice(buf, len))); if (res == 0) { BIO_set_retry_read(b); return -1; diff --git a/tdutils/td/utils/ConcurrentHashTable.h b/tdutils/td/utils/ConcurrentHashTable.h index fae7a876c..3ecb0ffda 100644 --- a/tdutils/td/utils/ConcurrentHashTable.h +++ b/tdutils/td/utils/ConcurrentHashTable.h @@ -57,8 +57,8 @@ class AtomicHashArray { template bool with_value(KeyT key, bool should_create, F &&f) { DCHECK(key != empty_key()); - size_t pos = static_cast(key) % nodes_.size(); - size_t n = td::min(td::max(static_cast(300), nodes_.size() / 16 + 2), nodes_.size()); + auto pos = static_cast(key) % nodes_.size(); + auto n = td::min(td::max(static_cast(300), nodes_.size() / 16 + 2), nodes_.size()); for (size_t i = 0; i < n; i++) { pos++; diff --git a/tdutils/td/utils/MemoryLog.h b/tdutils/td/utils/MemoryLog.h index a634a0955..4e837b769 100644 --- a/tdutils/td/utils/MemoryLog.h +++ b/tdutils/td/utils/MemoryLog.h @@ -47,8 +47,8 @@ class MemoryLog final : public LogInterface { CHECK(slice_size * 3 < buffer_size); size_t pad_size = ((slice_size + 15) & ~15) - slice_size; constexpr size_t MAGIC_SIZE = 16; - uint32 total_size = static_cast(slice_size + pad_size + MAGIC_SIZE); - uint32 real_pos = pos_.fetch_add(total_size, std::memory_order_relaxed); + auto total_size = static_cast(slice_size + pad_size + MAGIC_SIZE); + auto real_pos = pos_.fetch_add(total_size, std::memory_order_relaxed); CHECK((total_size & 15) == 0); uint32 start_pos = real_pos & (buffer_size - 1); diff --git a/tdutils/td/utils/StealingQueue.h b/tdutils/td/utils/StealingQueue.h index 219551b36..4e0aace9e 100644 --- a/tdutils/td/utils/StealingQueue.h +++ b/tdutils/td/utils/StealingQueue.h @@ -77,7 +77,7 @@ class StealingQueue { if (other_tail < other_head) { continue; } - size_t n = narrow_cast(other_tail - other_head); + auto n = narrow_cast(other_tail - other_head); if (n > N) { continue; } diff --git a/tdutils/td/utils/StringBuilder.cpp b/tdutils/td/utils/StringBuilder.cpp index 8454f6887..1ffd33e63 100644 --- a/tdutils/td/utils/StringBuilder.cpp +++ b/tdutils/td/utils/StringBuilder.cpp @@ -191,7 +191,7 @@ StringBuilder &StringBuilder::operator<<(FixedDouble x) { ss->precision(x.precision); *ss << x.d; - int len = narrow_cast(static_cast(ss->tellp())); + auto len = narrow_cast(static_cast(ss->tellp())); auto left = end_ptr_ + RESERVED_SIZE - current_ptr_; if (unlikely(len >= left)) { error_flag_ = true; diff --git a/tdutils/td/utils/crypto.cpp b/tdutils/td/utils/crypto.cpp index 377be86ef..6355c89ef 100644 --- a/tdutils/td/utils/crypto.cpp +++ b/tdutils/td/utils/crypto.cpp @@ -466,7 +466,7 @@ class AesIgeStateImpl { } evp_.init_iv(encrypted_iv_.as_slice()); - int inlen = static_cast(AES_BLOCK_SIZE * count); + auto inlen = static_cast(AES_BLOCK_SIZE * count); evp_.encrypt(data_xored[0].raw(), data_xored[0].raw(), inlen); data_xored[0] ^= plaintext_iv_; @@ -850,7 +850,7 @@ static void pbkdf2_impl(Slice password, Slice salt, int iteration_count, Mutable HMAC_CTX ctx; HMAC_CTX_init(&ctx); unsigned char counter[4] = {0, 0, 0, 1}; - int password_len = narrow_cast(password.size()); + auto password_len = narrow_cast(password.size()); HMAC_Init_ex(&ctx, password.data(), password_len, evp_md, nullptr); HMAC_Update(&ctx, salt.ubegin(), narrow_cast(salt.size())); HMAC_Update(&ctx, counter, 4); diff --git a/tdutils/td/utils/find_boundary.cpp b/tdutils/td/utils/find_boundary.cpp index b71755d70..32fbe6bf0 100644 --- a/tdutils/td/utils/find_boundary.cpp +++ b/tdutils/td/utils/find_boundary.cpp @@ -33,7 +33,7 @@ bool find_boundary(ChainBufferReader range, Slice boundary, size_t &already_read range.advance(1); already_read++; } else { - const char *ptr = static_cast(std::memchr(ready.data(), boundary[0], ready.size())); + const auto *ptr = static_cast(std::memchr(ready.data(), boundary[0], ready.size())); size_t shift; if (ptr == nullptr) { shift = ready.size(); diff --git a/tdutils/td/utils/port/IPAddress.cpp b/tdutils/td/utils/port/IPAddress.cpp index cf4e317b7..38be8ed0c 100644 --- a/tdutils/td/utils/port/IPAddress.cpp +++ b/tdutils/td/utils/port/IPAddress.cpp @@ -86,7 +86,7 @@ static void punycode(string &result, Slice part) { if (code == next_n) { // found next symbol, encode delta - int left = static_cast(delta); + auto left = static_cast(delta); while (true) { bias += 36; auto t = clamp(bias, 1, 26); diff --git a/tdutils/td/utils/tl_parsers.h b/tdutils/td/utils/tl_parsers.h index a7141d263..e0fb668f8 100644 --- a/tdutils/td/utils/tl_parsers.h +++ b/tdutils/td/utils/tl_parsers.h @@ -178,7 +178,7 @@ class TlParser { if (!error.empty()) { return T(); } - const char *result = reinterpret_cast(data); + auto result = reinterpret_cast(data); data += size; return T(result, size); } diff --git a/tdutils/test/StealingQueue.cpp b/tdutils/test/StealingQueue.cpp index fc878fb58..64fca0e16 100644 --- a/tdutils/test/StealingQueue.cpp +++ b/tdutils/test/StealingQueue.cpp @@ -131,9 +131,9 @@ TEST(StealingQueue, simple) { for (td::uint64 round = 1; round < 1000; round++) { if (id == 0) { sum = 0; - int n = static_cast(rnd() % 5); + auto n = static_cast(rnd() % 5); for (int j = 0; j < n; j++) { - int x = static_cast(rnd() % XN); + auto x = static_cast(rnd() % XN); sum += x_sum[x]; gq.push(x, id); } diff --git a/tdutils/test/bitmask.cpp b/tdutils/test/bitmask.cpp index 1c7a5280b..6ace35354 100644 --- a/tdutils/test/bitmask.cpp +++ b/tdutils/test/bitmask.cpp @@ -78,8 +78,8 @@ class RangeSet { CHECK(it.begin % BIT_SIZE == 0); CHECK(it.end % BIT_SIZE == 0); - uint32 begin = narrow_cast(it.begin / BIT_SIZE); - uint32 end = narrow_cast(it.end / BIT_SIZE); + auto begin = narrow_cast(it.begin / BIT_SIZE); + auto end = narrow_cast(it.end / BIT_SIZE); if (sizes.empty()) { if (begin != 0) { sizes.push_back(0);