mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-24 15:00:35 +08:00
clang-tidy: partially fix cppcoreguidelines-pro-type-reinterpret-cast
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user