From 0c30d52ca2981b3a3d3d70823848fc7f31bd35e3 Mon Sep 17 00:00:00 2001 From: Suresh Sundriyal Date: Sat, 28 Mar 2015 13:46:42 -0700 Subject: [PATCH 1/2] [Coverity] Remove dead code. Given the fact that rem += SECSPERDAY is executed only when rem < 0, it won't be possible for the condition 'rem >= SECSPERDAY' to be true. --- src/lnav_util.cc | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/lnav_util.cc b/src/lnav_util.cc index 9621ba8c..1d40184a 100644 --- a/src/lnav_util.cc +++ b/src/lnav_util.cc @@ -264,11 +264,6 @@ struct tm *secs2tm(time_t *tim_p, struct tm *res) rem += SECSPERDAY; --days; } - while (rem >= SECSPERDAY) - { - rem -= SECSPERDAY; - ++days; - } /* compute hour, min, and sec */ res->tm_hour = (int) (rem / SECSPERHOUR); @@ -552,4 +547,4 @@ string build_path(const vector &paths) } retval += ":" + string(getenv("PATH")); return retval; -} \ No newline at end of file +} From 6a2c28450ec2dbb98134022ded905cff417bc085 Mon Sep 17 00:00:00 2001 From: Suresh Sundriyal Date: Sat, 28 Mar 2015 14:46:10 -0700 Subject: [PATCH 2/2] [Coverity] Initialize class variables. --- src/log_format.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/log_format.cc b/src/log_format.cc index ed37d718..156558c6 100644 --- a/src/log_format.cc +++ b/src/log_format.cc @@ -308,7 +308,9 @@ void log_format::check_for_new_year(std::vector &dst, */ struct json_log_userdata { json_log_userdata(shared_buffer_ref &sbr) - : jlu_sub_line_count(1), jlu_shared_buffer(sbr) { + : jlu_format(NULL), jlu_line(NULL), jlu_base_line(NULL), + jlu_sub_line_count(1), jlu_handle(NULL), jlu_line_value(NULL), + jlu_line_size(0), jlu_sub_start(0), jlu_shared_buffer(sbr) { };