[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.
This commit is contained in:
LDA 2024-10-22 10:21:54 +02:00
parent 44d6df3be8
commit b0cf0961a3
13 changed files with 35 additions and 25 deletions

14
CONTRIBUTORS Normal file
View file

@ -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

View file

@ -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
);
}

View file

@ -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);

View file

@ -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;
}

View file

@ -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

View file

@ -12,8 +12,6 @@
#include <Matrix.h>
#include <AS.h>
#include <ctype.h>
static const char *
GetXMPPInformation(ParseeData *data, HashMap *event, char **from, char **to);

View file

@ -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 == '.')
{

View file

@ -7,7 +7,6 @@
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
char **
StrSplitLines(char *text)

View file

@ -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);
}

View file

@ -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)
{

View file

@ -4,7 +4,6 @@
#include <pthread.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include <time.h>

View file

@ -32,7 +32,7 @@ TrimBase64(char *b64)
while (*b64)
{
char ch[2] = { *b64, 0 };
if (isspace(*b64))
if (isspace((int) *b64))
{
b64++;
continue;

View file

@ -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--; \
} \