mirror of
https://github.com/tstack/lnav
synced 2024-11-03 23:15:38 +00:00
[coverity] next set of fixes
This commit is contained in:
parent
69e927e91b
commit
ecd3eb05bc
@ -177,7 +177,7 @@ public:
|
||||
|
||||
class db_overlay_source : public list_overlay_source {
|
||||
public:
|
||||
db_overlay_source() : dos_labels(NULL) { };
|
||||
db_overlay_source() : dos_labels(NULL), dos_hist_source(NULL) { };
|
||||
|
||||
size_t list_overlay_count(const listview_curses &lv)
|
||||
{
|
||||
|
@ -41,7 +41,9 @@ public:
|
||||
field_overlay_source(logfile_sub_source &lss)
|
||||
: fos_active(false),
|
||||
fos_active_prev(false),
|
||||
fos_log_helper(lss) {
|
||||
fos_log_helper(lss),
|
||||
fos_known_key_size(0),
|
||||
fos_unknown_key_size(0) {
|
||||
|
||||
};
|
||||
|
||||
|
@ -47,7 +47,8 @@ class grapher
|
||||
public:
|
||||
|
||||
grapher()
|
||||
: gr_highlighter(NULL)
|
||||
: gr_highlighter(NULL),
|
||||
gr_x(0)
|
||||
{
|
||||
this->set_label_source(&this->gr_label_source);
|
||||
};
|
||||
|
@ -48,7 +48,7 @@ using namespace std;
|
||||
|
||||
class sql_json_op : public json_op {
|
||||
public:
|
||||
sql_json_op(json_ptr &ptr) : json_op(ptr), sjo_type(-1) { };
|
||||
sql_json_op(json_ptr &ptr) : json_op(ptr), sjo_type(-1), sjo_int(0) { };
|
||||
|
||||
int sjo_type;
|
||||
string sjo_str;
|
||||
|
@ -173,9 +173,11 @@ throw (error)
|
||||
|
||||
log_perror(fcntl(gzfd, F_SETFD, FD_CLOEXEC));
|
||||
if (lseek(fd, 0, SEEK_SET) < 0) {
|
||||
close(gzfd);
|
||||
throw error(errno);
|
||||
}
|
||||
if ((this->lb_gz_file = gzdopen(gzfd, "r")) == NULL) {
|
||||
close(gzfd);
|
||||
if (errno == 0) {
|
||||
throw bad_alloc();
|
||||
}
|
||||
@ -355,13 +357,19 @@ throw (error)
|
||||
char scratch[32 * 1024];
|
||||
BZFILE * bz_file;
|
||||
off_t seek_to;
|
||||
int bzfd;
|
||||
|
||||
/*
|
||||
* Unfortunately, there is no bzseek, so we need to reopen the
|
||||
* file every time we want to do a read.
|
||||
*/
|
||||
lseek(this->lb_fd, 0, SEEK_SET);
|
||||
if ((bz_file = BZ2_bzdopen(dup(this->lb_fd), "r")) == NULL) {
|
||||
bzfd = dup(this->lb_fd);
|
||||
if (lseek(this->lb_fd, 0, SEEK_SET) < 0) {
|
||||
close(bzfd);
|
||||
throw error(errno);
|
||||
}
|
||||
if ((bz_file = BZ2_bzdopen(bzfd, "r")) == NULL) {
|
||||
close(bzfd);
|
||||
if (errno == 0) {
|
||||
throw bad_alloc();
|
||||
}
|
||||
|
@ -1470,7 +1470,13 @@ static string execute_action(log_data_helper &ldh,
|
||||
|
||||
class action_delegate : public text_delegate {
|
||||
public:
|
||||
action_delegate(logfile_sub_source &lss) : ad_log_helper(lss), ad_press_line(-1) { };
|
||||
action_delegate(logfile_sub_source &lss)
|
||||
: ad_log_helper(lss),
|
||||
ad_press_line(-1),
|
||||
ad_press_value(0),
|
||||
ad_line_index(0) {
|
||||
|
||||
};
|
||||
|
||||
virtual bool text_handle_mouse(textview_curses &tc, mouse_event &me) {
|
||||
bool retval = false;
|
||||
@ -2223,6 +2229,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
(void)signal(SIGPIPE, SIG_IGN);
|
||||
setlocale(LC_NUMERIC, "");
|
||||
umask(077);
|
||||
|
||||
lnav_data.ld_program_name = argv[0];
|
||||
|
||||
|
@ -58,7 +58,7 @@ string dotlnav_path(const char *sub)
|
||||
char * home;
|
||||
|
||||
home = getenv("HOME");
|
||||
if (home) {
|
||||
if (home && access(home, W_OK|X_OK) == 0) {
|
||||
char hpath[2048];
|
||||
|
||||
snprintf(hpath, sizeof(hpath), "%s/.lnav/%s", home, sub);
|
||||
|
@ -224,6 +224,7 @@ extern const char *std_time_fmt[];
|
||||
struct date_time_scanner {
|
||||
date_time_scanner() : dts_keep_base_tz(false),
|
||||
dts_local_time(false),
|
||||
dts_local_offset_cache(0),
|
||||
dts_local_offset_valid(0),
|
||||
dts_local_offset_expiry(0) {
|
||||
this->clear();
|
||||
|
@ -53,7 +53,8 @@ public:
|
||||
};
|
||||
|
||||
log_accel()
|
||||
: la_last_point_set(false),
|
||||
: la_last_point(0),
|
||||
la_last_point_set(false),
|
||||
la_min_velocity(INT64_MAX),
|
||||
la_max_velocity(INT64_MIN),
|
||||
la_velocity_size(0) {
|
||||
|
@ -48,7 +48,13 @@
|
||||
class log_data_helper
|
||||
{
|
||||
public:
|
||||
log_data_helper(logfile_sub_source &lss) : ldh_log_source(lss) { };
|
||||
log_data_helper(logfile_sub_source &lss)
|
||||
: ldh_log_source(lss),
|
||||
ldh_file(NULL),
|
||||
ldh_y_offset(0)
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
void clear() {
|
||||
this->ldh_file = NULL;
|
||||
|
@ -44,7 +44,10 @@ bookmark_type_t logfile_sub_source::BM_FILES("");
|
||||
|
||||
logfile_sub_source::logfile_sub_source()
|
||||
: lss_flags(0),
|
||||
lss_token_file(NULL),
|
||||
lss_token_date_end(0),
|
||||
lss_min_log_level(logline::LEVEL_UNKNOWN),
|
||||
lss_index_delegate(NULL),
|
||||
lss_longest_line(0)
|
||||
{
|
||||
this->clear_line_size_cache();
|
||||
@ -107,8 +110,6 @@ void logfile_sub_source::text_value_for_line(textview_curses &tc,
|
||||
line = this->at(vis_line_t(row));
|
||||
this->lss_token_file = this->find(line);
|
||||
this->lss_token_line = this->lss_token_file->begin() + line;
|
||||
this->lss_token_offset = 0;
|
||||
this->lss_scrub_len = 0;
|
||||
|
||||
if (raw) {
|
||||
this->lss_token_file->read_line(this->lss_token_line, value_out);
|
||||
|
@ -533,8 +533,6 @@ private:
|
||||
logfile * lss_token_file;
|
||||
std::string lss_token_value;
|
||||
shared_buffer lss_share_manager;
|
||||
int lss_scrub_len;
|
||||
int lss_token_offset;
|
||||
int lss_token_date_end;
|
||||
logfile::iterator lss_token_line;
|
||||
std::pair<int, size_t> lss_line_size_cache[LINE_SIZE_CACHE_SIZE];
|
||||
|
@ -46,7 +46,7 @@ struct shared_buffer_ref {
|
||||
public:
|
||||
shared_buffer_ref(char *data = NULL, size_t len = 0)
|
||||
: sb_owner(NULL), sb_data(data), sb_length(len) {
|
||||
|
||||
memset(&this->sb_link, 0, sizeof(this->sb_link));
|
||||
};
|
||||
|
||||
~shared_buffer_ref() {
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
*/
|
||||
guard_termios(const int fd) : gt_fd(fd)
|
||||
{
|
||||
memset(&this->gt_termios, 0, sizeof(this->gt_termios));
|
||||
if (isatty(this->gt_fd) &&
|
||||
tcgetattr(this->gt_fd, &this->gt_termios) == -1) {
|
||||
perror("tcgetattr");
|
||||
|
@ -66,7 +66,8 @@ textview_curses::textview_curses()
|
||||
tc_searching(false),
|
||||
tc_follow_search(false),
|
||||
tc_selection_start(-1),
|
||||
tc_selection_last(-1)
|
||||
tc_selection_last(-1),
|
||||
tc_selection_cleared(false)
|
||||
{
|
||||
this->set_data_source(this);
|
||||
}
|
||||
|
@ -717,9 +717,6 @@ protected:
|
||||
|
||||
vis_bookmarks tc_bookmarks;
|
||||
|
||||
vis_line_t tc_lview_top;
|
||||
int tc_lview_left;
|
||||
|
||||
bool tc_searching;
|
||||
bool tc_follow_search;
|
||||
action tc_search_action;
|
||||
|
@ -48,6 +48,7 @@ const struct itimerval ui_periodic_timer::INTERVAL = {
|
||||
};
|
||||
|
||||
ui_periodic_timer::ui_periodic_timer()
|
||||
: upt_counter(0)
|
||||
{
|
||||
struct sigaction sa;
|
||||
|
||||
|
@ -639,7 +639,12 @@ struct mouse_event {
|
||||
mouse_event(mouse_button_t button = BUTTON_LEFT,
|
||||
mouse_button_state_t state = BUTTON_STATE_PRESSED,
|
||||
int x = -1,
|
||||
int y = -1) : me_button(button), me_state(state), me_x(x), me_y(y) {
|
||||
int y = -1)
|
||||
: me_button(button),
|
||||
me_state(state),
|
||||
me_x(x),
|
||||
me_y(y) {
|
||||
memset(&this->me_time, 0, sizeof(this->me_time));
|
||||
};
|
||||
|
||||
mouse_button_t me_button;
|
||||
|
@ -145,7 +145,10 @@ class yajlpp_parse_context {
|
||||
public:
|
||||
yajlpp_parse_context(std::string source,
|
||||
struct json_path_handler *handlers = NULL)
|
||||
: ypc_source(source), ypc_handlers(handlers), ypc_ignore_unused(false)
|
||||
: ypc_source(source),
|
||||
ypc_handlers(handlers),
|
||||
ypc_userdata(NULL),
|
||||
ypc_ignore_unused(false)
|
||||
{
|
||||
this->ypc_path.reserve(4096);
|
||||
this->ypc_path.push_back('\0');
|
||||
|
Loading…
Reference in New Issue
Block a user