Skip to content

Commit

Permalink
Convert pointer to size_t
Browse files Browse the repository at this point in the history
  • Loading branch information
sonndinh committed Jul 31, 2024
1 parent 5739777 commit fb02550
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions dds/DCPS/Serializer.inl
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ bool Serializer::align_r(size_t al)
}
al = (std::min)(al, encoding().max_align());
const size_t len =
(al - static_cast<size_t>(current_->rd_ptr()) + align_rshift_) % al;
(al - reinterpret_cast<size_t>(current_->rd_ptr()) + align_rshift_) % al;

return skip(static_cast<ACE_CDR::UShort>(len));
}
Expand All @@ -800,7 +800,7 @@ bool Serializer::align_w(size_t al)
}
al = (std::min)(al, encoding().max_align());
size_t len =
(al - static_cast<size_t>(current_->wr_ptr()) + align_wshift_) % al;
(al - reinterpret_cast<size_t>(current_->wr_ptr()) + align_wshift_) % al;
while (len) {
if (!current_) {
good_bit_ = false;
Expand Down Expand Up @@ -830,15 +830,15 @@ bool Serializer::align_w(size_t al)
ACE_INLINE unsigned char
Serializer::offset(char* index, size_t start, size_t align)
{
return static_cast<unsigned char>((ptrdiff_t(index) - start) % align);
return static_cast<unsigned char>((reinterpret_cast<size_t>(index) - start) % align);
}

ACE_INLINE void
Serializer::align_cont_r()
{
const size_t max_align = encoding().max_align();
const size_t thisblock =
max_align ? (ptrdiff_t(current_->rd_ptr()) - align_rshift_) % max_align : 0;
max_align ? (reinterpret_cast<size_t>(current_->rd_ptr()) - align_rshift_) % max_align : 0;

current_ = current_->cont();

Expand All @@ -852,7 +852,7 @@ Serializer::align_cont_w()
{
const size_t max_align = encoding().max_align();
const size_t thisblock =
max_align ? (ptrdiff_t(current_->wr_ptr()) - align_wshift_) % max_align : 0;
max_align ? (reinterpret_cast<size_t>(current_->wr_ptr()) - align_wshift_) % max_align : 0;

current_ = current_->cont();

Expand Down

0 comments on commit fb02550

Please sign in to comment.