aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Dokuchaev <danfe@FreeBSD.org>2021-06-19 14:44:18 +0000
committerAlexey Dokuchaev <danfe@FreeBSD.org>2021-06-19 14:44:52 +0000
commit34796ebc1db2aecdc58dde0774b7280fe2959543 (patch)
treefe1636d066e72828d9dc04810bc0c8993decc49a
parente8c5bd341102ab751a7dad31ec29cf6fe6c769a8 (diff)
downloadports-34796ebc1db2aecdc58dde0774b7280fe2959543.tar.gz
ports-34796ebc1db2aecdc58dde0774b7280fe2959543.zip
sysutils/lnav: attempt to unbreak the build on 32-bit architectures
Obtained from: upstream (dfd18a4be5fd5e5378f44bef81bcc6cca4ac4a76)
-rw-r--r--sysutils/lnav/Makefile3
-rw-r--r--sysutils/lnav/files/patch-src_logfile.cc37
2 files changed, 37 insertions, 3 deletions
diff --git a/sysutils/lnav/Makefile b/sysutils/lnav/Makefile
index 49e2f3b8d985..e06fb260aa31 100644
--- a/sysutils/lnav/Makefile
+++ b/sysutils/lnav/Makefile
@@ -10,9 +10,6 @@ COMMENT= Terminal based log file navigator
LICENSE= BSD2CLAUSE
-BROKEN_i386= fails to build: error: non-constant-expression cannot be narrowed
-BROKEN_powerpc= fails to build: error: non-constant-expression cannot be narrowed
-
LIB_DEPENDS= libpcrecpp.so:devel/pcre
USES= autoreconf compiler:c++14-lang gmake ncurses readline sqlite tar:bz2
diff --git a/sysutils/lnav/files/patch-src_logfile.cc b/sysutils/lnav/files/patch-src_logfile.cc
new file mode 100644
index 000000000000..fbad7c3c686e
--- /dev/null
+++ b/sysutils/lnav/files/patch-src_logfile.cc
@@ -0,0 +1,37 @@
+--- src/logfile.cc.orig 2020-09-09 16:17:12 UTC
++++ src/logfile.cc
+@@ -323,10 +323,13 @@ logfile::rebuild_result_t logfile::rebuild_index()
+
+ this->lf_line_buffer.clear();
+ if (!this->lf_index.empty()) {
+- off_t check_line_off = this->lf_index.back().get_offset();
++ auto last_line = this->lf_index.end();
++ --last_line;
++ off_t check_line_off = last_line->get_offset();
++ auto last_length = ssize_t(this->line_length(last_line, false));
+
+ auto read_result = this->lf_line_buffer.read_range({
+- check_line_off, this->lf_index_size - check_line_off
++ check_line_off, last_length
+ });
+
+ if (read_result.isErr()) {
+@@ -553,7 +556,7 @@ filesystem::path logfile::get_path() const
+
+ size_t logfile::line_length(logfile::iterator ll, bool include_continues)
+ {
+- iterator next_line = ll;
++ auto next_line = ll;
+ size_t retval;
+
+ if (!include_continues && this->lf_next_line_cache) {
+@@ -570,6 +573,9 @@ size_t logfile::line_length(logfile::iterator ll, bool
+
+ if (next_line == this->end()) {
+ retval = this->lf_index_size - ll->get_offset();
++ if (retval > line_buffer::MAX_LINE_BUFFER_SIZE) {
++ retval = line_buffer::MAX_LINE_BUFFER_SIZE;
++ }
+ if (retval > 0 && !this->lf_partial_line) {
+ retval -= 1;
+ }