More strict aliasing

This commit is contained in:
Alexey Milovidov 2020-01-03 18:28:38 +03:00 committed by Amos Bird
parent 52153d15cc
commit c3e80485da
No known key found for this signature in database
GPG Key ID: 80D430DCBECFEDB4
5 changed files with 11 additions and 12 deletions

View File

@ -87,4 +87,3 @@ void Authentication::checkPassword(const String & password_, const String & user
}
}

View File

@ -115,7 +115,7 @@ StringRef ColumnNullable::serializeValueIntoArena(size_t n, Arena & arena, char
const char * ColumnNullable::deserializeAndInsertFromArena(const char * pos)
{
UInt8 val = *reinterpret_cast<const UInt8 *>(pos);
UInt8 val = unalignedLoad<UInt8>(pos);
pos += sizeof(val);
getNullMapData().push_back(val);

View File

@ -325,7 +325,7 @@ size_t ColumnUnique<ColumnType>::uniqueDeserializeAndInsertFromArena(const char
{
if (is_nullable)
{
UInt8 val = *reinterpret_cast<const UInt8 *>(pos);
UInt8 val = unalignedLoad<UInt8>(pos);
pos += sizeof(val);
if (val)

View File

@ -78,8 +78,8 @@ private:
#endif
public:
StringSearcher(const char * const needle_, const size_t needle_size_)
: needle{reinterpret_cast<const UInt8 *>(needle_)}, needle_size{needle_size_}
StringSearcher(const UInt8 * needle_, const size_t needle_size_)
: needle{needle_}, needle_size{needle_size_}
{
if (0 == needle_size)
return;
@ -348,8 +348,8 @@ private:
#endif
public:
StringSearcher(const char * const needle_, const size_t needle_size)
: needle{reinterpret_cast<const UInt8 *>(needle_)}, needle_end{needle + needle_size}
StringSearcher(const UInt8 * needle_, const size_t needle_size)
: needle{needle_}, needle_end{needle + needle_size}
{
if (0 == needle_size)
return;
@ -545,8 +545,8 @@ private:
#endif
public:
StringSearcher(const char * const needle_, const size_t needle_size)
: needle{reinterpret_cast<const UInt8 *>(needle_)}, needle_end{needle + needle_size}
StringSearcher(const UInt8 * needle_, const size_t needle_size)
: needle{needle_}, needle_end{needle + needle_size}
{
if (0 == needle_size)
return;
@ -713,11 +713,11 @@ class TokenSearcher
size_t needle_size;
public:
TokenSearcher(const char * const needle_, const size_t needle_size_)
TokenSearcher(const UInt8 * needle_, const size_t needle_size_)
: searcher{needle_, needle_size_},
needle_size(needle_size_)
{
if (std::any_of(reinterpret_cast<const UInt8 *>(needle_), reinterpret_cast<const UInt8 *>(needle_) + needle_size_, isTokenSeparator))
if (std::any_of(needle_, needle_ + needle_size_, isTokenSeparator))
{
throw Exception{"Needle must not contain whitespace or separator characters", ErrorCodes::BAD_ARGUMENTS};
}

View File

@ -526,7 +526,7 @@ void TrieDictionary::getItemsImpl(
if (addr.size != 16)
throw Exception("Expected key to be FixedString(16)", ErrorCodes::LOGICAL_ERROR);
uintptr_t slot = btrie_find_a6(trie, reinterpret_cast<const UInt8 *>(addr.data));
uintptr_t slot = btrie_find_a6(trie, reinterpret_cast<const uint8_t *>(addr.data));
#pragma GCC diagnostic push
#pragma GCC diagnostic warning "-Wold-style-cast"
set_value(i, slot != BTRIE_NULL ? static_cast<OutputType>(vec[slot]) : get_default(i));