aboutsummaryrefslogtreecommitdiff
path: root/filters
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-12-05 20:46:55 +0100
committerRobin Jarry <robin@jarry.cc>2023-12-14 23:05:07 +0100
commit73bf7241e611ea28e7a58584341921d1262afaa1 (patch)
treede7a87d1c8888d6e4309f5cf06f1a82f9e8ec051 /filters
parent2db657b6bdd6394109c8adc32098d3f39c43f03d (diff)
downloadaerc-73bf7241e611ea28e7a58584341921d1262afaa1.tar.gz
aerc-73bf7241e611ea28e7a58584341921d1262afaa1.zip
lint,validate: fix for openbsd
- Remove GNU specific stuff (ln -v, mktemp --tempdir, grep --color) - Remove GCC specific flags in sendemail-validate (-Warith-conversion) - Add -std=c99 and -Wpedantic and fix the reported warnings. - Explicitly call gmake everywhere. - Run our custom analyzer standalone. Golangci lint plugins are not supported on OpenBSD. Indirect dependency to golang.org/x/mod is required somehow... Reported-by: Johannes Thyssen Tishman <johannes@thyssentishman.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Johannes Thyssen Tishman <johannes@thyssentishman.com>
Diffstat (limited to 'filters')
-rw-r--r--filters/colorize.c6
-rw-r--r--filters/wrap.c9
2 files changed, 8 insertions, 7 deletions
diff --git a/filters/colorize.c b/filters/colorize.c
index 1c4f8c63..9500950a 100644
--- a/filters/colorize.c
+++ b/filters/colorize.c
@@ -62,7 +62,7 @@ static void *xmalloc(size_t s)
#define RESET "\x1b[0m"
#define LONGEST_SEQ "\x1b[1;2;3;4;5;7;38;2;255;255;255;48;2;255;255;255m"
-const char *seq(struct style *s) {
+static const char *seq(struct style *s) {
if (!s->sequence) {
char *b, *buf = xmalloc(strlen(LONGEST_SEQ) + 1);
const char *sep = "";
@@ -249,7 +249,7 @@ static int parse_color(struct color *c, const char *val)
} else if (sscanf(val, "#%x", &color) == 1 && color <= 0xffffff) {
c->type = RGB;
c->rgb = color;
- } else if (sscanf(val, "%d", &color) == 1 && color <= 256) {
+ } else if (sscanf(val, "%u", &color) == 1 && color <= 256) {
c->type = PALETTE;
c->index = color;
} else if (!color_name(val, &color)) {
@@ -702,7 +702,7 @@ static void colorize_line(const char *in)
}
}
-int parse_args(int argc, char **argv)
+static int parse_args(int argc, char **argv)
{
const char *filename = NULL, *osc8 = NULL;
int c;
diff --git a/filters/wrap.c b/filters/wrap.c
index e6c73057..59c44522 100644
--- a/filters/wrap.c
+++ b/filters/wrap.c
@@ -7,6 +7,7 @@
#include <locale.h>
#include <regex.h>
#include <stdbool.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -33,7 +34,7 @@ static size_t prose_ratio = 50;
static bool reflow;
static FILE *in_file;
-int parse_args(int argc, char **argv)
+static int parse_args(int argc, char **argv)
{
const char *filename = NULL;
long value;
@@ -362,18 +363,18 @@ static void write_paragraph(struct paragraph *p)
more = false;
} else {
/* find split point, preferably before margin */
- size_t split = -1U;
+ size_t split = SIZE_MAX;
size_t w = 0;
for (size_t i = 0; text[i] != L'\0'; i++) {
w += (size_t)wcwidth(text[i]);
- if (width + w > margin && split != -1U) {
+ if (width + w > margin && split != SIZE_MAX) {
break;
}
if (iswspace((wint_t)text[i])) {
split = i;
}
}
- if (split == -1U) {
+ if (split == SIZE_MAX) {
/* no space found to split, print a long line */
line = text;
more = false;