Merge pull request #508 from phord/cleanup-warnings

Cleanup warnings
pull/509/head
Tim Stack 7 years ago committed by GitHub
commit 6e0bb175e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -144,6 +144,7 @@ LNAV_WITH_SQLITE3("3.9.0")
case "$host_os" in case "$host_os" in
*) *)
# AC_DEFINE([_XOPEN_SOURCE], [500], [Need pread]) # AC_DEFINE([_XOPEN_SOURCE], [500], [Need pread])
AC_DEFINE([_DEFAULT_SOURCE], [1], [Need pread])
AC_DEFINE([_BSD_SOURCE], [1], [Need pread]) AC_DEFINE([_BSD_SOURCE], [1], [Need pread])
;; ;;
esac esac

@ -120,7 +120,7 @@ void format_help_text_for_term(const help_text &ht, int width, attr_line_t &out)
.append(ht.ht_name, &view_curses::VC_STYLE, A_BOLD); .append(ht.ht_name, &view_curses::VC_STYLE, A_BOLD);
for (auto &param : ht.ht_parameters) { for (auto &param : ht.ht_parameters) {
if (break_all || if (break_all ||
(out.get_string().length() - start_index - line_start + 10) >= (int)(out.get_string().length() - start_index - line_start + 10) >=
tws.tws_width) { tws.tws_width) {
out.append("\n"); out.append("\n");
line_start = out.get_string().length(); line_start = out.get_string().length();

@ -310,7 +310,7 @@ public:
if (this->sbc_ident_to_show < -1) { if (this->sbc_ident_to_show < -1) {
this->sbc_ident_to_show = this->sbc_idents.size() - 1; this->sbc_ident_to_show = this->sbc_idents.size() - 1;
} }
else if (this->sbc_ident_to_show >= this->sbc_idents.size()) { else if (this->sbc_ident_to_show >= (int)this->sbc_idents.size()) {
this->sbc_ident_to_show = -1; this->sbc_ident_to_show = -1;
} }
return this->sbc_ident_to_show; return this->sbc_ident_to_show;

@ -139,7 +139,6 @@ line_buffer::~line_buffer()
} }
void line_buffer::set_fd(auto_fd &fd) void line_buffer::set_fd(auto_fd &fd)
throw (error)
{ {
off_t newoff = 0; off_t newoff = 0;
@ -220,12 +219,11 @@ throw (error)
} }
void line_buffer::resize_buffer(size_t new_max) void line_buffer::resize_buffer(size_t new_max)
throw (error)
{ {
require(this->lb_bz_file || this->lb_gz_file || require(this->lb_bz_file || this->lb_gz_file ||
new_max <= MAX_LINE_BUFFER_SIZE); new_max <= MAX_LINE_BUFFER_SIZE);
if (new_max > this->lb_buffer_max) { if (new_max > (size_t)this->lb_buffer_max) {
char *tmp, *old; char *tmp, *old;
/* Still need more space, try a realloc. */ /* Still need more space, try a realloc. */
@ -244,14 +242,13 @@ throw (error)
} }
void line_buffer::ensure_available(off_t start, size_t max_length) void line_buffer::ensure_available(off_t start, size_t max_length)
throw (error)
{ {
size_t prefill, available; size_t prefill, available;
require(max_length <= MAX_LINE_BUFFER_SIZE); require(max_length <= MAX_LINE_BUFFER_SIZE);
if (this->lb_file_size != -1) { if (this->lb_file_size != -1) {
if (start + max_length > this->lb_file_size) { if (start + (off_t)max_length > this->lb_file_size) {
max_length = (this->lb_file_size - start); max_length = (this->lb_file_size - start);
} }
} }
@ -317,7 +314,6 @@ throw (error)
} }
bool line_buffer::fill_range(off_t start, size_t max_length) bool line_buffer::fill_range(off_t start, size_t max_length)
throw (error)
{ {
bool retval = false; bool retval = false;
@ -484,7 +480,6 @@ throw (error)
} }
bool line_buffer::read_line(off_t &offset, line_value &lv, bool include_delim) bool line_buffer::read_line(off_t &offset, line_value &lv, bool include_delim)
throw (error)
{ {
size_t request_size = DEFAULT_INCREMENT; size_t request_size = DEFAULT_INCREMENT;
bool retval = false; bool retval = false;
@ -592,7 +587,6 @@ throw (error)
} }
bool line_buffer::read_line(off_t &offset_inout, shared_buffer_ref &sbr, line_value *lv) bool line_buffer::read_line(off_t &offset_inout, shared_buffer_ref &sbr, line_value *lv)
throw (error)
{ {
line_value lv_tmp; line_value lv_tmp;
bool retval; bool retval;
@ -612,7 +606,6 @@ bool line_buffer::read_line(off_t &offset_inout, shared_buffer_ref &sbr, line_va
} }
bool line_buffer::read_range(off_t offset, size_t len, shared_buffer_ref &sbr) bool line_buffer::read_range(off_t offset, size_t len, shared_buffer_ref &sbr)
throw (error)
{ {
char *line_start; char *line_start;
size_t avail; size_t avail;
@ -636,7 +629,7 @@ bool line_buffer::read_range(off_t offset, size_t len, shared_buffer_ref &sbr)
return true; return true;
} }
void line_buffer::read_available(shared_buffer_ref &sbr) throw(error) void line_buffer::read_available(shared_buffer_ref &sbr)
{ {
sbr.disown(); sbr.disown();

@ -82,7 +82,7 @@ public:
virtual ~line_buffer(); virtual ~line_buffer();
/** @param fd The file descriptor that data should be pulled from. */ /** @param fd The file descriptor that data should be pulled from. */
void set_fd(auto_fd &fd) throw (error); void set_fd(auto_fd &fd);
/** @return The file descriptor that data should be pulled from. */ /** @return The file descriptor that data should be pulled from. */
int get_fd() const { return this->lb_fd; }; int get_fd() const { return this->lb_fd; };
@ -140,16 +140,13 @@ public:
* line to refresh the buffer. * line to refresh the buffer.
*/ */
bool read_line(off_t &offset_inout, line_value &lv, bool read_line(off_t &offset_inout, line_value &lv,
bool include_delim = false) bool include_delim = false);
throw (error);
bool read_line(off_t &offset_inout, shared_buffer_ref &sbr, line_value *lv = NULL) bool read_line(off_t &offset_inout, shared_buffer_ref &sbr, line_value *lv = NULL);
throw (error);
bool read_range(off_t offset, size_t len, shared_buffer_ref &sbr) bool read_range(off_t offset, size_t len, shared_buffer_ref &sbr);
throw (error);
void read_available(shared_buffer_ref &sbr) throw(error); void read_available(shared_buffer_ref &sbr);
void clear() void clear()
{ {
@ -188,7 +185,7 @@ private:
off < (int)(this->lb_file_offset + this->lb_buffer_size); off < (int)(this->lb_file_offset + this->lb_buffer_size);
}; };
void resize_buffer(size_t new_max) throw (error); void resize_buffer(size_t new_max);
/** /**
* Ensure there is enough room in the buffer to cache a range of data from * Ensure there is enough room in the buffer to cache a range of data from
@ -202,7 +199,7 @@ private:
* @param start The file offset of the start of the line. * @param start The file offset of the start of the line.
* @param max_length The amount of data to be cached in the buffer. * @param max_length The amount of data to be cached in the buffer.
*/ */
void ensure_available(off_t start, size_t max_length) throw (error); void ensure_available(off_t start, size_t max_length);
/** /**
* Fill the buffer with the given range of data from the file. * Fill the buffer with the given range of data from the file.
@ -212,7 +209,7 @@ private:
* @param max_length The maximum amount of data to read from the file. * @param max_length The maximum amount of data to read from the file.
* @return True if any data was read from the file. * @return True if any data was read from the file.
*/ */
bool fill_range(off_t start, size_t max_length) throw (error); bool fill_range(off_t start, size_t max_length);
/** /**
* After a successful fill, the cached data can be retrieved with this * After a successful fill, the cached data can be retrieved with this

@ -2011,7 +2011,7 @@ static void execute_examples()
al); al);
ex.he_result.append(al); ex.he_result.append(al);
for (int lpc = 0; for (int lpc = 0;
lpc < dls.text_line_count(); lpc++) { lpc < (int)dls.text_line_count(); lpc++) {
al.clear(); al.clear();
dls.text_value_for_line(db_tc, lpc, dls.text_value_for_line(db_tc, lpc,
al.get_string(), al.get_string(),

@ -156,7 +156,7 @@ static string com_adjust_log_time(exec_context &ec, string cmdline, vector<strin
char buffer[1024]; char buffer[1024];
snprintf(buffer, sizeof(buffer), snprintf(buffer, sizeof(buffer),
"info: log timestamps will be adjusted by %ld.%06d seconds", "info: log timestamps will be adjusted by %ld.%06ld seconds",
time_diff.tv_sec, time_diff.tv_usec); time_diff.tv_sec, time_diff.tv_usec);
retval = buffer; retval = buffer;
@ -2347,7 +2347,7 @@ static string com_toggle_field(exec_context &ec, string cmdline, vector<string>
bool hide = args[0] == "hide-fields"; bool hide = args[0] == "hide-fields";
vector<string> found_fields, missing_fields; vector<string> found_fields, missing_fields;
for (int lpc = 1; lpc < args.size(); lpc++) { for (int lpc = 1; lpc < (int)args.size(); lpc++) {
intern_string_t name; intern_string_t name;
log_format *format = nullptr; log_format *format = nullptr;
size_t dot; size_t dot;

@ -305,6 +305,8 @@ void log_msg_extra_complete()
} }
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
static void sigabrt(int sig) static void sigabrt(int sig)
{ {
char crash_path[1024], latest_crash_path[1024]; char crash_path[1024], latest_crash_path[1024];
@ -339,10 +341,10 @@ static void sigabrt(int sig)
"%s/latest-crash.log", lnav_log_crash_dir); "%s/latest-crash.log", lnav_log_crash_dir);
if ((fd = open(crash_path, O_CREAT|O_TRUNC|O_WRONLY, 0600)) != -1) { if ((fd = open(crash_path, O_CREAT|O_TRUNC|O_WRONLY, 0600)) != -1) {
if (log_ring.lr_frag_start < (off_t)BUFFER_SIZE) { if (log_ring.lr_frag_start < (off_t)BUFFER_SIZE) {
write(fd, &log_ring.lr_data[log_ring.lr_frag_start], (void)write(fd, &log_ring.lr_data[log_ring.lr_frag_start],
log_ring.lr_frag_end - log_ring.lr_frag_start); log_ring.lr_frag_end - log_ring.lr_frag_start);
} }
write(fd, log_ring.lr_data, log_ring.lr_length); (void)write(fd, log_ring.lr_data, log_ring.lr_length);
#ifdef HAVE_EXECINFO_H #ifdef HAVE_EXECINFO_H
backtrace_symbols_fd(frames, frame_count, fd); backtrace_symbols_fd(frames, frame_count, fd);
#endif #endif
@ -395,9 +397,7 @@ static void sigabrt(int sig)
fprintf(stderr, "\nWould you like to attach a debugger? (y/N) "); fprintf(stderr, "\nWould you like to attach a debugger? (y/N) ");
fflush(stderr); fflush(stderr);
scanf("%c", &response); if (scanf("%c", &response) > 0 && tolower(response) == 'y') {
if (tolower(response) == 'y') {
pid_t lnav_pid = getpid(); pid_t lnav_pid = getpid();
pid_t child_pid; pid_t child_pid;
@ -436,6 +436,7 @@ static void sigabrt(int sig)
_exit(1); _exit(1);
} }
#pragma GCC diagnostic pop
void log_install_handlers(void) void log_install_handlers(void)
{ {

@ -577,7 +577,7 @@ const char *date_time_scanner::scan(const char *time_dest,
} }
#endif #endif
if (ptime_fmt(time_fmt[curr_time_fmt], tm_out, time_dest, off, time_len) && if (ptime_fmt(time_fmt[curr_time_fmt], tm_out, time_dest, off, time_len) &&
(time_dest[off] == '.' || time_dest[off] == ',' || off == time_len)) { (time_dest[off] == '.' || time_dest[off] == ',' || off == (off_t)time_len)) {
retval = &time_dest[off]; retval = &time_dest[off];
if (tm_out->et_tm.tm_year < 70) { if (tm_out->et_tm.tm_year < 70) {
tm_out->et_tm.tm_year = 80; tm_out->et_tm.tm_year = 80;

@ -585,13 +585,13 @@ bool external_log_format::scan_for_partial(shared_buffer_ref &sbr, size_t &len_o
return true; return true;
} }
if (pat->p_timestamp_end == -1 || pat->p_timestamp_end > sbr.length()) { if (pat->p_timestamp_end == -1 || pat->p_timestamp_end > (int)sbr.length()) {
len_out = 0; len_out = 0;
return false; return false;
} }
len_out = pat->p_pcre->match_partial(pi); len_out = pat->p_pcre->match_partial(pi);
return len_out > pat->p_timestamp_end; return (int)len_out > pat->p_timestamp_end;
} }
log_format::scan_result_t external_log_format::scan(nonstd::optional<logfile *> lf, log_format::scan_result_t external_log_format::scan(nonstd::optional<logfile *> lf,
@ -1141,7 +1141,7 @@ void external_log_format::get_subline(const logline &ll, shared_buffer_ref &sbr,
lr.lr_start = this->jlf_cached_line.size(); lr.lr_start = this->jlf_cached_line.size();
lv_iter->lv_hidden = lv_iter->lv_user_hidden; lv_iter->lv_hidden = lv_iter->lv_user_hidden;
if (str.size() > jfe.jfe_max_width) { if ((int)str.size() > jfe.jfe_max_width) {
switch (jfe.jfe_overflow) { switch (jfe.jfe_overflow) {
case json_format_element::ABBREV: { case json_format_element::ABBREV: {
this->json_append_to_cache( this->json_append_to_cache(
@ -1293,7 +1293,7 @@ void external_log_format::get_subline(const logline &ll, shared_buffer_ref &sbr,
if (this->jlf_cached_line[this_off] == '\n') { if (this->jlf_cached_line[this_off] == '\n') {
this_off += 1; this_off += 1;
} }
if ((ll.get_sub_offset() + 1) < this->jlf_line_offsets.size()) { if ((ll.get_sub_offset() + 1) < (int)this->jlf_line_offsets.size()) {
next_off = this->jlf_line_offsets[ll.get_sub_offset() + 1]; next_off = this->jlf_line_offsets[ll.get_sub_offset() + 1];
} }
else { else {
@ -1428,7 +1428,7 @@ void external_log_format::build(std::vector<std::string> &errors) {
stable_sort(pat.p_value_by_index.begin(), pat.p_value_by_index.end()); stable_sort(pat.p_value_by_index.begin(), pat.p_value_by_index.end());
for (int lpc = 0; lpc < pat.p_value_by_index.size(); lpc++) { for (int lpc = 0; lpc < (int)pat.p_value_by_index.size(); lpc++) {
auto &ivd = pat.p_value_by_index[lpc]; auto &ivd = pat.p_value_by_index[lpc];
auto &vd = *ivd.ivd_value_def; auto &vd = *ivd.ivd_value_def;

@ -849,6 +849,7 @@ string log_vtab_manager::unregister_vtab(intern_string_t name)
} }
else { else {
auto_mem<char> sql(sqlite3_free); auto_mem<char> sql(sqlite3_free);
__attribute((unused))
int rc; int rc;
sql = sqlite3_mprintf("DROP TABLE %s ", name.get()); sql = sqlite3_mprintf("DROP TABLE %s ", name.get());

@ -54,7 +54,6 @@ static const size_t MAX_UNRECOGNIZED_LINES = 1000;
static const size_t INDEX_RESERVE_INCREMENT = 1024; static const size_t INDEX_RESERVE_INCREMENT = 1024;
logfile::logfile(const string &filename, logfile_open_options &loo) logfile::logfile(const string &filename, logfile_open_options &loo)
throw (error)
: lf_filename(filename), : lf_filename(filename),
lf_index_time(0), lf_index_time(0),
lf_index_size(0), lf_index_size(0),
@ -281,7 +280,6 @@ bool logfile::process_prefix(off_t offset, shared_buffer_ref &sbr)
} }
logfile::rebuild_result_t logfile::rebuild_index() logfile::rebuild_result_t logfile::rebuild_index()
throw (line_buffer::error, logfile::error)
{ {
rebuild_result_t retval = RR_NO_NEW_LINES; rebuild_result_t retval = RR_NO_NEW_LINES;
struct stat st; struct stat st;

@ -127,7 +127,7 @@ public:
* constructor should open the file specified by 'filename'. The * constructor should open the file specified by 'filename'. The
* descriptor needs to be seekable. * descriptor needs to be seekable.
*/ */
logfile(const std::string &filename, logfile_open_options &loo) throw (error); logfile(const std::string &filename, logfile_open_options &loo);
virtual ~logfile(); virtual ~logfile();
@ -359,8 +359,7 @@ public:
* indexing. * indexing.
* @return True if any new lines were indexed. * @return True if any new lines were indexed.
*/ */
rebuild_result_t rebuild_index() rebuild_result_t rebuild_index();
throw (line_buffer::error, logfile::error);
void reobserve_from(iterator iter); void reobserve_from(iterator iter);

@ -324,7 +324,7 @@ void logfile_sub_source::text_attrs_for_line(textview_curses &lv,
chtype graph = ACS_VLINE; chtype graph = ACS_VLINE;
if (is_first_for_file) { if (is_first_for_file) {
if (is_last_for_file) { if (is_last_for_file) {
graph = ACS_DIAMOND; graph = ACS_HLINE;
} }
else { else {
graph = ACS_ULCORNER; graph = ACS_ULCORNER;
@ -472,6 +472,9 @@ bool logfile_sub_source::rebuild_index(bool force)
logfile &lf = *ld.get_file(); logfile &lf = *ld.get_file();
switch (lf.rebuild_index()) { switch (lf.rebuild_index()) {
case logfile::RR_NO_NEW_LINES:
// No changes
break;
case logfile::RR_NEW_LINES: case logfile::RR_NEW_LINES:
retval = true; retval = true;
if (!this->lss_index.empty()) { if (!this->lss_index.empty()) {

@ -100,7 +100,7 @@ public:
}; };
void increase_line_context(void) { void increase_line_context(void) {
long old_flags = this->lss_flags; auto old_flags = this->lss_flags;
if (this->lss_flags & F_FILENAME) { if (this->lss_flags & F_FILENAME) {
// Nothing to do // Nothing to do
@ -116,7 +116,7 @@ public:
}; };
bool decrease_line_context(void) { bool decrease_line_context(void) {
long old_flags = this->lss_flags; auto old_flags = this->lss_flags;
if (this->lss_flags & F_FILENAME) { if (this->lss_flags & F_FILENAME) {
this->lss_flags &= ~F_NAME_MASK; this->lss_flags &= ~F_NAME_MASK;

@ -340,7 +340,7 @@ public:
public: public:
error(std::string msg, int offset = 0) error(std::string msg, int offset = 0)
: e_msg(msg), e_offset(offset) { }; : e_msg(msg), e_offset(offset) { };
virtual ~error() throw () { }; virtual ~error() { };
virtual const char *what() const throw() { virtual const char *what() const throw() {
return this->e_msg.c_str(); return this->e_msg.c_str();

@ -235,7 +235,7 @@ static void rl_search_internal(void *dummy, readline_curses *rc, bool complete =
annotate_sql_statement(al); annotate_sql_statement(al);
if (x > 0 && x >= al.length()) { if (x > 0 && (int)x >= al.length()) {
x -= 1; x -= 1;
} }
@ -502,7 +502,9 @@ void rl_display_matches(void *dummy, readline_curses *rc)
{ {
const std::vector<std::string> &matches = rc->get_matches(); const std::vector<std::string> &matches = rc->get_matches();
textview_curses &tc = lnav_data.ld_match_view; textview_curses &tc = lnav_data.ld_match_view;
unsigned long width, height; unsigned long width;
__attribute((unused))
unsigned long height;
int max_len, cols, rows; int max_len, cols, rows;
getmaxyx(lnav_data.ld_window, height, width); getmaxyx(lnav_data.ld_window, height, width);

@ -900,7 +900,7 @@ void annotate_sql_statement(attr_line_t &al)
bool found_open = false; bool found_open = false;
ssize_t lpc; ssize_t lpc;
for (lpc = iter->sa_range.lr_end; lpc < line.length(); lpc++) { for (lpc = iter->sa_range.lr_end; lpc < (int)line.length(); lpc++) {
if (line[lpc] == '(') { if (line[lpc] == '(') {
found_open = true; found_open = true;
break; break;

@ -103,7 +103,7 @@ regexp_match(const char *re, const char *str)
} }
else { else {
char *cap_copy = (char *)alloca(cap->length() + 1); char *cap_copy = (char *)alloca(cap->length() + 1);
int64_t i_value; long long int i_value;
double d_value; double d_value;
int end_index; int end_index;
@ -112,7 +112,7 @@ regexp_match(const char *re, const char *str)
if (sscanf(cap_copy, "%lld%n", &i_value, &end_index) == 1 && if (sscanf(cap_copy, "%lld%n", &i_value, &end_index) == 1 &&
(end_index == cap->length())) { (end_index == cap->length())) {
return i_value; return (int64_t)i_value;
} }
else if (sscanf(cap_copy, "%lf%n", &d_value, &end_index) == 1 && else if (sscanf(cap_copy, "%lf%n", &d_value, &end_index) == 1 &&
(end_index == cap->length())) { (end_index == cap->length())) {
@ -139,7 +139,7 @@ regexp_match(const char *re, const char *str)
else { else {
const char *cap_start = pi.get_substr_start(cap); const char *cap_start = pi.get_substr_start(cap);
char *cap_copy = (char *) alloca(cap->length() + 1); char *cap_copy = (char *) alloca(cap->length() + 1);
int64_t i_value; long long int i_value;
double d_value; double d_value;
int end_index; int end_index;

@ -204,10 +204,10 @@ attr_line_t &attr_line_t::with_ansi_string(const char *str, ...)
va_list args; va_list args;
va_start(args, str); va_start(args, str);
vasprintf(formatted_str.out(), str, args); auto ret = vasprintf(formatted_str.out(), str, args);
va_end(args); va_end(args);
if (formatted_str != NULL) { if (ret >= 0 && formatted_str != NULL) {
this->al_string = formatted_str; this->al_string = formatted_str;
scrub_ansi_string(this->al_string, this->al_attrs); scrub_ansi_string(this->al_string, this->al_attrs);
} }
@ -240,11 +240,11 @@ attr_line_t &attr_line_t::append(const attr_line_t &al, text_wrap_settings *tws)
} }
} }
if (tws != nullptr && this->al_string.length() > tws->tws_width) { if (tws != nullptr && (int)this->al_string.length() > tws->tws_width) {
ssize_t start_pos = start_len; ssize_t start_pos = start_len;
ssize_t line_start = this->al_string.rfind('\n', start_pos); ssize_t line_start = this->al_string.rfind('\n', start_pos);
if (line_start == string::npos) { if (line_start == (ssize_t)string::npos) {
line_start = 0; line_start = 0;
} else { } else {
line_start += 1; line_start += 1;
@ -258,12 +258,12 @@ attr_line_t &attr_line_t::append(const attr_line_t &al, text_wrap_settings *tws)
avail = INT_MAX; avail = INT_MAX;
} }
while (start_pos < this->al_string.length()) { while (start_pos < (int)this->al_string.length()) {
ssize_t lpc; ssize_t lpc;
// Find the end of a word or a breakpoint. // Find the end of a word or a breakpoint.
for (lpc = start_pos; for (lpc = start_pos;
lpc < this->al_string.length() && lpc < (int)this->al_string.length() &&
(isalnum(this->al_string[lpc]) || (isalnum(this->al_string[lpc]) ||
this->al_string[lpc] == ',' || this->al_string[lpc] == ',' ||
this->al_string[lpc] == '_' || this->al_string[lpc] == '_' ||
@ -286,7 +286,7 @@ attr_line_t &attr_line_t::append(const attr_line_t &al, text_wrap_settings *tws)
} else { } else {
// There's still room to add stuff. // There's still room to add stuff.
avail -= (lpc - start_pos); avail -= (lpc - start_pos);
while (lpc < this->al_string.length() && avail) { while (lpc < (int)this->al_string.length() && avail) {
if (this->al_string[lpc] == '\n') { if (this->al_string[lpc] == '\n') {
this->insert(lpc + 1, tws->tws_indent, ' '); this->insert(lpc + 1, tws->tws_indent, ' ');
avail = usable_width; avail = usable_width;
@ -308,7 +308,7 @@ attr_line_t &attr_line_t::append(const attr_line_t &al, text_wrap_settings *tws)
avail = usable_width; avail = usable_width;
for (lpc = start_pos; for (lpc = start_pos;
lpc < this->al_string.length() && lpc < (int)this->al_string.length() &&
this->al_string[lpc] == ' '; this->al_string[lpc] == ' ';
lpc++) { lpc++) {
} }
@ -453,7 +453,7 @@ void view_curses::mvwattrline(WINDOW *window,
for (auto tab_iter = tab_list.rbegin(); for (auto tab_iter = tab_list.rbegin();
tab_iter != tab_list.rend(); tab_iter != tab_list.rend();
++tab_iter) { ++tab_iter) {
if (tab_iter->tm_origin < attr_range.lr_start) { if ((int)tab_iter->tm_origin < attr_range.lr_start) {
attr_range.lr_start += tab_iter->length() - 1; attr_range.lr_start += tab_iter->length() - 1;
} }
} }
@ -462,7 +462,7 @@ void view_curses::mvwattrline(WINDOW *window,
for (auto tab_iter = tab_list.rbegin(); for (auto tab_iter = tab_list.rbegin();
tab_iter != tab_list.rend(); tab_iter != tab_list.rend();
++tab_iter) { ++tab_iter) {
if (tab_iter->tm_origin < attr_range.lr_end) { if ((int)tab_iter->tm_origin < attr_range.lr_end) {
attr_range.lr_end += tab_iter->length() - 1; attr_range.lr_end += tab_iter->length() - 1;
} }
} }

@ -231,7 +231,7 @@ CREATE TABLE lnav_view_stack (
}; };
int delete_row(sqlite3_vtab *tab, sqlite3_int64 rowid) { int delete_row(sqlite3_vtab *tab, sqlite3_int64 rowid) {
if (rowid != lnav_data.ld_view_stack.size() - 1) { if ((size_t)rowid != lnav_data.ld_view_stack.size() - 1) {
tab->zErrMsg = sqlite3_mprintf( tab->zErrMsg = sqlite3_mprintf(
"Only the top view in the stack can be deleted"); "Only the top view in the stack can be deleted");
return SQLITE_ERROR; return SQLITE_ERROR;

@ -615,7 +615,7 @@ void yajlpp_parse_context::update_callbacks(const json_path_handler_base *orig_h
this->update_callbacks(jph.jph_children, child_start + cap->c_end); this->update_callbacks(jph.jph_children, child_start + cap->c_end);
} }
else { else {
if (child_start + cap->c_end != this->ypc_path.size() - 1) { if (child_start + cap->c_end != (int)this->ypc_path.size() - 1) {
continue; continue;
} }

@ -517,7 +517,7 @@ int main(int argc, char *argv[])
else { else {
int maxfd, out_len = 0; int maxfd, out_len = 0;
bool got_expected = true; bool got_expected = true;
bool got_user_step; bool got_user_step = false;
struct timeval last, now; struct timeval last, now;
char out_buffer[8192]; char out_buffer[8192];
fd_set read_fds; fd_set read_fds;

@ -27,8 +27,9 @@ int main(int argc, char *argv[])
FILE *file = fopen(argv[1], "r"); FILE *file = fopen(argv[1], "r");
int row = 0; int row = 0;
while (!feof(file)) { while (!feof(file)) {
fgets(buf, sizeof(buf), file); if (0 < fgets(buf, sizeof(buf), file)) {
mvwaddstr(stdscr, row++, 0, buf); mvwaddstr(stdscr, row++, 0, buf);
}
} }
getch(); getch();
endwin(); endwin();

Loading…
Cancel
Save