From b0cf0961a32ab1ac221a63aca30273a2910e0a76 Mon Sep 17 00:00:00 2001 From: LDA Date: Tue, 22 Oct 2024 10:21:54 +0200 Subject: [PATCH] [FIX] Make codebase *slightly* NetBSD-friendly I need to make it so that NetBSD targets get their own correctness/build checks in CI. I also had to do some hacks with Cytoplasm, will make a PR for those soon. --- CONTRIBUTORS | 14 ++++++++++++++ configure.c | 12 ++++++------ src/AS/Room.c | 4 ++-- src/Command/Parser.c | 4 ++-- src/Main.c | 2 +- src/MatrixEventHandler.c | 2 -- src/Parsee/User.c | 2 +- src/StrSplit.c | 1 - src/XEP-0393.c | 4 ++-- src/XML/SAX.c | 4 ++-- src/XMPPThread/ReListener.c | 1 - src/XMPPThread/Stanzas/IQ.c | 2 +- tools/aya.c | 8 ++++---- 13 files changed, 35 insertions(+), 25 deletions(-) create mode 100644 CONTRIBUTORS diff --git a/CONTRIBUTORS b/CONTRIBUTORS new file mode 100644 index 0000000..c7f8b75 --- /dev/null +++ b/CONTRIBUTORS @@ -0,0 +1,14 @@ +# Lines starting with a '#' are ignored. +# This is a list of people who have contributed to Parsee. +# You *may* add some information about yourself after having made a change +# to the repository(or wiki!), with those fields: +# (N) - A nickname +# (L) - An approximate place of residence +# (X) - An XMPP URI +# (M) - A Matrix MXID +# (D) - A short description about yourself +(N): LDA +(L): France +(X): xmpp:lda@monocles.eu +(M): @fourier:ari.lt +(M): @fourier:ari.lt diff --git a/configure.c b/configure.c index 75d56f4..48b541b 100644 --- a/configure.c +++ b/configure.c @@ -531,7 +531,7 @@ main_build(int argc, char *argv[]) fprintf(makefile, "-DNAME=\"\\\"$(NAME)\\\"\" "); fprintf(makefile, "-DCODE=\"\\\"$(CODE)\\\"\" "); fprintf(makefile, "-DREPOSITORY=\"\\\"%s\\\"\" ", repo); - fprintf(makefile, "$(CFLAGS) $< -o $@\n"); + fprintf(makefile, "$(CFLAGS) %s -o %s\n", src, obj); } free(ofl); free(obj); @@ -560,8 +560,8 @@ main_build(int argc, char *argv[]) sym = string_rep_ext(sym, ".o", ""); str_array_free(s); - fprintf(makefile, "\ttools/out/b64 $< 'media_%s' '%s.c'\n", sym, obj); - fprintf(makefile, "\t$(CC) -c %s.c -o $@\n", obj); + fprintf(makefile, "\ttools/out/b64 %s 'media_%s' '%s.c'\n", src, sym, obj); + fprintf(makefile, "\t$(CC) -c %s.c -o %s\n", obj, obj); free(sym); } free(obj); @@ -583,12 +583,12 @@ main_build(int argc, char *argv[]) fprintf(makefile, "%s: %s\n", obj, src); { fprintf(makefile, "\t@mkdir -p tools/out\n"); - fprintf(makefile, "\t$(CC) -o $@"); + fprintf(makefile, "\t$(CC) -o %s", obj); if (with_static) { fprintf(makefile, " -static"); } - fprintf(makefile, " $<"); + fprintf(makefile, " %s", src); fprintf(makefile, " -I $(CYTO_INC)"); fprintf(makefile, " -L $(CYTO_LIB)"); if (with_static) @@ -632,7 +632,7 @@ main_build(int argc, char *argv[]) "\ttools/out/aya " "-C etc/ayadoc/style.css " "-p $(NAME) " - "-i $< -o $@\n" + "-i %s -o %s\n", src, obj ); } diff --git a/src/AS/Room.c b/src/AS/Room.c index 3bc7cbf..9e10579 100644 --- a/src/AS/Room.c +++ b/src/AS/Room.c @@ -73,7 +73,7 @@ ASBan(const ParseeConfig *conf, char *id, char *banned) Free(path); json = HashMapCreate(); HashMapSet(json, "user_id", JsonValueString(banned)); - HashMapSet(json, "reason", JsonValueString("Parsee felt jealous.")); + HashMapSet(json, "reason", JsonValueString(NAME " felt jealous.")); ASAuthenticateRequest(conf, ctx); ParseeSetRequestJSON(ctx, json); @@ -108,7 +108,7 @@ ASKick(const ParseeConfig *conf, char *id, char *banned) Free(path); json = HashMapCreate(); HashMapSet(json, "user_id", JsonValueString(banned)); - HashMapSet(json, "reason", JsonValueString("Parsee felt jealous.")); + HashMapSet(json, "reason", JsonValueString(NAME " felt jealous.")); ASAuthenticateRequest(conf, ctx); ParseeSetRequestJSON(ctx, json); diff --git a/src/Command/Parser.c b/src/Command/Parser.c index fea5007..65f295b 100644 --- a/src/Command/Parser.c +++ b/src/Command/Parser.c @@ -53,7 +53,7 @@ CommandParse(char *cmd) switch (state) { case STATE_WHITE: - if (!isblank(c)) + if (!isblank((int) c)) { state = STATE_NAME; namestart = cur; @@ -84,7 +84,7 @@ CommandParse(char *cmd) { char c = *cur; char cb[2] = { c, '\0' }; - if ((type && c == char_type) || (!type && isblank(c))) + if ((type && c == char_type) || (!type && isblank((int) c))) { break; } diff --git a/src/Main.c b/src/Main.c index 42cc40d..cd1f089 100644 --- a/src/Main.c +++ b/src/Main.c @@ -80,7 +80,7 @@ Main(Array *args, HashMap *env) ); ParseePrintASCII(); Log(LOG_INFO, "======================="); - Log(LOG_INFO, "(C)opyright 2024 LDA"); + Log(LOG_INFO, "(C)opyright 2024 LDA and other contributors"); Log(LOG_INFO, "(This program is free software, see LICENSE.)"); #ifdef PLATFORM_IPHONE diff --git a/src/MatrixEventHandler.c b/src/MatrixEventHandler.c index 0f84789..bae2f3e 100644 --- a/src/MatrixEventHandler.c +++ b/src/MatrixEventHandler.c @@ -12,8 +12,6 @@ #include #include -#include - static const char * GetXMPPInformation(ParseeData *data, HashMap *event, char **from, char **to); diff --git a/src/Parsee/User.c b/src/Parsee/User.c index e68082b..e77f20a 100644 --- a/src/Parsee/User.c +++ b/src/Parsee/User.c @@ -165,7 +165,7 @@ ParseeEncodeJID(const ParseeConfig *c, char *jid, bool trim) /* RID: Break everything and die. */ break; } - if (islower(*cs) || isalnum(*cs) || *cs == '_' || + if (islower((int) *cs) || isalnum((int) *cs) || *cs == '_' || *cs == '=' || *cs == '-' || *cs == '/' || *cs == '+' || *cs == '.') { diff --git a/src/StrSplit.c b/src/StrSplit.c index aef23f5..eccd97f 100644 --- a/src/StrSplit.c +++ b/src/StrSplit.c @@ -7,7 +7,6 @@ #include #include #include -#include char ** StrSplitLines(char *text) diff --git a/src/XEP-0393.c b/src/XEP-0393.c index 2976563..a0f6be9 100644 --- a/src/XEP-0393.c +++ b/src/XEP-0393.c @@ -87,7 +87,7 @@ DecodeQuote(StringRect rect, size_t *skip) * > four but that's for Nerds * > seasons See, Touhou reference! * concealing!) */ - while ((ch = StrGet(&rect, lines - 1, shift_by)) && isspace(ch)) + while ((ch = StrGet(&rect, lines - 1, shift_by)) && isspace((int) ch)) { shift_by++; } @@ -132,7 +132,7 @@ DecodeSpan(StringRect rect, char del, size_t *skip) { return StrFullRect(NULL); } - if (!ret.source_lines && isspace(c)) + if (!ret.source_lines && isspace((int) c)) { return StrFullRect(NULL); } diff --git a/src/XML/SAX.c b/src/XML/SAX.c index d21113c..21430bb 100644 --- a/src/XML/SAX.c +++ b/src/XML/SAX.c @@ -337,8 +337,8 @@ seekback: return ret; } -#define IsNamestart(c) ((c == ':') || isalpha(c) || (c == '_')) -#define IsNamepart(c) (IsNamestart(c) || (c == '-') || isdigit(c)) +#define IsNamestart(c) ((c == ':') || isalpha((int) c) || (c == '_')) +#define IsNamepart(c) (IsNamestart(c) || (c == '-') || isdigit((int) c)) static char * XMLParseName(XMLexer *lexer) { diff --git a/src/XMPPThread/ReListener.c b/src/XMPPThread/ReListener.c index 0bbfbd5..e8b619f 100644 --- a/src/XMPPThread/ReListener.c +++ b/src/XMPPThread/ReListener.c @@ -4,7 +4,6 @@ #include #include #include -#include #include #include diff --git a/src/XMPPThread/Stanzas/IQ.c b/src/XMPPThread/Stanzas/IQ.c index 44c3697..33556aa 100644 --- a/src/XMPPThread/Stanzas/IQ.c +++ b/src/XMPPThread/Stanzas/IQ.c @@ -32,7 +32,7 @@ TrimBase64(char *b64) while (*b64) { char ch[2] = { *b64, 0 }; - if (isspace(*b64)) + if (isspace((int) *b64)) { b64++; continue; diff --git a/tools/aya.c b/tools/aya.c index b49fd6b..dc49421 100644 --- a/tools/aya.c +++ b/tools/aya.c @@ -83,7 +83,7 @@ ParseAyadoc(char *raw) if (!strncmp(start, " *", 2) || !strncmp(start, "*", 1)) { start += 1 + (*start == ' '); - while (start && isspace(*start)) + while (start && isspace((int) *start)) { start++; } @@ -112,7 +112,7 @@ ParseAyadoc(char *raw) char *val = del ? del + 1 : NULL; if (del && strlen(del) >= 1) { - while (*val && isspace(*val)) + while (*val && isspace((int) *val)) { val++; } @@ -214,7 +214,7 @@ HandleSeeValue(Stream *out, AyadocComment *aya, HeaderDeclaration d, char *field { \ char *temporary, *field = NULL, *index; \ char *last_char; \ - while (*start_of_arg && isspace(*start_of_arg)) \ + while (*start_of_arg && isspace((int) *start_of_arg)) \ { \ start_of_arg++; \ } \ @@ -230,7 +230,7 @@ HandleSeeValue(Stream *out, AyadocComment *aya, HeaderDeclaration d, char *field \ /* Trim out spaces */ \ last_char = separator - 1; \ - while (*last_char && isspace(*last_char)) \ + while (*last_char && isspace((int) *last_char)) \ { \ last_char--; \ } \