clang-tidy: partially fix cppcoreguidelines-pro-type-reinterpret-cast

This commit is contained in:
Daniel Agar
2019-10-27 19:15:56 -04:00
parent f5945d1185
commit 4192414576
16 changed files with 26 additions and 26 deletions
+3 -3
View File
@@ -587,9 +587,9 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub)
}
for (size_t cur_mag = 0; cur_mag < orb_mag_count && cur_mag < max_mags; cur_mag++) {
worker_data.x[cur_mag] = reinterpret_cast<float *>(malloc(sizeof(float) * calibration_points_maxcount));
worker_data.y[cur_mag] = reinterpret_cast<float *>(malloc(sizeof(float) * calibration_points_maxcount));
worker_data.z[cur_mag] = reinterpret_cast<float *>(malloc(sizeof(float) * calibration_points_maxcount));
worker_data.x[cur_mag] = static_cast<float *>(malloc(sizeof(float) * calibration_points_maxcount));
worker_data.y[cur_mag] = static_cast<float *>(malloc(sizeof(float) * calibration_points_maxcount));
worker_data.z[cur_mag] = static_cast<float *>(malloc(sizeof(float) * calibration_points_maxcount));
if (worker_data.x[cur_mag] == nullptr || worker_data.y[cur_mag] == nullptr || worker_data.z[cur_mag] == nullptr) {
calibration_log_critical(mavlink_log_pub, "ERROR: out of memory");
+1 -1
View File
@@ -120,7 +120,7 @@ void SendEvent::initialize_trampoline(void *arg)
void SendEvent::cycle_trampoline(void *arg)
{
SendEvent *obj = reinterpret_cast<SendEvent *>(arg);
SendEvent *obj = static_cast<SendEvent *>(arg);
obj->cycle();
}
+2 -2
View File
@@ -190,7 +190,7 @@ void *LogWriterFile::run_helper(void *context)
{
px4_prctl(PR_SET_NAME, "log_writer_file", px4_getpid());
reinterpret_cast<LogWriterFile *>(context)->run();
static_cast<LogWriterFile *>(context)->run();
return nullptr;
}
@@ -407,7 +407,7 @@ void LogWriterFile::LogFileBuffer::write_no_check(void *ptr, size_t size)
{
size_t n = _buffer_size - _head; // bytes to end of the buffer
uint8_t *buffer_c = reinterpret_cast<uint8_t *>(ptr);
uint8_t *buffer_c = static_cast<uint8_t *>(ptr);
if (size > n) {
// Message goes over the end of the buffer