Skip to content

Commit

Permalink
Fixing failing tests on rmw_fastrtps_dynamic_cpp. (#242)
Browse files Browse the repository at this point in the history
* Fixing failing tests on rmw_fastrtps_dynamic_cpp.

* linters
  • Loading branch information
MiguelCompany authored and dirk-thomas committed Nov 27, 2018
1 parent f6cb095 commit dddbb04
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,13 @@ inline void deserialize_field<std::string>(
}
deser >> *static_cast<std::string *>(field);
} else if (member->array_size_ && !member->is_upper_bound_) {
deser.deserializeArray(static_cast<std::string *>(field), member->array_size_);
std::string * array = static_cast<std::string *>(field);
if (call_new) {
for (size_t i = 0; i < member->array_size_; ++i) {
new(&array[i]) std::string();
}
}
deser.deserializeArray(array, member->array_size_);
} else {
auto & vector = *reinterpret_cast<std::vector<std::string> *>(field);
if (call_new) {
Expand Down
3 changes: 2 additions & 1 deletion rmw_fastrtps_dynamic_cpp/src/rmw_serialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ rmw_serialize(
}
}

eprosima::fastcdr::FastBuffer buffer(reinterpret_cast<char *>(serialized_message->buffer), data_length);
eprosima::fastcdr::FastBuffer buffer(reinterpret_cast<char *>(serialized_message->buffer),
data_length);
eprosima::fastcdr::Cdr ser(
buffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR);

Expand Down

0 comments on commit dddbb04

Please sign in to comment.