add TAG_BODY_SIZE and LEXICON_SIZE to config

This commit is contained in:
Iris Lightshard 2022-02-12 16:31:45 -07:00
parent c41b12a77e
commit f4e1863c46
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
2 changed files with 10 additions and 7 deletions

View file

@ -1,3 +1,6 @@
#define LEXICON_SIZE 1024
#define TAG_BODY_SIZE 4096
#define NAME "nilFM"
#define DOMAIN "https://nilfm.cc"
#define LOGO "<img src='/img/nilfm_blackHole_96.png' alt='blackHole://server'/>"

14
main.c
View file

@ -21,8 +21,8 @@ WITH REGARD TO THIS SOFTWARE.
struct dirent* dir;
typedef struct Lexicon {
int len, refs[1024];
char files[1024][64];
int len, refs[LEXICON_SIZE];
char files[LEXICON_SIZE][64];
} Lexicon;
/* clang-format off */
@ -363,7 +363,7 @@ int fpblock(FILE* f, char* s) {
int fpmetatemplate(FILE* f, Lexicon* l, char* s) {
int bopen, bclose;
char ss[4096];
char ss[TAG_BODY_SIZE];
unsigned char t = 0;
bopen = 0;
bclose = 0;
@ -393,8 +393,8 @@ int fpmetatemplate(FILE* f, Lexicon* l, char* s) {
continue;
}
}
if (slen(s) > 4095)
return error("Templating error", "text block over 16k");
if (slen(s) >= TAG_BODY_SIZE)
return error("Templating error", "text block exceeds tag body size");
if (t) {
ccat(ss, *s);
} else
@ -459,7 +459,7 @@ int fptemplate(FILE* f, Lexicon* l, char* s) {
int fpinject(FILE* f, Lexicon* l, char* filepath) {
FILE* inc;
int bopen, bclose;
char c, s[4096];
char c, s[TAG_BODY_SIZE];
unsigned char t = 0;
/*fprintf(stderr, "Building: %s\n", filepath);*/
bopen = 0;
@ -494,7 +494,7 @@ int fpinject(FILE* f, Lexicon* l, char* filepath) {
continue;
}
}
if (slen(s) > 4095)
if (slen(s) >= TAG_BODY_SIZE)
return error("Templating error", filepath);
if (t)
ccat(s, c);