[coverity] a couple of fixes

This commit is contained in:
Timothy Stack 2014-11-03 20:24:46 -08:00
parent 45f18bd89c
commit 0d6f067aab
4 changed files with 13 additions and 3 deletions

View File

@ -211,7 +211,7 @@ public:
{
status_field &sf = this->bss_fields[BSF_LOADING];
if ((size_t)off == total) {
if (total == 0 || (size_t)off == total) {
sf.set_role(view_colors::VCR_STATUS);
sf.clear();
}

View File

@ -366,7 +366,8 @@ public:
logfile_data(size_t index, filter_stack &fs, logfile *lf)
: ld_file_index(index),
ld_filter_state(fs, lf),
ld_lines_indexed(0) {
ld_lines_indexed(0),
ld_enabled(true) {
lf->set_logline_observer(&this->ld_filter_state);
};
@ -375,6 +376,10 @@ public:
this->ld_filter_state.lfo_filter_state.clear();
};
void set_enabled(bool enabled) {
this->ld_enabled = enabled;
}
void set_file(logfile *lf) {
this->ld_filter_state.lfo_filter_state.tfs_logfile = lf;
lf->set_logline_observer(&this->ld_filter_state);
@ -389,6 +394,7 @@ public:
content_line_t ld_start;
content_line_t ld_last;
} ld_indexing;
bool ld_enabled;
};
typedef std::vector<logfile_data *>::iterator iterator;

View File

@ -79,6 +79,10 @@ static void sql_gethostbyname(sqlite3_context *context,
case AF_INET6:
addr_ptr = &((struct sockaddr_in6 *)ai->ai_addr)->sin6_addr;
break;
default:
sqlite3_result_error(context, "unknown address family", -1);
return;
}
inet_ntop(ai->ai_family, addr_ptr, buffer, sizeof(buffer));

View File

@ -798,7 +798,7 @@ void load_session(void)
}
else {
unsigned char buffer[1024];
size_t rc;
ssize_t rc;
log_info("loading session file: %s", view_info_name.c_str());
while ((rc = read(fd, buffer, sizeof(buffer))) > 0) {