mirror of https://github.com/tstack/lnav.git
[build] fix some warnings
This commit is contained in:
parent
eeddc318ff
commit
d54f21d7a5
|
@ -174,7 +174,7 @@ attr_line_t::insert(size_t index,
|
|||
|
||||
static const pcrepp SPACE_RE(R"(\s?)");
|
||||
|
||||
ssize_t starting_line_index = this->al_string.rfind('\n', index);
|
||||
auto starting_line_index = this->al_string.rfind('\n', index);
|
||||
if (starting_line_index == std::string::npos) {
|
||||
starting_line_index = 0;
|
||||
} else {
|
||||
|
@ -186,7 +186,7 @@ attr_line_t::insert(size_t index,
|
|||
auto text_to_wrap
|
||||
= string_fragment{this->al_string.data(), (int) starting_line_index};
|
||||
string_fragment last_word;
|
||||
size_t line_ch_count = 0;
|
||||
ssize_t line_ch_count = 0;
|
||||
auto needs_indent = false;
|
||||
|
||||
while (!text_to_wrap.empty()) {
|
||||
|
@ -444,7 +444,7 @@ attr_line_t::erase(size_t pos, size_t len)
|
|||
}
|
||||
|
||||
attr_line_t&
|
||||
attr_line_t::pad_to(size_t size)
|
||||
attr_line_t::pad_to(ssize_t size)
|
||||
{
|
||||
const auto curr_len = this->utf8_length_or_length();
|
||||
|
||||
|
|
|
@ -647,7 +647,7 @@ public:
|
|||
|
||||
attr_line_t& right_justify(unsigned long width);
|
||||
|
||||
attr_line_t& pad_to(size_t size);
|
||||
attr_line_t& pad_to(ssize_t size);
|
||||
|
||||
ssize_t length() const
|
||||
{
|
||||
|
|
|
@ -211,7 +211,8 @@ date_time_scanner::scan(const char* time_dest,
|
|||
retval = nullptr;
|
||||
}
|
||||
|
||||
if (retval != nullptr && (retval - time_dest) < time_len) {
|
||||
if (retval != nullptr && static_cast<size_t>(retval - time_dest) < time_len)
|
||||
{
|
||||
/* Try to pull out the milli/micro-second value. */
|
||||
if (retval[0] == '.' || retval[0] == ',') {
|
||||
off_t off = (retval - time_dest) + 1;
|
||||
|
|
|
@ -97,8 +97,9 @@ intern_string::lookup(const char* str, ssize_t len) noexcept
|
|||
|
||||
curr = tab->it_table[h];
|
||||
while (curr != nullptr) {
|
||||
if (curr->is_str.size() == len
|
||||
&& strncmp(curr->is_str.c_str(), str, len) == 0) {
|
||||
if (static_cast<ssize_t>(curr->is_str.size()) == len
|
||||
&& strncmp(curr->is_str.c_str(), str, len) == 0)
|
||||
{
|
||||
return curr;
|
||||
}
|
||||
curr = curr->is_next;
|
||||
|
@ -232,3 +233,20 @@ string_fragment::split_lines() const
|
|||
|
||||
return retval;
|
||||
}
|
||||
|
||||
Result<ssize_t, const char*>
|
||||
string_fragment::utf8_length() const
|
||||
{
|
||||
ssize_t retval = 0;
|
||||
|
||||
for (ssize_t byte_index = this->sf_begin; byte_index < this->sf_end;) {
|
||||
auto ch_size = TRY(ww898::utf::utf8::char_size([this, byte_index]() {
|
||||
return std::make_pair(this->sf_string[byte_index],
|
||||
this->sf_end - byte_index);
|
||||
}));
|
||||
byte_index += ch_size;
|
||||
retval += 1;
|
||||
}
|
||||
|
||||
return Ok(retval);
|
||||
}
|
||||
|
|
|
@ -65,22 +65,7 @@ struct string_fragment {
|
|||
|
||||
int length() const { return this->sf_end - this->sf_begin; }
|
||||
|
||||
Result<size_t, const char*> utf8_length() const
|
||||
{
|
||||
size_t retval = 0;
|
||||
|
||||
for (ssize_t byte_index = this->sf_begin; byte_index < this->sf_end;) {
|
||||
auto ch_size
|
||||
= TRY(ww898::utf::utf8::char_size([this, byte_index]() {
|
||||
return std::make_pair(this->sf_string[byte_index],
|
||||
this->sf_end - byte_index);
|
||||
}));
|
||||
byte_index += ch_size;
|
||||
retval += 1;
|
||||
}
|
||||
|
||||
return Ok(retval);
|
||||
}
|
||||
Result<ssize_t, const char*> utf8_length() const;
|
||||
|
||||
const char* data() const { return &this->sf_string[this->sf_begin]; }
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ println(FILE* file, const attr_line_t& al)
|
|||
return;
|
||||
}
|
||||
|
||||
std::set<int> points = {0, (int) al.length()};
|
||||
std::set<size_t> points = {0, static_cast<size_t>(al.length())};
|
||||
|
||||
for (const auto& attr : al.get_attrs()) {
|
||||
if (!attr.sa_range.is_valid()) {
|
||||
|
@ -257,7 +257,7 @@ println(FILE* file, const attr_line_t& al)
|
|||
}
|
||||
}
|
||||
|
||||
nonstd::optional<int> last_point;
|
||||
nonstd::optional<size_t> last_point;
|
||||
for (const auto& point : points) {
|
||||
if (last_point) {
|
||||
auto default_fg_style = fmt::text_style{};
|
||||
|
|
|
@ -58,7 +58,7 @@ breadcrumb_curses::do_update()
|
|||
|
||||
size_t crumb_index = 0;
|
||||
size_t sel_crumb_offset = 0;
|
||||
auto width = getmaxx(this->bc_window);
|
||||
auto width = static_cast<size_t>(getmaxx(this->bc_window));
|
||||
auto crumbs = this->bc_focused_crumbs.empty() ? this->bc_line_source()
|
||||
: this->bc_focused_crumbs;
|
||||
attr_line_t crumbs_line;
|
||||
|
@ -91,7 +91,7 @@ breadcrumb_curses::do_update()
|
|||
crumbs_line.append("\u276d"_breadcrumb);
|
||||
}
|
||||
|
||||
line_range lr{0, width};
|
||||
line_range lr{0, static_cast<int>(width)};
|
||||
view_curses::mvwattrline(
|
||||
this->bc_window, this->bc_y, 0, crumbs_line, lr, role_t::VCR_STATUS);
|
||||
|
||||
|
@ -159,7 +159,9 @@ breadcrumb_curses::reload_data()
|
|||
},
|
||||
selected_crumb_ref.c_display_value.length());
|
||||
|
||||
if (selected_crumb_ref.c_search_placeholder.size() > width) {
|
||||
if (static_cast<ssize_t>(selected_crumb_ref.c_search_placeholder.size())
|
||||
> width)
|
||||
{
|
||||
width = selected_crumb_ref.c_search_placeholder.size();
|
||||
}
|
||||
this->bc_match_view.set_height(vis_line_t(
|
||||
|
@ -303,7 +305,8 @@ breadcrumb_curses::perform_selection(
|
|||
auto& selected_crumb_ref
|
||||
= this->bc_focused_crumbs[this->bc_selected_crumb.value()];
|
||||
auto match_sel = this->bc_match_view.get_selection();
|
||||
if (match_sel >= 0 && match_sel < this->bc_similar_values.size()) {
|
||||
if (match_sel >= 0
|
||||
&& match_sel < vis_line_t(this->bc_similar_values.size())) {
|
||||
const auto& new_value = this->bc_similar_values[match_sel].p_key;
|
||||
|
||||
switch (behavior) {
|
||||
|
|
|
@ -123,7 +123,7 @@ discover_metadata(const attr_line_t& al)
|
|||
{
|
||||
}
|
||||
|
||||
uint32_t oi_level;
|
||||
int32_t oi_level;
|
||||
file_off_t oi_start;
|
||||
section_key_t oi_id;
|
||||
std::unique_ptr<hier_node> oi_node{std::make_unique<hier_node>()};
|
||||
|
|
|
@ -169,7 +169,9 @@ input_dispatcher::reset_escape_buffer(int ch,
|
|||
void
|
||||
input_dispatcher::append_to_escape_buffer(int ch)
|
||||
{
|
||||
if (this->id_escape_index < (sizeof(this->id_escape_buffer) - 1)) {
|
||||
if (this->id_escape_index
|
||||
< static_cast<ssize_t>(sizeof(this->id_escape_buffer) - 1))
|
||||
{
|
||||
this->id_escape_buffer[this->id_escape_index++] = static_cast<char>(ch);
|
||||
this->id_escape_buffer[this->id_escape_index] = '\0';
|
||||
}
|
||||
|
|
|
@ -350,7 +350,9 @@ static const typed_json_path_container<console::user_message>
|
|||
.with_obj_provider<console::snippet, console::user_message>(
|
||||
[](const yajlpp_provider_context& ypc,
|
||||
console::user_message* root) {
|
||||
root->um_snippets.resize(ypc.ypc_index + 1);
|
||||
if (ypc.ypc_index >= root->um_snippets.size()) {
|
||||
root->um_snippets.resize(ypc.ypc_index + 1);
|
||||
}
|
||||
|
||||
return &root->um_snippets[ypc.ypc_index];
|
||||
})
|
||||
|
|
|
@ -2036,7 +2036,7 @@ external_log_format::build(std::vector<lnav::console::user_message>& errors)
|
|||
pcre_input pi_full(elf_sample.s_line.pp_value);
|
||||
|
||||
if (!pat.p_pcre->match(pc_full, pi_full)
|
||||
|| pc_full.all()->length()
|
||||
|| static_cast<size_t>(pc_full.all()->length())
|
||||
!= elf_sample.s_line.pp_value.length())
|
||||
{
|
||||
errors.emplace_back(
|
||||
|
|
|
@ -683,7 +683,7 @@ vt_column(sqlite3_vtab_cursor* cur, sqlite3_context* ctx, int col)
|
|||
lf, line_number, vc->log_msg, vc->line_values);
|
||||
}
|
||||
|
||||
size_t sub_col = col - VT_COL_MAX;
|
||||
int sub_col = col - VT_COL_MAX;
|
||||
std::vector<logline_value>::iterator lv_iter;
|
||||
|
||||
lv_iter = find_if(vc->line_values.begin(),
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace lnav {
|
|||
namespace logfile {
|
||||
|
||||
struct config {
|
||||
int64_t lc_max_unrecognized_lines{15000};
|
||||
uint64_t lc_max_unrecognized_lines{15000};
|
||||
};
|
||||
|
||||
} // namespace logfile
|
||||
|
|
|
@ -1303,7 +1303,9 @@ logfile_sub_source::set_sql_marker(std::string stmt_str, sqlite3_stmt* stmt)
|
|||
if (this->lss_index_delegate) {
|
||||
this->lss_index_delegate->index_start(*this);
|
||||
}
|
||||
for (auto row = 0_vl; row < this->lss_filtered_index.size(); row += 1_vl) {
|
||||
for (auto row = 0_vl; row < vis_line_t(this->lss_filtered_index.size());
|
||||
row += 1_vl)
|
||||
{
|
||||
auto cl = this->at(row);
|
||||
auto ld = this->find_data(cl);
|
||||
auto ll = (*ld)->get_file()->begin() + cl;
|
||||
|
@ -1919,7 +1921,7 @@ logline_window::end()
|
|||
logline_window::logmsg_info::logmsg_info(logfile_sub_source& lss, vis_line_t vl)
|
||||
: li_source(lss), li_line(vl)
|
||||
{
|
||||
if (this->li_line < this->li_source.text_line_count()) {
|
||||
if (this->li_line < vis_line_t(this->li_source.text_line_count())) {
|
||||
while (true) {
|
||||
auto pair_opt = this->li_source.find_line_with_file(vl);
|
||||
|
||||
|
@ -1948,7 +1950,7 @@ logline_window::logmsg_info::next_msg()
|
|||
this->li_string_attrs.clear();
|
||||
this->li_line_values.clear();
|
||||
++this->li_line;
|
||||
while (this->li_line < this->li_source.text_line_count()) {
|
||||
while (this->li_line < vis_line_t(this->li_source.text_line_count())) {
|
||||
auto pair_opt = this->li_source.find_line_with_file(this->li_line);
|
||||
|
||||
if (!pair_opt) {
|
||||
|
|
|
@ -563,7 +563,7 @@ public:
|
|||
nonstd::optional<std::pair<std::shared_ptr<logfile>, logfile::iterator>>
|
||||
find_line_with_file(vis_line_t vl) const
|
||||
{
|
||||
if (vl >= 0_vl && vl <= this->lss_filtered_index.size()) {
|
||||
if (vl >= 0_vl && vl <= vis_line_t(this->lss_filtered_index.size())) {
|
||||
return this->find_line_with_file(this->at(vl));
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "base/lnav_log.hh"
|
||||
#include "sysclip.hh"
|
||||
|
||||
namespace sysclip {
|
||||
|
@ -51,6 +52,8 @@ struct clip_commands {
|
|||
case op_t::READ:
|
||||
return this->cc_read;
|
||||
}
|
||||
|
||||
ensure(false);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -67,6 +70,8 @@ struct clipboard {
|
|||
case type_t::FIND:
|
||||
return this->c_find;
|
||||
}
|
||||
|
||||
ensure(false);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ public:
|
|||
{
|
||||
text_sub_source::text_crumbs_for_line(line, crumbs);
|
||||
|
||||
if (line < 0 || line > this->tds_lines.size()) {
|
||||
if (line < 0 || static_cast<size_t>(line) > this->tds_lines.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ json_path_handler_base::gen(yajlpp_gen_context& ygc, yajl_gen handle) const
|
|||
pcre_context_static<30> pc;
|
||||
pcre_input pi("");
|
||||
|
||||
yajlpp_provider_context ypc{{pc, pi}, static_cast<int>(index)};
|
||||
yajlpp_provider_context ypc{{pc, pi}, index};
|
||||
yajlpp_gen_context elem_ygc(handle, *this->jph_children);
|
||||
elem_ygc.ygc_depth = 1;
|
||||
elem_ygc.ygc_obj_stack.push(
|
||||
|
@ -127,10 +127,12 @@ json_path_handler_base::gen(yajlpp_gen_context& ygc, yajl_gen handle) const
|
|||
|
||||
this->jph_regex.match(pc, pi);
|
||||
ygc.ygc_obj_stack.push(this->jph_obj_provider(
|
||||
{{pc, pi}, -1}, ygc.ygc_obj_stack.top()));
|
||||
{{pc, pi}, yajlpp_provider_context::nindex},
|
||||
ygc.ygc_obj_stack.top()));
|
||||
if (!ygc.ygc_default_stack.empty()) {
|
||||
ygc.ygc_default_stack.push(this->jph_obj_provider(
|
||||
{{pc, pi}, -1}, ygc.ygc_default_stack.top()));
|
||||
{{pc, pi}, yajlpp_provider_context::nindex},
|
||||
ygc.ygc_default_stack.top()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -395,7 +397,9 @@ json_path_handler_base::walk(
|
|||
ensure(false);
|
||||
}
|
||||
child_root = this->jph_obj_provider(
|
||||
{{ypc.ypc_pcre_context, pi}, -1}, root);
|
||||
{{ypc.ypc_pcre_context, pi},
|
||||
yajlpp_provider_context::nindex},
|
||||
root);
|
||||
}
|
||||
|
||||
jph.walk(cb, child_root, full_path);
|
||||
|
@ -431,7 +435,7 @@ const char*
|
|||
json_path_handler_base::to_enum_string(int value) const
|
||||
{
|
||||
for (int lpc = 0; this->jph_enum_values[lpc].first; lpc++) {
|
||||
const enum_value_t& ev = this->jph_enum_values[lpc];
|
||||
const auto& ev = this->jph_enum_values[lpc];
|
||||
|
||||
if (ev.second == value) {
|
||||
return ev.first;
|
||||
|
@ -584,7 +588,7 @@ yajlpp_parse_context::update_callbacks(const json_path_container* orig_handlers,
|
|||
}
|
||||
}
|
||||
|
||||
for (auto& jph : handlers->jpc_children) {
|
||||
for (const auto& jph : handlers->jpc_children) {
|
||||
pi.reset(&this->ypc_path[1 + child_start],
|
||||
0,
|
||||
this->ypc_path.size() - 2 - child_start);
|
||||
|
@ -592,11 +596,12 @@ yajlpp_parse_context::update_callbacks(const json_path_container* orig_handlers,
|
|||
pcre_context::capture_t* cap = this->ypc_pcre_context.all();
|
||||
|
||||
if (jph.jph_obj_provider) {
|
||||
int index = this->index_for_provider();
|
||||
auto index = this->index_for_provider();
|
||||
|
||||
if ((1 + child_start + cap->c_end
|
||||
!= (int) this->ypc_path.size() - 1)
|
||||
&& (!jph.is_array() || index >= 0))
|
||||
&& (!jph.is_array()
|
||||
|| index != yajlpp_provider_context::nindex))
|
||||
{
|
||||
this->ypc_obj_stack.push(jph.jph_obj_provider(
|
||||
{{this->ypc_pcre_context, pi}, index},
|
||||
|
|
|
@ -89,7 +89,9 @@ class yajlpp_parse_context;
|
|||
|
||||
struct yajlpp_provider_context {
|
||||
pcre_extractor ypc_extractor;
|
||||
int ypc_index;
|
||||
size_t ypc_index{0};
|
||||
|
||||
static constexpr size_t nindex = static_cast<size_t>(-1);
|
||||
|
||||
template<typename T>
|
||||
intern_string_t get_substr_i(T name) const
|
||||
|
@ -149,7 +151,7 @@ struct json_path_handler_base {
|
|||
}
|
||||
|
||||
const char* first;
|
||||
unsigned int second;
|
||||
int second;
|
||||
};
|
||||
|
||||
static const enum_value_t ENUM_TERMINATOR;
|
||||
|
@ -400,7 +402,7 @@ public:
|
|||
yajl_callbacks ypc_alt_callbacks;
|
||||
std::vector<char> ypc_path;
|
||||
std::vector<size_t> ypc_path_index_stack;
|
||||
std::vector<int> ypc_array_index;
|
||||
std::vector<size_t> ypc_array_index;
|
||||
std::vector<const json_path_handler_base*> ypc_handler_stack;
|
||||
pcre_context_static<30> ypc_pcre_context;
|
||||
bool ypc_ignore_unused{false};
|
||||
|
@ -416,11 +418,11 @@ public:
|
|||
private:
|
||||
static const yajl_callbacks DEFAULT_CALLBACKS;
|
||||
|
||||
int index_for_provider() const
|
||||
size_t index_for_provider() const
|
||||
{
|
||||
return this->ypc_array_index.empty() ? -1
|
||||
return this->ypc_array_index.empty() ? static_cast<size_t>(-1)
|
||||
: this->ypc_array_index.back();
|
||||
};
|
||||
}
|
||||
|
||||
static int map_start(void* ctx);
|
||||
static int map_key(void* ctx, const unsigned char* key, size_t len);
|
||||
|
|
Loading…
Reference in New Issue