Skip to content

Commit 1e49f6d

Browse files
committed
Use auto as variable type if it is initialized with a cast.
1 parent d225bdf commit 1e49f6d

26 files changed

+50
-49
lines changed

‎benchmark/bench_http_reader.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class HttpReaderBench final : public td::Benchmark {
2222
}
2323

2424
void run(int n) final {
25-
int cnt = static_cast<int>(block_size / http_query.size());
25+
auto cnt = static_cast<int>(block_size / http_query.size());
2626
td::HttpQuery q;
2727
int parsed = 0;
2828
int sent = 0;
@@ -58,7 +58,7 @@ class BufferBench final : public td::Benchmark {
5858
}
5959

6060
void run(int n) final {
61-
int cnt = static_cast<int>(block_size / http_query.size());
61+
auto cnt = static_cast<int>(block_size / http_query.size());
6262
for (int i = 0; i < n; i += cnt) {
6363
for (int j = 0; j < cnt; j++) {
6464
writer_.append(http_query);
@@ -84,7 +84,7 @@ class FindBoundaryBench final : public td::Benchmark {
8484
}
8585

8686
void run(int n) final {
87-
int cnt = static_cast<int>(block_size / http_query.size());
87+
auto cnt = static_cast<int>(block_size / http_query.size());
8888
for (int i = 0; i < n; i += cnt) {
8989
for (int j = 0; j < cnt; j++) {
9090
writer_.append(http_query);

‎benchmark/bench_queue.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ class QueueBenchmark2 final : public td::Benchmark {
591591

592592
void server_process(qvalue_t value) {
593593
int no = value & 0x00FFFFFF;
594-
int co = static_cast<int>(static_cast<td::uint32>(value) >> 24);
594+
auto co = static_cast<int>(static_cast<td::uint32>(value) >> 24);
595595
// std::fprintf(stderr, "-->%d %d\n", co, no);
596596
if (co < 0 || co >= connections_n || no != server_conn[co]++) {
597597
std::fprintf(stderr, "%d %d\n", co, no);
@@ -632,7 +632,7 @@ class QueueBenchmark2 final : public td::Benchmark {
632632

633633
void client_process(qvalue_t value) {
634634
int no = value & 0x00FFFFFF;
635-
int co = static_cast<int>(static_cast<td::uint32>(value) >> 24);
635+
auto co = static_cast<int>(static_cast<td::uint32>(value) >> 24);
636636
// std::fprintf(stderr, "<--%d %d\n", co, no);
637637
if (co < 0 || co >= connections_n || no != client_conn[co]++) {
638638
std::fprintf(stderr, "%d %d\n", co, no);
@@ -733,7 +733,7 @@ class QueueBenchmark final : public td::Benchmark {
733733
while (active_connections > 0) {
734734
qvalue_t value = server.get();
735735
int no = value & 0x00FFFFFF;
736-
int co = static_cast<int>(value >> 24);
736+
auto co = static_cast<int>(value >> 24);
737737
// std::fprintf(stderr, "-->%d %d\n", co, no);
738738
if (co < 0 || co >= connections_n || no != conn[co]++) {
739739
std::fprintf(stderr, "%d %d\n", co, no);
@@ -764,7 +764,7 @@ class QueueBenchmark final : public td::Benchmark {
764764
while (active_connections > 0) {
765765
qvalue_t value = client.get();
766766
int no = value & 0x00FFFFFF;
767-
int co = static_cast<int>(value >> 24);
767+
auto co = static_cast<int>(value >> 24);
768768
// std::fprintf(stderr, "<--%d %d\n", co, no);
769769
if (co < 0 || co >= connections_n || no != conn[co]++) {
770770
std::fprintf(stderr, "%d %d\n", co, no);
@@ -797,7 +797,7 @@ class QueueBenchmark final : public td::Benchmark {
797797
for (int i = 0; i < connections_n; i++) {
798798
qvalue_t value = client.get();
799799
int no = value & 0x00FFFFFF;
800-
int co = static_cast<int>(value >> 24);
800+
auto co = static_cast<int>(value >> 24);
801801
// std::fprintf(stderr, "<--%d %d\n", co, no);
802802
if (co < 0 || co >= connections_n || no != conn[co]++) {
803803
std::fprintf(stderr, "%d %d\n", co, no);

‎example/java/td_jni.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ static jint Client_nativeClientReceive(JNIEnv *env, jclass clazz, jintArray clie
5050
auto *manager = get_manager();
5151
auto response = manager->receive(timeout);
5252
while (response.object) {
53-
jint client_id = static_cast<jint>(response.client_id);
53+
auto client_id = static_cast<jint>(response.client_id);
5454
env->SetIntArrayRegion(client_ids, result_size, 1, &client_id);
5555

56-
jlong request_id = static_cast<jlong>(response.request_id);
56+
auto request_id = static_cast<jlong>(response.request_id);
5757
env->SetLongArrayRegion(ids, result_size, 1, &request_id);
5858

5959
jobject object;

‎memprof/memprof.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static int fast_backtrace(void **buffer, int size) {
5858
void *ip;
5959
};
6060

61-
stack_frame *bp = reinterpret_cast<stack_frame *>(get_bp());
61+
auto *bp = reinterpret_cast<stack_frame *>(get_bp());
6262
int i = 0;
6363
while (i < size &&
6464
#if TD_LINUX
@@ -153,7 +153,7 @@ std::size_t get_ht_size() {
153153

154154
std::int32_t get_ht_pos(const Backtrace &bt, bool force = false) {
155155
auto hash = get_hash(bt);
156-
std::int32_t pos = static_cast<std::int32_t>(hash % ht.size());
156+
auto pos = static_cast<std::int32_t>(hash % ht.size());
157157
bool was_overflow = false;
158158
while (true) {
159159
auto pos_hash = ht[pos].hash.load();
@@ -237,7 +237,7 @@ static void *malloc_with_frame(std::size_t size, const Backtrace &frame) {
237237
}
238238

239239
static malloc_info *get_info(void *data_void) {
240-
char *data = static_cast<char *>(data_void);
240+
auto *data = static_cast<char *>(data_void);
241241
auto *buf = data - RESERVED_SIZE;
242242

243243
auto *info = reinterpret_cast<malloc_info *>(buf);

‎td/telegram/CallActor.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ void CallActor::on_begin_exchanging_key() {
457457
call_state_.type = CallState::Type::ExchangingKey;
458458
call_state_need_flush_ = true;
459459
int64 call_receive_timeout_ms = G()->shared_config().get_option_integer("call_receive_timeout_ms", 20000);
460-
double timeout = static_cast<double>(call_receive_timeout_ms) * 0.001;
460+
auto timeout = static_cast<double>(call_receive_timeout_ms) * 0.001;
461461
LOG(INFO) << "Set call timeout to " << timeout;
462462
set_timeout_in(timeout);
463463
}
@@ -636,7 +636,7 @@ void CallActor::try_send_request_query() {
636636
auto query = G()->net_query_creator().create(tl_query);
637637
state_ = State::WaitRequestResult;
638638
int64 call_receive_timeout_ms = G()->shared_config().get_option_integer("call_receive_timeout_ms", 20000);
639-
double timeout = static_cast<double>(call_receive_timeout_ms) * 0.001;
639+
auto timeout = static_cast<double>(call_receive_timeout_ms) * 0.001;
640640
LOG(INFO) << "Set call timeout to " << timeout;
641641
set_timeout_in(timeout);
642642
query->total_timeout_limit_ = max(timeout, 10.0);

‎td/telegram/MessagesManager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -16389,7 +16389,7 @@ std::pair<int32, vector<DialogId>> MessagesManager::get_recently_opened_dialogs(
1638916389

1639016390
vector<DialogId> MessagesManager::sort_dialogs_by_order(const vector<DialogId> &dialog_ids, int32 limit) const {
1639116391
CHECK(!td_->auth_manager_->is_bot());
16392-
int64 fake_order = static_cast<int64>(dialog_ids.size()) + 1;
16392+
auto fake_order = static_cast<int64>(dialog_ids.size()) + 1;
1639316393
auto dialog_dates = transform(dialog_ids, [this, &fake_order](DialogId dialog_id) {
1639416394
const Dialog *d = get_dialog(dialog_id);
1639516395
CHECK(d != nullptr);

‎td/telegram/StickersManager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6631,7 +6631,7 @@ double StickersManager::get_emoji_language_code_last_difference_time(const strin
66316631
return it->second;
66326632
}
66336633
auto &result = emoji_language_code_last_difference_times_[language_code];
6634-
int32 old_unix_time = to_integer<int32>(G()->td_db()->get_sqlite_sync_pmc()->get(
6634+
auto old_unix_time = to_integer<int32>(G()->td_db()->get_sqlite_sync_pmc()->get(
66356635
get_emoji_language_code_last_difference_time_database_key(language_code)));
66366636
int32 passed_time = max(static_cast<int32>(0), G()->unix_time() - old_unix_time);
66376637
result = Time::now_cached() - passed_time;

‎td/telegram/cli.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4314,7 +4314,7 @@ class CliClient final : public Actor {
43144314
<< stats.virtual_size_ << ", peak VSZ = " << stats.virtual_size_peak_;
43154315
}
43164316
} else if (op == "cpu") {
4317-
uint32 inc_count = to_integer<uint32>(args);
4317+
auto inc_count = to_integer<uint32>(args);
43184318
while (inc_count-- > 0) {
43194319
cpu_counter_++;
43204320
}

‎td/telegram/files/FileLoaderUtils.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ StringBuilder &operator<<(StringBuilder &sb, const Ext &ext) {
6666
Result<std::pair<FileFd, string>> open_temp_file(FileType file_type) {
6767
auto pmc = G()->td_db()->get_binlog_pmc();
6868
// TODO: CAS?
69-
int32 file_id = to_integer<int32>(pmc->get("tmp_file_id"));
69+
auto file_id = to_integer<int32>(pmc->get("tmp_file_id"));
7070
pmc->set("tmp_file_id", to_string(file_id + 1));
7171

7272
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
9494
}
9595
} else if (use_pmc) {
9696
auto pmc = G()->td_db()->get_binlog_pmc();
97-
int32 file_id = to_integer<int32>(pmc->get("perm_file_id"));
97+
auto file_id = to_integer<int32>(pmc->get("perm_file_id"));
9898
pmc->set("perm_file_id", to_string(file_id + 1));
9999
active = callback(PSLICE() << "file_" << file_id << Ext{ext});
100100
if (active) {

‎td/telegram/net/NetQueryDispatcher.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ void NetQueryDispatcher::try_fix_migrate(NetQueryPtr &net_query) {
298298
static constexpr CSlice prefixes[] = {"PHONE_MIGRATE_", "NETWORK_MIGRATE_", "USER_MIGRATE_"};
299299
for (auto &prefix : prefixes) {
300300
if (msg.substr(0, prefix.size()) == prefix) {
301-
int32 new_main_dc_id = to_integer<int32>(msg.substr(prefix.size()));
301+
auto new_main_dc_id = to_integer<int32>(msg.substr(prefix.size()));
302302
set_main_dc_id(new_main_dc_id);
303303

304304
if (!net_query->dc_id().is_main()) {

‎td/tl/tl_jni_object.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ std::string fetch_string(JNIEnv *env, jobject o, jfieldID id) {
213213

214214
std::string from_jstring(JNIEnv *env, jstring s) {
215215
if (!s) {
216-
return "";
216+
return std::string();
217217
}
218218
jsize s_len = env->GetStringLength(s);
219219
const jchar *p = env->GetStringChars(s, nullptr);
@@ -264,7 +264,7 @@ std::string from_bytes(JNIEnv *env, jbyteArray arr) {
264264

265265
jbyteArray to_bytes(JNIEnv *env, const std::string &b) {
266266
static_assert(sizeof(char) == sizeof(jbyte), "Mismatched jbyte size");
267-
jsize length = narrow_cast<jsize>(b.size());
267+
auto length = narrow_cast<jsize>(b.size());
268268
jbyteArray arr = env->NewByteArray(length);
269269
if (arr != nullptr && length != 0) {
270270
env->SetByteArrayRegion(arr, 0, length, reinterpret_cast<const jbyte *>(b.data()));
@@ -274,7 +274,7 @@ jbyteArray to_bytes(JNIEnv *env, const std::string &b) {
274274

275275
jintArray store_vector(JNIEnv *env, const std::vector<std::int32_t> &v) {
276276
static_assert(sizeof(std::int32_t) == sizeof(jint), "Mismatched jint size");
277-
jsize length = narrow_cast<jsize>(v.size());
277+
auto length = narrow_cast<jsize>(v.size());
278278
jintArray arr = env->NewIntArray(length);
279279
if (arr != nullptr && length != 0) {
280280
env->SetIntArrayRegion(arr, 0, length, reinterpret_cast<const jint *>(&v[0]));
@@ -284,7 +284,7 @@ jintArray store_vector(JNIEnv *env, const std::vector<std::int32_t> &v) {
284284

285285
jlongArray store_vector(JNIEnv *env, const std::vector<std::int64_t> &v) {
286286
static_assert(sizeof(std::int64_t) == sizeof(jlong), "Mismatched jlong size");
287-
jsize length = narrow_cast<jsize>(v.size());
287+
auto length = narrow_cast<jsize>(v.size());
288288
jlongArray arr = env->NewLongArray(length);
289289
if (arr != nullptr && length != 0) {
290290
env->SetLongArrayRegion(arr, 0, length, reinterpret_cast<const jlong *>(&v[0]));
@@ -294,7 +294,7 @@ jlongArray store_vector(JNIEnv *env, const std::vector<std::int64_t> &v) {
294294

295295
jdoubleArray store_vector(JNIEnv *env, const std::vector<double> &v) {
296296
static_assert(sizeof(double) == sizeof(jdouble), "Mismatched jdouble size");
297-
jsize length = narrow_cast<jsize>(v.size());
297+
auto length = narrow_cast<jsize>(v.size());
298298
jdoubleArray arr = env->NewDoubleArray(length);
299299
if (arr != nullptr && length != 0) {
300300
env->SetDoubleArrayRegion(arr, 0, length, reinterpret_cast<const jdouble *>(&v[0]));
@@ -303,7 +303,7 @@ jdoubleArray store_vector(JNIEnv *env, const std::vector<double> &v) {
303303
}
304304

305305
jobjectArray store_vector(JNIEnv *env, const std::vector<std::string> &v) {
306-
jsize length = narrow_cast<jsize>(v.size());
306+
auto length = narrow_cast<jsize>(v.size());
307307
jobjectArray arr = env->NewObjectArray(length, StringClass, 0);
308308
if (arr != nullptr) {
309309
for (jsize i = 0; i < length; i++) {

‎td/tl/tl_jni_object.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobjectArray store_vector(JNIEnv *env, const std::vector<std::string> &v);
107107

108108
template <class T>
109109
jobjectArray store_vector(JNIEnv *env, const std::vector<T> &v) {
110-
jint length = static_cast<jint>(v.size());
110+
auto length = static_cast<jint>(v.size());
111111
jobjectArray arr = env->NewObjectArray(length, T::element_type::Class, jobject());
112112
if (arr != nullptr) {
113113
for (jint i = 0; i < length; i++) {
@@ -155,7 +155,7 @@ class get_array_class<td_api::pageBlockTableCell> {
155155

156156
template <class T>
157157
jobjectArray store_vector(JNIEnv *env, const std::vector<std::vector<T>> &v) {
158-
jint length = static_cast<jint>(v.size());
158+
auto length = static_cast<jint>(v.size());
159159
jobjectArray arr = env->NewObjectArray(length, get_array_class<typename T::element_type>::get(), 0);
160160
if (arr != nullptr) {
161161
for (jint i = 0; i < length; i++) {

‎tdactor/td/actor/impl/Scheduler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ void Scheduler::set_actor_timeout_at(ActorInfo *actor_info, double timeout_at) {
435435

436436
void Scheduler::run_poll(Timestamp timeout) {
437437
// we can't wait for less than 1ms
438-
int timeout_ms = static_cast<int32>(clamp(timeout.in(), 0.0, 1000000.0) * 1000 + 1);
438+
auto timeout_ms = static_cast<int>(clamp(timeout.in(), 0.0, 1000000.0) * 1000 + 1);
439439
#if TD_PORT_WINDOWS
440440
CHECK(inbound_queue_);
441441
inbound_queue_->reader_get_event_fd().wait(timeout_ms);

‎tddb/td/db/binlog/Binlog.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ void Binlog::do_reindex() {
680680
<< detail::file_size(new_path) << ' ' << fd_events_ << ' ' << path_;
681681
}
682682

683-
double ratio = static_cast<double>(start_size) / static_cast<double>(finish_size + 1);
683+
auto ratio = static_cast<double>(start_size) / static_cast<double>(finish_size + 1);
684684

685685
[&](Slice msg) {
686686
if (start_size > (10 << 20) || finish_time - start_time > 1) {

‎tdnet/td/net/HttpReader.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "td/utils/port/path.h"
2020
#include "td/utils/SliceBuilder.h"
2121

22+
#include <cstddef>
2223
#include <cstring>
2324

2425
namespace td {
@@ -114,14 +115,14 @@ Result<size_t> HttpReader::read_next(HttpQuery *query, bool can_be_slow) {
114115
return Status::Error(400, "Bad Request: boundary not found");
115116
}
116117
p += 8;
117-
ptrdiff_t offset = p - content_type_lowercased_.c_str();
118+
std::ptrdiff_t offset = p - content_type_lowercased_.c_str();
118119
p = static_cast<const char *>(
119120
std::memchr(content_type_.begin() + offset, '=', content_type_.size() - offset));
120121
if (p == nullptr) {
121122
return Status::Error(400, "Bad Request: boundary value not found");
122123
}
123124
p++;
124-
const char *end_p = static_cast<const char *>(std::memchr(p, ';', content_type_.end() - p));
125+
auto end_p = static_cast<const char *>(std::memchr(p, ';', content_type_.end() - p));
125126
if (end_p == nullptr) {
126127
end_p = content_type_.end();
127128
}

‎tdnet/td/net/SslStream.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ int strm_read(BIO *b, char *buf, int len) {
486486
CHECK(stream != nullptr);
487487
BIO_clear_retry_flags(b);
488488
CHECK(buf != nullptr);
489-
int res = narrow_cast<int>(stream->flow_read(MutableSlice(buf, len)));
489+
auto res = narrow_cast<int>(stream->flow_read(MutableSlice(buf, len)));
490490
if (res == 0) {
491491
BIO_set_retry_read(b);
492492
return -1;

‎tdutils/td/utils/ConcurrentHashTable.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ class AtomicHashArray {
5757
template <class F>
5858
bool with_value(KeyT key, bool should_create, F &&f) {
5959
DCHECK(key != empty_key());
60-
size_t pos = static_cast<size_t>(key) % nodes_.size();
61-
size_t n = td::min(td::max(static_cast<size_t>(300), nodes_.size() / 16 + 2), nodes_.size());
60+
auto pos = static_cast<size_t>(key) % nodes_.size();
61+
auto n = td::min(td::max(static_cast<size_t>(300), nodes_.size() / 16 + 2), nodes_.size());
6262

6363
for (size_t i = 0; i < n; i++) {
6464
pos++;

‎tdutils/td/utils/MemoryLog.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ class MemoryLog final : public LogInterface {
4747
CHECK(slice_size * 3 < buffer_size);
4848
size_t pad_size = ((slice_size + 15) & ~15) - slice_size;
4949
constexpr size_t MAGIC_SIZE = 16;
50-
uint32 total_size = static_cast<uint32>(slice_size + pad_size + MAGIC_SIZE);
51-
uint32 real_pos = pos_.fetch_add(total_size, std::memory_order_relaxed);
50+
auto total_size = static_cast<uint32>(slice_size + pad_size + MAGIC_SIZE);
51+
auto real_pos = pos_.fetch_add(total_size, std::memory_order_relaxed);
5252
CHECK((total_size & 15) == 0);
5353

5454
uint32 start_pos = real_pos & (buffer_size - 1);

‎tdutils/td/utils/StealingQueue.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class StealingQueue {
7777
if (other_tail < other_head) {
7878
continue;
7979
}
80-
size_t n = narrow_cast<size_t>(other_tail - other_head);
80+
auto n = narrow_cast<size_t>(other_tail - other_head);
8181
if (n > N) {
8282
continue;
8383
}

‎tdutils/td/utils/StringBuilder.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ StringBuilder &StringBuilder::operator<<(FixedDouble x) {
191191
ss->precision(x.precision);
192192
*ss << x.d;
193193

194-
int len = narrow_cast<int>(static_cast<std::streamoff>(ss->tellp()));
194+
auto len = narrow_cast<int>(static_cast<std::streamoff>(ss->tellp()));
195195
auto left = end_ptr_ + RESERVED_SIZE - current_ptr_;
196196
if (unlikely(len >= left)) {
197197
error_flag_ = true;

‎tdutils/td/utils/crypto.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ class AesIgeStateImpl {
466466
}
467467

468468
evp_.init_iv(encrypted_iv_.as_slice());
469-
int inlen = static_cast<int>(AES_BLOCK_SIZE * count);
469+
auto inlen = static_cast<int>(AES_BLOCK_SIZE * count);
470470
evp_.encrypt(data_xored[0].raw(), data_xored[0].raw(), inlen);
471471

472472
data_xored[0] ^= plaintext_iv_;
@@ -850,7 +850,7 @@ static void pbkdf2_impl(Slice password, Slice salt, int iteration_count, Mutable
850850
HMAC_CTX ctx;
851851
HMAC_CTX_init(&ctx);
852852
unsigned char counter[4] = {0, 0, 0, 1};
853-
int password_len = narrow_cast<int>(password.size());
853+
auto password_len = narrow_cast<int>(password.size());
854854
HMAC_Init_ex(&ctx, password.data(), password_len, evp_md, nullptr);
855855
HMAC_Update(&ctx, salt.ubegin(), narrow_cast<int>(salt.size()));
856856
HMAC_Update(&ctx, counter, 4);

‎tdutils/td/utils/find_boundary.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ bool find_boundary(ChainBufferReader range, Slice boundary, size_t &already_read
3333
range.advance(1);
3434
already_read++;
3535
} else {
36-
const char *ptr = static_cast<const char *>(std::memchr(ready.data(), boundary[0], ready.size()));
36+
const auto *ptr = static_cast<const char *>(std::memchr(ready.data(), boundary[0], ready.size()));
3737
size_t shift;
3838
if (ptr == nullptr) {
3939
shift = ready.size();

‎tdutils/td/utils/port/IPAddress.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static void punycode(string &result, Slice part) {
8686

8787
if (code == next_n) {
8888
// found next symbol, encode delta
89-
int left = static_cast<int>(delta);
89+
auto left = static_cast<int>(delta);
9090
while (true) {
9191
bias += 36;
9292
auto t = clamp(bias, 1, 26);

‎tdutils/td/utils/tl_parsers.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class TlParser {
178178
if (!error.empty()) {
179179
return T();
180180
}
181-
const char *result = reinterpret_cast<const char *>(data);
181+
auto result = reinterpret_cast<const char *>(data);
182182
data += size;
183183
return T(result, size);
184184
}

0 commit comments

Comments
 (0)