From b61bdeadea2a057708a10aba3cc05d0325edc219 Mon Sep 17 00:00:00 2001 From: Martin Idel Date: Mon, 5 Aug 2019 21:41:38 +0200 Subject: [PATCH] Change reinterpret casts to static casts The underlying data structure changed so we don't need the reinterpret casts anymore. Leaving the static_casts to make explicit what we expect at that point and force action if the model changes again on some update --- rviz_common/src/rviz_common/interaction/selection_manager.cpp | 4 ++-- .../src/rviz_common/interaction/selection_renderer.cpp | 2 +- rviz_common/src/rviz_common/interaction/view_picker.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rviz_common/src/rviz_common/interaction/selection_manager.cpp b/rviz_common/src/rviz_common/interaction/selection_manager.cpp index c63439ed5..82609c292 100644 --- a/rviz_common/src/rviz_common/interaction/selection_manager.cpp +++ b/rviz_common/src/rviz_common/interaction/selection_manager.cpp @@ -116,7 +116,7 @@ SelectionManager::~SelectionManager() delete highlight_rectangle_; for (auto & pixel_box : pixel_boxes_) { - delete[] reinterpret_cast(pixel_box.data); + delete[] static_cast(pixel_box.data); } delete property_model_; @@ -269,7 +269,7 @@ void SelectionManager::unpackColors(const Ogre::PixelBox & box) for (uint32_t x = 0; x < w; ++x) { uint32_t pos = (x + y * w) * 4; - uint32_t pix_val = *reinterpret_cast(reinterpret_cast(box.data) + pos); + uint32_t pix_val = *reinterpret_cast(static_cast(box.data) + pos); uint32_t handle = colorToHandle(box.format, pix_val); pixel_buffer_.push_back(handle); diff --git a/rviz_common/src/rviz_common/interaction/selection_renderer.cpp b/rviz_common/src/rviz_common/interaction/selection_renderer.cpp index 68cbaf0a6..a8c7fe3de 100644 --- a/rviz_common/src/rviz_common/interaction/selection_renderer.cpp +++ b/rviz_common/src/rviz_common/interaction/selection_renderer.cpp @@ -279,7 +279,7 @@ void SelectionRenderer::blitToMemory( auto size = Ogre::PixelUtil::getMemorySize(viewport_w, viewport_h, 1, format); auto data = new uint8_t[size]; - delete[] reinterpret_cast(dst_box.data); + delete[] static_cast(dst_box.data); dst_box = Ogre::PixelBox(viewport_w, viewport_h, 1, format, data); pixel_buffer->blitToMemory(dst_box, dst_box); diff --git a/rviz_common/src/rviz_common/interaction/view_picker.cpp b/rviz_common/src/rviz_common/interaction/view_picker.cpp index 569050baf..3aef340fa 100644 --- a/rviz_common/src/rviz_common/interaction/view_picker.cpp +++ b/rviz_common/src/rviz_common/interaction/view_picker.cpp @@ -72,7 +72,7 @@ ViewPicker::ViewPicker(DisplayContext * context) ViewPicker::~ViewPicker() { - delete[] reinterpret_cast(depth_pixel_box_.data); + delete[] static_cast(depth_pixel_box_.data); } void ViewPicker::initialize() @@ -168,7 +168,7 @@ void ViewPicker::getPatchDepthImage( depth_render_texture_, Dimensions(depth_texture_width_, depth_texture_height_), "Depth"), depth_pixel_box_); - auto data_ptr = reinterpret_cast(depth_pixel_box_.data); + auto data_ptr = static_cast(depth_pixel_box_.data); for (uint32_t pixel = 0; pixel < num_pixels; ++pixel) { uint8_t a = data_ptr[4 * pixel];