Skip to content

Commit

Permalink
Merge pull request #594 from SoapGentoo/Wuseless-cast
Browse files Browse the repository at this point in the history
Fix `-Wuseless-cast`
  • Loading branch information
zeux committed Nov 14, 2023
2 parents 6909df2 + 44236fe commit 43d7d56
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/pugixml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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++()
Expand Down Expand Up @@ -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++()
Expand Down Expand Up @@ -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++()
Expand Down

0 comments on commit 43d7d56

Please sign in to comment.