diff --git a/td/telegram/MessageEntity.cpp b/td/telegram/MessageEntity.cpp index 05deacec..a087ea84 100644 --- a/td/telegram/MessageEntity.cpp +++ b/td/telegram/MessageEntity.cpp @@ -182,7 +182,7 @@ static vector match_mentions(Slice str) { // '/(?<=\B)@([a-zA-Z0-9_]{2,32})(?=\b)/u' while (true) { - ptr = reinterpret_cast(std::memchr(ptr, '@', narrow_cast(end - ptr))); + ptr = static_cast(std::memchr(ptr, '@', narrow_cast(end - ptr))); if (ptr == nullptr) { break; } @@ -226,7 +226,7 @@ static vector match_bot_commands(Slice str) { // '/(?])\/([a-zA-Z0-9_]{1,64})(?:@([a-zA-Z0-9_]{3,32}))?(?!\B|[\/<>])/u' while (true) { - ptr = reinterpret_cast(std::memchr(ptr, '/', narrow_cast(end - ptr))); + ptr = static_cast(std::memchr(ptr, '/', narrow_cast(end - ptr))); if (ptr == nullptr) { break; } @@ -302,7 +302,7 @@ static vector match_hashtags(Slice str) { UnicodeSimpleCategory category; while (true) { - ptr = reinterpret_cast(std::memchr(ptr, '#', narrow_cast(end - ptr))); + ptr = static_cast(std::memchr(ptr, '#', narrow_cast(end - ptr))); if (ptr == nullptr) { break; } @@ -363,7 +363,7 @@ static vector match_cashtags(Slice str) { UnicodeSimpleCategory category; while (true) { - ptr = reinterpret_cast(std::memchr(ptr, '$', narrow_cast(end - ptr))); + ptr = static_cast(std::memchr(ptr, '$', narrow_cast(end - ptr))); if (ptr == nullptr) { break; } diff --git a/tdtl/td/tl/tl_simple_parser.h b/tdtl/td/tl/tl_simple_parser.h index 9e612bf7..644fee09 100644 --- a/tdtl/td/tl/tl_simple_parser.h +++ b/tdtl/td/tl/tl_simple_parser.h @@ -68,7 +68,7 @@ class tl_simple_parser { std::int64_t fetch_long() { check_len(sizeof(std::int64_t)); std::int64_t result; - std::memcpy(reinterpret_cast(&result), data, sizeof(std::int64_t)); + std::memcpy(&result, data, sizeof(std::int64_t)); data += sizeof(std::int64_t); return result; } diff --git a/tdutils/td/utils/Parser.h b/tdutils/td/utils/Parser.h index e1e55b59..a78b05db 100644 --- a/tdutils/td/utils/Parser.h +++ b/tdutils/td/utils/Parser.h @@ -50,7 +50,7 @@ class Parser { if (status_.is_error()) { return MutableSlice(); } - char *till = reinterpret_cast(std::memchr(ptr_, c, end_ - ptr_)); + char *till = static_cast(std::memchr(ptr_, c, end_ - ptr_)); if (till == nullptr) { till = end_; } @@ -65,7 +65,7 @@ class Parser { } char *best_till = end_; for (auto c : str) { - char *till = reinterpret_cast(std::memchr(ptr_, c, end_ - ptr_)); + char *till = static_cast(std::memchr(ptr_, c, end_ - ptr_)); if (till != nullptr && till < best_till) { best_till = till; } diff --git a/tdutils/td/utils/tl_parsers.h b/tdutils/td/utils/tl_parsers.h index 3df28255..4eb52f70 100644 --- a/tdutils/td/utils/tl_parsers.h +++ b/tdutils/td/utils/tl_parsers.h @@ -51,7 +51,7 @@ class TlParser { data_buf = std::make_unique(1 + data_len / sizeof(int32)); buf = data_buf.get(); } - std::memcpy(static_cast(buf), static_cast(slice.begin()), slice.size()); + std::memcpy(buf, slice.begin(), slice.size()); data = reinterpret_cast(buf); } } @@ -89,7 +89,7 @@ class TlParser { int32 fetch_int_unsafe() { int32 result; - std::memcpy(reinterpret_cast(&result), data, sizeof(int32)); + std::memcpy(&result, data, sizeof(int32)); data += sizeof(int32); return result; } @@ -101,7 +101,7 @@ class TlParser { int64 fetch_long_unsafe() { int64 result; - std::memcpy(reinterpret_cast(&result), data, sizeof(int64)); + std::memcpy(&result, data, sizeof(int64)); data += sizeof(int64); return result; } @@ -113,7 +113,7 @@ class TlParser { double fetch_double_unsafe() { double result; - std::memcpy(reinterpret_cast(&result), data, sizeof(double)); + std::memcpy(&result, data, sizeof(double)); data += sizeof(double); return result; } @@ -126,7 +126,7 @@ class TlParser { template T fetch_binary_unsafe() { T result; - std::memcpy(reinterpret_cast(&result), data, sizeof(T)); + std::memcpy(&result, data, sizeof(T)); data += sizeof(T); return result; } diff --git a/tdutils/td/utils/tl_storers.h b/tdutils/td/utils/tl_storers.h index c00fcd1e..4f6cee12 100644 --- a/tdutils/td/utils/tl_storers.h +++ b/tdutils/td/utils/tl_storers.h @@ -31,7 +31,7 @@ class TlStorerUnsafe { template void store_binary(const T &x) { - std::memcpy(buf_, reinterpret_cast(&x), sizeof(T)); + std::memcpy(buf_, &x, sizeof(T)); buf_ += sizeof(T); }