Skip to content

Commit

Permalink
cherry-pick ros2#550
Browse files Browse the repository at this point in the history
Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>
  • Loading branch information
alsora committed Jun 30, 2022
1 parent e486ede commit f2d26b2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rmw_fastrtps_cpp/src/type_support_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ void TypeSupport::set_members(const message_type_support_callbacks_t * members)

// Total size is encapsulation size + data size
m_typeSize = 4 + data_size;
// Account for RTPS submessage alignment
m_typeSize = (m_typeSize + 3) & ~3;
}

size_t TypeSupport::getEstimatedSerializedSize(const void * ros_message, const void * impl) const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ MessageTypeSupport<MembersType>::MessageTypeSupport(
} else {
this->m_typeSize++;
}
// Account for RTPS submessage alignment
this->m_typeSize = (this->m_typeSize + 3) & ~3;
}

} // namespace rmw_fastrtps_dynamic_cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ RequestTypeSupport<ServiceMembersType, MessageMembersType>::RequestTypeSupport(
} else {
this->m_typeSize++;
}
// Account for RTPS submessage alignment
this->m_typeSize = (this->m_typeSize + 3) & ~3;
}

template<typename ServiceMembersType, typename MessageMembersType>
Expand Down Expand Up @@ -90,6 +92,8 @@ ResponseTypeSupport<ServiceMembersType, MessageMembersType>::ResponseTypeSupport
} else {
this->m_typeSize++;
}
// Account for RTPS submessage alignment
this->m_typeSize = (this->m_typeSize + 3) & ~3;
}

} // namespace rmw_fastrtps_dynamic_cpp
Expand Down

0 comments on commit f2d26b2

Please sign in to comment.