Skip to content

Commit

Permalink
Fix cpplint errors (#363)
Browse files Browse the repository at this point in the history
* Use static_cast instead of C-style cast

Fixes cpplint errors.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>

* Add missing include

Fixes a cpplint error.

Relates to ament/ament_lint#324

Signed-off-by: Jacob Perron <jacob@openrobotics.org>

* Include missing rmw header

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
  • Loading branch information
jacobperron authored Jan 12, 2022
1 parent cb129b5 commit 559ee67
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions rmw_cyclonedds_cpp/src/TypeSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "TypeSupport.hpp"

#include "rosidl_runtime_c/string.h"
#include "rosidl_typesupport_introspection_cpp/identifier.hpp"
#include "rosidl_typesupport_introspection_cpp/message_introspection.hpp"
Expand Down
1 change: 1 addition & 0 deletions rmw_cyclonedds_cpp/src/TypeSupport_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "TypeSupport.hpp"
#include "macros.hpp"
#include "rmw/error_handling.h"
#include "rosidl_typesupport_introspection_cpp/field_types.hpp"
#include "rosidl_typesupport_introspection_cpp/message_introspection.hpp"
#include "rosidl_typesupport_introspection_cpp/service_introspection.hpp"
Expand Down
6 changes: 3 additions & 3 deletions rmw_cyclonedds_cpp/src/rmw_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3853,15 +3853,15 @@ static rmw_ret_t get_matched_endpoints(
if ((ret = fn(h, res.data(), res.size())) < 0) {
return RMW_RET_ERROR;
}
while ((size_t) ret >= res.size()) {
while (static_cast<size_t>(ret) >= res.size()) {
// 128 is a completely arbitrary margin to reduce the risk of having to retry
// when matches are create/deleted in parallel
res.resize((size_t) ret + 128);
res.resize(static_cast<size_t>(ret) + 128);
if ((ret = fn(h, res.data(), res.size())) < 0) {
return RMW_RET_ERROR;
}
}
res.resize((size_t) ret);
res.resize(static_cast<size_t>(ret));
return RMW_RET_OK;
}

Expand Down
6 changes: 3 additions & 3 deletions rmw_cyclonedds_cpp/src/serdes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,9 @@ class cycprint : cycdeserbase
if (n < 0) {
**buf = 0;
return false;
} else if ((size_t) n <= *bufsize) {
*buf += (size_t) n;
*bufsize -= (size_t) n;
} else if (static_cast<size_t>(n) <= *bufsize) {
*buf += static_cast<size_t>(n);
*bufsize -= static_cast<size_t>(n);
return *bufsize > 0;
} else {
*buf += *bufsize;
Expand Down

0 comments on commit 559ee67

Please sign in to comment.