[build] fix some warnings

pull/1031/head
Tim Stack 2 years ago
parent c824b64840
commit 13f161d21e

@ -37,7 +37,7 @@
namespace archive_manager {
struct config {
int64_t amc_min_free_space{32 * 1024 * 1024};
uint64_t amc_min_free_space{32 * 1024 * 1024};
std::chrono::seconds amc_cache_ttl{std::chrono::hours(48)};
};

@ -76,7 +76,7 @@ scrub_ansi_string(std::string& str, string_attrs_t* sa)
caps->c_begin + (int) output_size},
SA_ORIGIN_OFFSET.value(origin_offset));
}
for (size_t triple_index = 0; triple_index < output_size;
for (ssize_t triple_index = 0; triple_index < output_size;
triple_index++)
{
char lhs = sf[triple_index * 3];

@ -33,6 +33,8 @@
#define lnav_auto_mem_hh
#include <exception>
#include <iterator>
#include <utility>
#include <assert.h>
#include <stdlib.h>

@ -200,7 +200,7 @@ struct string_fragment {
bool endswith(const char* suffix) const
{
auto suffix_len = strlen(suffix);
int suffix_len = strlen(suffix);
if (suffix_len > this->length()) {
return false;
@ -235,7 +235,7 @@ struct string_fragment {
template<typename P>
string_fragment find_left_boundary(size_t start, P&& predicate) const
{
assert(start < this->length());
assert((int) start < this->length());
while (start > 0) {
if (predicate(this->data()[start])) {
@ -255,7 +255,7 @@ struct string_fragment {
template<typename P>
string_fragment find_right_boundary(size_t start, P&& predicate) const
{
while (start < this->length()) {
while ((int) start < this->length()) {
if (predicate(this->data()[start])) {
break;
}

@ -83,7 +83,7 @@ find_matching_bracket(
}
if (line[x] == left && is_bracket(line, x, is_lit)) {
for (size_t lpc = x + 1; lpc < sub.lr_end; lpc++) {
for (int lpc = x + 1; lpc < sub.lr_end; lpc++) {
if (line[lpc] == left && is_bracket(line, lpc, is_lit)) {
depth += 1;
} else if (line[lpc] == right && is_bracket(line, lpc, is_lit)) {
@ -103,7 +103,7 @@ find_matching_bracket(
depth = 0;
for (size_t lpc = sub.lr_start; lpc < sub.lr_end; lpc++) {
for (auto lpc = sub.lr_start; lpc < sub.lr_end; lpc++) {
if (line[lpc] == left && is_bracket(line, lpc, is_lit)) {
depth += 1;
if (!first_left) {
@ -171,7 +171,7 @@ regex_highlighter(attr_line_t& al, int x, line_range sub)
attr_line_builder alb(al);
bool backslash_is_quoted = false;
for (size_t lpc = sub.lr_start; lpc < sub.lr_end; lpc++) {
for (auto lpc = sub.lr_start; lpc < sub.lr_end; lpc++) {
if (lpc == 0 || line[lpc - 1] != '\\') {
switch (line[lpc]) {
case '^':

@ -180,7 +180,7 @@ bottom_status_source::update_hits(textview_curses* tc)
}
void
bottom_status_source::update_loading(file_off_t off, file_size_t total)
bottom_status_source::update_loading(file_off_t off, file_ssize_t total)
{
auto& sf = this->bss_fields[BSF_LOADING];
@ -195,7 +195,7 @@ bottom_status_source::update_loading(file_off_t off, file_size_t total)
} else {
sf.clear();
}
} else if ((size_t) off == total) {
} else if (off == total) {
static const std::vector<std::string> DOTS = {
" ",
". ",

@ -79,7 +79,7 @@ public:
void update_hits(textview_curses* tc);
void update_loading(file_off_t off, file_size_t total);
void update_loading(file_off_t off, file_ssize_t total);
private:
status_field bss_prompt{1024, role_t::VCR_STATUS};

@ -110,7 +110,7 @@ sql_progress(const struct log_cursor& lc)
{
static sig_atomic_t sql_counter = 0;
size_t total = lnav_data.ld_log_source.text_line_count();
ssize_t total = lnav_data.ld_log_source.text_line_count();
off_t off = lc.lc_curr_line;
if (off < 0 || off >= total) {

@ -115,7 +115,7 @@ highlighter::annotate(attr_line_t& al, int start) const
this->annotate_capture(al, lr);
} else {
for (size_t lpc = 0; lpc < pc.get_count() - 1; lpc++) {
for (int lpc = 0; lpc < pc.get_count() - 1; lpc++) {
line_range lr{start + pc[lpc]->c_begin, start + pc[lpc]->c_end};
const auto* name = this->h_regex->name_for_capture(lpc);

@ -254,7 +254,8 @@ private:
bool in_range(file_off_t off) const
{
return this->lb_file_offset <= off
&& off < (this->lb_file_offset + this->lb_buffer.size());
&& off
< (this->lb_file_offset + (file_ssize_t) this->lb_buffer.size());
}
void resize_buffer(size_t new_max);
@ -295,7 +296,7 @@ private:
*/
const char* get_range(file_off_t start, file_ssize_t& avail_out) const
{
auto buffer_offset = start - this->lb_file_offset;
size_t buffer_offset = start - this->lb_file_offset;
require(buffer_offset >= 0);
require(this->lb_buffer.size() >= buffer_offset);

@ -404,7 +404,7 @@ com_goto(exec_context& ec, std::string cmdline, std::vector<std::string>& args)
"time values only work in a time-indexed view");
}
auto matched_size = scan_end - args[1].c_str();
size_t matched_size = scan_end - args[1].c_str();
if (matched_size != args[1].size()) {
auto um
= lnav::console::user_message::error(
@ -3516,7 +3516,7 @@ com_zoom_to(exec_context& ec,
} else if (args.size() > 1) {
bool found = false;
for (int lpc = 0; lpc < lnav_zoom_strings.size() && !found; lpc++) {
for (size_t lpc = 0; lpc < lnav_zoom_strings.size() && !found; lpc++) {
if (strcasecmp(args[1].c_str(), lnav_zoom_strings[lpc].c_str())
== 0)
{

@ -516,7 +516,7 @@ sql_encode(sqlite3_value* value, encode_algo algo)
case encode_algo::hex: {
auto buf = auto_buffer::alloc(blob_len * 2 + 1);
for (size_t lpc = 0; lpc < blob_len; lpc++) {
for (int lpc = 0; lpc < blob_len; lpc++) {
fmt::format_to(std::back_inserter(buf),
FMT_STRING("{:x}"),
blob[lpc]);
@ -550,7 +550,7 @@ sql_encode(sqlite3_value* value, encode_algo algo)
case encode_algo::hex: {
auto buf = auto_buffer::alloc(text_len * 2 + 1);
for (size_t lpc = 0; lpc < text_len; lpc++) {
for (int lpc = 0; lpc < text_len; lpc++) {
fmt::format_to(std::back_inserter(buf),
FMT_STRING("{:x}"),
text[lpc]);
@ -569,6 +569,7 @@ sql_encode(sqlite3_value* value, encode_algo algo)
}
}
}
ensure(false);
}
static mapbox::util::variant<blob_auto_buffer, auto_mem<char>>
@ -612,6 +613,7 @@ sql_decode(string_fragment str, encode_algo algo)
}
#endif
}
ensure(false);
}
std::string

@ -41,8 +41,7 @@
namespace tailer {
struct packet_eof {
};
struct packet_eof {};
struct packet_error {
std::string pe_path;
@ -122,12 +121,9 @@ using packet = mapbox::util::variant<packet_eof,
packet_possible_path,
packet_synced>;
struct recv_payload_type {
};
struct recv_payload_length {
};
struct recv_payload_content {
};
struct recv_payload_type {};
struct recv_payload_length {};
struct recv_payload_content {};
int readall(int sock, void* buf, size_t len);
@ -137,12 +133,11 @@ template<class...>
using void_t = void;
template<class, class = void>
struct has_data : std::false_type {
};
struct has_data : std::false_type {};
template<class T>
struct has_data<T, decltype(void(std::declval<T&>().data()))> : std::true_type {
};
struct has_data<T, decltype(void(std::declval<T&>().data()))>
: std::true_type {};
template<typename T, std::enable_if_t<has_data<T>::value, bool> = true>
uint8_t*
@ -191,7 +186,7 @@ struct protocol_recv {
if (payload_type != PAYLOAD_TYPE) {
return Err(fmt::format(
FMT_STRING("payload-type mismatch, got: {}; expected: {}"),
payload_type,
(int) payload_type,
PAYLOAD_TYPE));
}
@ -206,7 +201,8 @@ struct protocol_recv {
"read_length() cannot be called in this state");
if (readall(this->pr_fd, &this->pr_length, sizeof(this->pr_length))
== -1) {
== -1)
{
return Err(
fmt::format(FMT_STRING("unable to read content length: {}"),
strerror(errno)));
@ -234,7 +230,8 @@ struct protocol_recv {
this->pr_length = sizeof(T);
}
if (readall(this->pr_fd, details::get_data(data), this->pr_length)
== -1) {
== -1)
{
return Err(fmt::format(FMT_STRING("unable to read content -- {}"),
strerror(errno)));
}

@ -570,7 +570,7 @@ textfile_sub_source::rescan_files(
this->tss_doc_metadata[lf->get_filename()]
= metadata_state{
st.st_mtime,
static_cast<file_size_t>(st.st_size),
static_cast<file_ssize_t>(st.st_size),
lnav::document::discover_structure(
content, line_range{0, -1}),
};

@ -145,13 +145,13 @@ private:
struct rendered_file {
time_t rf_mtime;
file_size_t rf_file_size;
file_ssize_t rf_file_size;
std::unique_ptr<plain_text_source> rf_text_source;
};
struct metadata_state {
time_t ms_mtime;
file_size_t ms_file_size;
file_ssize_t ms_file_size;
lnav::document::metadata ms_metadata;
};

Loading…
Cancel
Save