mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-10 08:21:35 +08:00
logger coverity fix 143427
This commit is contained in:
committed by
Nuno Marques
parent
91cda08081
commit
086ddf5078
@@ -1191,7 +1191,7 @@ bool Logger::file_exist(const char *filename)
|
||||
|
||||
int Logger::get_log_file_name(char *file_name, size_t file_name_size)
|
||||
{
|
||||
tm tt;
|
||||
tm tt = {};
|
||||
bool time_ok = false;
|
||||
|
||||
if (_log_name_timestamp) {
|
||||
@@ -1280,7 +1280,7 @@ bool Logger::get_log_time(struct tm *tt, bool boot_time)
|
||||
|
||||
if (use_clock_time) {
|
||||
/* take clock time if there's no fix (yet) */
|
||||
struct timespec ts;
|
||||
struct timespec ts = {};
|
||||
px4_clock_gettime(CLOCK_REALTIME, &ts);
|
||||
utc_time_sec = ts.tv_sec + (ts.tv_nsec / 1e9);
|
||||
|
||||
@@ -1417,7 +1417,7 @@ void Logger::perf_iterate_callback(perf_counter_t handle, void *user)
|
||||
|
||||
void Logger::write_perf_data(bool preflight)
|
||||
{
|
||||
perf_callback_data_t callback_data;
|
||||
perf_callback_data_t callback_data = {};
|
||||
callback_data.logger = this;
|
||||
callback_data.counter = 0;
|
||||
callback_data.preflight = preflight;
|
||||
@@ -1463,7 +1463,7 @@ void Logger::initialize_load_output()
|
||||
|
||||
void Logger::write_load_output(bool preflight)
|
||||
{
|
||||
perf_callback_data_t callback_data;
|
||||
perf_callback_data_t callback_data = {};
|
||||
char buffer[140];
|
||||
callback_data.logger = this;
|
||||
callback_data.counter = 0;
|
||||
@@ -1480,7 +1480,7 @@ void Logger::write_load_output(bool preflight)
|
||||
void Logger::write_formats()
|
||||
{
|
||||
_writer.lock();
|
||||
ulog_message_format_s msg;
|
||||
ulog_message_format_s msg = {};
|
||||
const orb_metadata **topics = orb_get_topics();
|
||||
|
||||
//write all known formats
|
||||
@@ -1538,7 +1538,7 @@ void Logger::write_add_logged_msg(LoggerSubscription &subscription, int instance
|
||||
void Logger::write_info(const char *name, const char *value)
|
||||
{
|
||||
_writer.lock();
|
||||
ulog_message_info_header_s msg;
|
||||
ulog_message_info_header_s msg = {};
|
||||
uint8_t *buffer = reinterpret_cast<uint8_t *>(&msg);
|
||||
msg.msg_type = static_cast<uint8_t>(ULogMessageType::INFO);
|
||||
|
||||
@@ -1601,7 +1601,7 @@ template<typename T>
|
||||
void Logger::write_info_template(const char *name, T value, const char *type_str)
|
||||
{
|
||||
_writer.lock();
|
||||
ulog_message_info_header_s msg;
|
||||
ulog_message_info_header_s msg = {};
|
||||
uint8_t *buffer = reinterpret_cast<uint8_t *>(&msg);
|
||||
msg.msg_type = static_cast<uint8_t>(ULogMessageType::INFO);
|
||||
|
||||
@@ -1622,7 +1622,7 @@ void Logger::write_info_template(const char *name, T value, const char *type_str
|
||||
|
||||
void Logger::write_header()
|
||||
{
|
||||
ulog_file_header_s header;
|
||||
ulog_file_header_s header = {};
|
||||
header.magic[0] = 'U';
|
||||
header.magic[1] = 'L';
|
||||
header.magic[2] = 'o';
|
||||
@@ -1711,7 +1711,7 @@ void Logger::write_version()
|
||||
void Logger::write_parameters()
|
||||
{
|
||||
_writer.lock();
|
||||
ulog_message_parameter_header_s msg;
|
||||
ulog_message_parameter_header_s msg = {};
|
||||
uint8_t *buffer = reinterpret_cast<uint8_t *>(&msg);
|
||||
|
||||
msg.msg_type = static_cast<uint8_t>(ULogMessageType::PARAMETER);
|
||||
@@ -1768,7 +1768,7 @@ void Logger::write_parameters()
|
||||
void Logger::write_changed_parameters()
|
||||
{
|
||||
_writer.lock();
|
||||
ulog_message_parameter_header_s msg;
|
||||
ulog_message_parameter_header_s msg = {};
|
||||
uint8_t *buffer = reinterpret_cast<uint8_t *>(&msg);
|
||||
|
||||
msg.msg_type = static_cast<uint8_t>(ULogMessageType::PARAMETER);
|
||||
@@ -2028,5 +2028,5 @@ void Logger::ack_vehicle_command(orb_advert_t &vehicle_command_ack_pub, vehicle_
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace logger
|
||||
} // namespace px4
|
||||
|
||||
Reference in New Issue
Block a user