Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelarguedas committed Jun 22, 2018
1 parent 3d621fd commit f16af60
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions rmw_opensplice_cpp/src/rmw_service_names_and_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,15 @@ rmw_get_service_names_and_types(
for (const auto & type : service_n_types.second) {
size_t n = type.find(SAMPLE_PREFIX);
std::string stripped_type = type;
if (n < type.size() - strlen(SAMPLE_PREFIX)) {
stripped_type = std::string(type.substr(0, n + 1).c_str()) + \
std::string(type.substr(n + strlen(SAMPLE_PREFIX)).c_str());
if (std::string::npos != n) {
stripped_type = type.substr(0, n + 1) + type.substr(n + strlen(SAMPLE_PREFIX));
} else {
RMW_SET_ERROR_MSG_ALLOC(
"failed to convert DDS type name to ROS service type name: '"
SAMPLE_PREFIX "' not found",
*allocator)
fail_cleanup();
return RMW_RET_ERROR;
}
char * type_name = rcutils_strdup(stripped_type.c_str(), *allocator);
if (!type_name) {
Expand Down

0 comments on commit f16af60

Please sign in to comment.