Remove unneeded reinterpret casts.
GitOrigin-RevId: 54a161ad11e5909f9c06912cf67e6805279f2327
This commit is contained in:
parent
b676fe509a
commit
22eb4e1cb2
@ -182,7 +182,7 @@ static vector<Slice> match_mentions(Slice str) {
|
||||
// '/(?<=\B)@([a-zA-Z0-9_]{2,32})(?=\b)/u'
|
||||
|
||||
while (true) {
|
||||
ptr = reinterpret_cast<const unsigned char *>(std::memchr(ptr, '@', narrow_cast<int32>(end - ptr)));
|
||||
ptr = static_cast<const unsigned char *>(std::memchr(ptr, '@', narrow_cast<int32>(end - ptr)));
|
||||
if (ptr == nullptr) {
|
||||
break;
|
||||
}
|
||||
@ -226,7 +226,7 @@ static vector<Slice> match_bot_commands(Slice str) {
|
||||
// '/(?<!\b|[\/<>])\/([a-zA-Z0-9_]{1,64})(?:@([a-zA-Z0-9_]{3,32}))?(?!\B|[\/<>])/u'
|
||||
|
||||
while (true) {
|
||||
ptr = reinterpret_cast<const unsigned char *>(std::memchr(ptr, '/', narrow_cast<int32>(end - ptr)));
|
||||
ptr = static_cast<const unsigned char *>(std::memchr(ptr, '/', narrow_cast<int32>(end - ptr)));
|
||||
if (ptr == nullptr) {
|
||||
break;
|
||||
}
|
||||
@ -302,7 +302,7 @@ static vector<Slice> match_hashtags(Slice str) {
|
||||
UnicodeSimpleCategory category;
|
||||
|
||||
while (true) {
|
||||
ptr = reinterpret_cast<const unsigned char *>(std::memchr(ptr, '#', narrow_cast<int32>(end - ptr)));
|
||||
ptr = static_cast<const unsigned char *>(std::memchr(ptr, '#', narrow_cast<int32>(end - ptr)));
|
||||
if (ptr == nullptr) {
|
||||
break;
|
||||
}
|
||||
@ -363,7 +363,7 @@ static vector<Slice> match_cashtags(Slice str) {
|
||||
|
||||
UnicodeSimpleCategory category;
|
||||
while (true) {
|
||||
ptr = reinterpret_cast<const unsigned char *>(std::memchr(ptr, '$', narrow_cast<int32>(end - ptr)));
|
||||
ptr = static_cast<const unsigned char *>(std::memchr(ptr, '$', narrow_cast<int32>(end - ptr)));
|
||||
if (ptr == nullptr) {
|
||||
break;
|
||||
}
|
||||
|
@ -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<char *>(&result), data, sizeof(std::int64_t));
|
||||
std::memcpy(&result, data, sizeof(std::int64_t));
|
||||
data += sizeof(std::int64_t);
|
||||
return result;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ class Parser {
|
||||
if (status_.is_error()) {
|
||||
return MutableSlice();
|
||||
}
|
||||
char *till = reinterpret_cast<char *>(std::memchr(ptr_, c, end_ - ptr_));
|
||||
char *till = static_cast<char *>(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<char *>(std::memchr(ptr_, c, end_ - ptr_));
|
||||
char *till = static_cast<char *>(std::memchr(ptr_, c, end_ - ptr_));
|
||||
if (till != nullptr && till < best_till) {
|
||||
best_till = till;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class TlParser {
|
||||
data_buf = std::make_unique<int32[]>(1 + data_len / sizeof(int32));
|
||||
buf = data_buf.get();
|
||||
}
|
||||
std::memcpy(static_cast<void *>(buf), static_cast<const void *>(slice.begin()), slice.size());
|
||||
std::memcpy(buf, slice.begin(), slice.size());
|
||||
data = reinterpret_cast<unsigned char *>(buf);
|
||||
}
|
||||
}
|
||||
@ -89,7 +89,7 @@ class TlParser {
|
||||
|
||||
int32 fetch_int_unsafe() {
|
||||
int32 result;
|
||||
std::memcpy(reinterpret_cast<unsigned char *>(&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<unsigned char *>(&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<unsigned char *>(&result), data, sizeof(double));
|
||||
std::memcpy(&result, data, sizeof(double));
|
||||
data += sizeof(double);
|
||||
return result;
|
||||
}
|
||||
@ -126,7 +126,7 @@ class TlParser {
|
||||
template <class T>
|
||||
T fetch_binary_unsafe() {
|
||||
T result;
|
||||
std::memcpy(reinterpret_cast<unsigned char *>(&result), data, sizeof(T));
|
||||
std::memcpy(&result, data, sizeof(T));
|
||||
data += sizeof(T);
|
||||
return result;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ class TlStorerUnsafe {
|
||||
|
||||
template <class T>
|
||||
void store_binary(const T &x) {
|
||||
std::memcpy(buf_, reinterpret_cast<const unsigned char *>(&x), sizeof(T));
|
||||
std::memcpy(buf_, &x, sizeof(T));
|
||||
buf_ += sizeof(T);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user