0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-25 20:14:10 +08:00

Merge pull request #594 from SoapGentoo/Wuseless-cast

Fix `-Wuseless-cast`
This commit is contained in:
Arseny Kapoulkine 2023-11-14 07:13:09 -08:00 committed by GitHub
commit 43d7d568a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1574,8 +1574,8 @@ PUGI_IMPL_NS_BEGIN
static value_type high(value_type result, uint32_t ch)
{
uint32_t msh = static_cast<uint32_t>(ch - 0x10000) >> 10;
uint32_t lsh = static_cast<uint32_t>(ch - 0x10000) & 0x3ff;
uint32_t msh = (ch - 0x10000U) >> 10;
uint32_t lsh = (ch - 0x10000U) & 0x3ff;
result[0] = static_cast<uint16_t>(0xD800 + msh);
result[1] = static_cast<uint16_t>(0xDC00 + lsh);
@ -2455,7 +2455,7 @@ PUGI_IMPL_NS_BEGIN
{
// Move [old_gap_end, new_gap_start) to [old_gap_start, ...)
assert(s >= end);
memmove(end - size, end, reinterpret_cast<char*>(s) - reinterpret_cast<char*>(end));
memmove(end - size, end, (s - end) * sizeof(char_t));
}
s += count; // end of current gap
@ -2472,7 +2472,7 @@ PUGI_IMPL_NS_BEGIN
{
// Move [old_gap_end, current_pos) to [old_gap_start, ...)
assert(s >= end);
memmove(end - size, end, reinterpret_cast<char*>(s) - reinterpret_cast<char*>(end));
memmove(end - size, end, (s - end) * sizeof(char_t));
return s - size;
}
@ -5347,7 +5347,7 @@ namespace pugi
PUGI_IMPL_FN size_t xml_attribute::hash_value() const
{
return static_cast<size_t>(reinterpret_cast<uintptr_t>(_attr) / sizeof(xml_attribute_struct));
return reinterpret_cast<uintptr_t>(_attr) / sizeof(xml_attribute_struct);
}
PUGI_IMPL_FN xml_attribute_struct* xml_attribute::internal_object() const
@ -6531,7 +6531,7 @@ namespace pugi
PUGI_IMPL_FN size_t xml_node::hash_value() const
{
return static_cast<size_t>(reinterpret_cast<uintptr_t>(_root) / sizeof(xml_node_struct));
return reinterpret_cast<uintptr_t>(_root) / sizeof(xml_node_struct);
}
PUGI_IMPL_FN xml_node_struct* xml_node::internal_object() const
@ -6936,7 +6936,7 @@ namespace pugi
PUGI_IMPL_FN xml_node* xml_node_iterator::operator->() const
{
assert(_wrap._root);
return const_cast<xml_node*>(&_wrap); // BCC5 workaround
return &_wrap;
}
PUGI_IMPL_FN xml_node_iterator& xml_node_iterator::operator++()
@ -6997,7 +6997,7 @@ namespace pugi
PUGI_IMPL_FN xml_attribute* xml_attribute_iterator::operator->() const
{
assert(_wrap._attr);
return const_cast<xml_attribute*>(&_wrap); // BCC5 workaround
return &_wrap;
}
PUGI_IMPL_FN xml_attribute_iterator& xml_attribute_iterator::operator++()
@ -7058,7 +7058,7 @@ namespace pugi
PUGI_IMPL_FN xml_node* xml_named_node_iterator::operator->() const
{
assert(_wrap._root);
return const_cast<xml_node*>(&_wrap); // BCC5 workaround
return &_wrap;
}
PUGI_IMPL_FN xml_named_node_iterator& xml_named_node_iterator::operator++()