commit: a3b6be9a0e6dfa4e85bc49d59d7b816605fc29b3
parent e2e5e98bcd0badcd437b8a67aa0986ed6d6678a9
Author: Michael Forney <mforney@mforney.org>
Date: Fri, 5 Jul 2019 22:25:46 -0700
less: Fix a few portability issues
Diffstat:
3 files changed, 116 insertions(+), 1 deletion(-)
diff --git a/pkg/less/patch/0001-Remove-after-function-definition.patch b/pkg/less/patch/0001-Remove-after-function-definition.patch
@@ -0,0 +1,29 @@
+From 5c87a344bc528c1878708c5e497f0e8e1742b7d4 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Fri, 5 Jul 2019 22:05:36 -0700
+Subject: [PATCH] Remove ';' after function definition
+
+The STR_TO_TYPE_FUNC macro expands to a function definition, so the ';'
+is treated as an empty top-level declaration, which is not valid in ISO C.
+---
+ output.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/output.c b/output.c
+index 100eb79..d1d20c4 100644
+--- a/output.c
++++ b/output.c
+@@ -493,8 +493,8 @@ type funcname(buf, ebuf) \
+ return val; \
+ }
+
+-STR_TO_TYPE_FUNC(lstrtopos, POSITION);
+-STR_TO_TYPE_FUNC(lstrtoi, int);
++STR_TO_TYPE_FUNC(lstrtopos, POSITION)
++STR_TO_TYPE_FUNC(lstrtoi, int)
+
+ /*
+ * Output an integer in a given radix.
+--
+2.22.0
+
diff --git a/pkg/less/patch/0002-Make-sure-public-functions-parameters-are-unaffected.patch b/pkg/less/patch/0002-Make-sure-public-functions-parameters-are-unaffected.patch
@@ -0,0 +1,86 @@
+From fe08e363d0b77bc5f61f4be9b6fe356d694b7a13 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Fri, 5 Jul 2019 21:50:22 -0700
+Subject: [PATCH] Make sure public functions parameters are unaffected by
+ argument promotion
+
+In order for a prototype declaration and non-prototype function
+definition to be compatible, the promoted type of the non-prototype
+function parameters must be compatible with the type of the corresponding
+prototype parameter.
+
+Since funcs.h is autogenerated by mkfuncs.pl which copies the parameter
+types as-is, use the promoted type in the definitions so that the types
+are unaffected by default argument promotion.
+
+Fixes #11
+---
+ charset.c | 2 +-
+ funcs.h | 6 +++---
+ line.c | 4 ++--
+ 3 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/charset.c b/charset.c
+index 6b35f01..1b74b2b 100644
+--- a/charset.c
++++ b/charset.c
+@@ -502,7 +502,7 @@ prutfchar(ch)
+ */
+ public int
+ utf_len(ch)
+- unsigned char ch;
++ int ch;
+ {
+ if ((ch & 0x80) == 0)
+ return 1;
+diff --git a/funcs.h b/funcs.h
+index 9686df1..aebea42 100644
+--- a/funcs.h
++++ b/funcs.h
+@@ -61,7 +61,7 @@ public int binary_char LESSPARAMS ((LWCHAR c));
+ public int control_char LESSPARAMS ((LWCHAR c));
+ public char * prchar LESSPARAMS ((LWCHAR c));
+ public char * prutfchar LESSPARAMS ((LWCHAR ch));
+-public int utf_len LESSPARAMS ((unsigned char ch));
++public int utf_len LESSPARAMS ((int ch));
+ public int is_utf8_well_formed LESSPARAMS ((char *ss, int slen));
+ public void utf_skip_to_lead LESSPARAMS ((char **pp, char *limit));
+ public LWCHAR get_wchar LESSPARAMS ((constant char *p));
+@@ -187,10 +187,10 @@ public void pshift_all LESSPARAMS ((VOID_PARAM));
+ public int is_ansi_end LESSPARAMS ((LWCHAR ch));
+ public int is_ansi_middle LESSPARAMS ((LWCHAR ch));
+ public void skip_ansi LESSPARAMS ((char **pp, constant char *limit));
+-public int pappend LESSPARAMS ((unsigned char c, POSITION pos));
++public int pappend LESSPARAMS ((int c, POSITION pos));
+ public int pflushmbc LESSPARAMS ((VOID_PARAM));
+ public void pdone LESSPARAMS ((int endline, int chopped, int forw));
+-public void set_status_col LESSPARAMS ((char c));
++public void set_status_col LESSPARAMS ((int c));
+ public int gline LESSPARAMS ((int i, int *ap));
+ public void null_line LESSPARAMS ((VOID_PARAM));
+ public POSITION forw_raw_line LESSPARAMS ((POSITION curr_pos, char **linep, int *line_lenp));
+diff --git a/line.c b/line.c
+index d32beb7..e46aa39 100644
+--- a/line.c
++++ b/line.c
+@@ -787,7 +787,7 @@ flush_mbc_buf(pos)
+ */
+ public int
+ pappend(c, pos)
+- unsigned char c;
++ int c;
+ POSITION pos;
+ {
+ int r;
+@@ -1157,7 +1157,7 @@ pdone(endline, chopped, forw)
+ */
+ public void
+ set_status_col(c)
+- char c;
++ int c;
+ {
+ set_linebuf(0, c, AT_NORMAL|AT_HILITE);
+ }
+--
+2.22.0
+
diff --git a/pkg/less/ver b/pkg/less/ver
@@ -1 +1 @@
-551 r0
+551 r1