commit ee69a647693f983ce1796a0c0332c3c33b11c0a8
parent 2a254ebb6b6bde06688b62cc295662104f5754e3
Author: nibo <nibo@relim.de>
Date: Sat, 12 Oct 2024 10:53:11 +0200
Restrict more config string values to lowercase
Diffstat:
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/chordpro.c b/chordpro.c
@@ -11,6 +11,14 @@
#include "config.h"
#include "util.h"
+static enum SongFragmentType g_current_ftype = SF_TEXT;
+static enum SongFragmentType g_prev_ftype = SF_TEXT;
+static struct Config *g_config = NULL;
+static const char *g_chordpro_filepath = NULL;
+static int *g_transpose_history = NULL;
+static int *g_transpose = NULL;
+static size_t g_line_number = 1;
+
static const char *environment_directives[] = {
"start_of_chorus", "soc", "end_of_chorus", "eoc", "chorus",
"start_of_verse", "sov", "end_of_verse", "eov",
@@ -174,14 +182,6 @@ static const char *chord_extensions_minor[] = {
NULL
};
-static enum SongFragmentType g_current_ftype = SF_TEXT;
-static enum SongFragmentType g_prev_ftype = SF_TEXT;
-static struct Config *g_config = NULL;
-static const char *g_chordpro_filepath = NULL;
-static int *g_transpose_history = NULL;
-static int *g_transpose = NULL;
-static size_t g_line_number = 1;
-
#ifdef DEBUG
static char *chord_qualifier_enums[] = {
@@ -624,9 +624,9 @@ cho_font_style_to_config_string(enum FontStyle style)
enum FontWeight
cho_font_weight_parse(const char *str)
{
- if (strcasecmp(str, "bold") == 0) {
+ if (!strcmp(str, "bold")) {
return FW_BOLD;
- } else if (strcasecmp(str, "normal") == 0) {
+ } else if (!strcmp(str, "normal")) {
return FW_REGULAR;
} else {
return FW_EMPTY;
diff --git a/config.c b/config.c
@@ -697,9 +697,9 @@ config_load(const char *filepath)
}
value = toml_table_string(chords, "mode");
if (value.ok) {
- if (strcasecmp(value.u.s, "strict") == 0) {
+ if (!strcmp(value.u.s, "strict")) {
config->parser->chords->mode = PM_STRICT;
- } else if (strcasecmp(value.u.s, "relaxed") == 0) {
+ } else if (!strcmp(value.u.s, "relaxed")) {
config->parser->chords->mode = PM_RELAXED;
}
free(value.u.s);