Merge remote-tracking branch 'refs/remotes/origin/master'

This commit is contained in:
saeedark 2025-09-17 14:10:19 +03:30
commit 6fd357a46e
10 changed files with 65 additions and 16 deletions

View file

@ -483,8 +483,12 @@ str_to_ulong(const char *s, int base, unsigned long *res)
errno = 0;
char *end = NULL;
*res = strtoul(s, &end, base);
return errno == 0 && *end == '\0';
unsigned long v = strtoul(s, &end, base);
if (!(errno == 0 && *end == '\0'))
return false;
*res = v;
return true;
}
static bool NOINLINE
@ -553,12 +557,13 @@ value_to_float(struct context *ctx, float *res)
errno = 0;
char *end = NULL;
*res = strtof(s, &end);
float v = strtof(s, &end);
if (!(errno == 0 && *end == '\0')) {
LOG_CONTEXTUAL_ERR("invalid decimal value");
return false;
}
*res = v;
return true;
}
@ -650,7 +655,6 @@ value_to_enum(struct context *ctx, const char **value_map, int *res)
valid_values[idx - 2] = '\0';
LOG_CONTEXTUAL_ERR("not one of %s", valid_values);
*res = -1;
return false;
}
@ -699,14 +703,18 @@ value_to_two_colors(struct context *ctx,
goto out;
}
uint32_t a, b;
ctx->value = first_as_str;
if (!value_to_color(ctx, first, allow_alpha))
if (!value_to_color(ctx, &a, allow_alpha))
goto out;
ctx->value = second_as_str;
if (!value_to_color(ctx, second, allow_alpha))
if (!value_to_color(ctx, &b, allow_alpha))
goto out;
*first = a;
*second = b;
ret = true;
out:
@ -1134,6 +1142,9 @@ parse_section_main(struct context *ctx)
(int *)&conf->initial_color_theme);
}
else if (streq(key, "uppercase-regex-insert"))
return value_to_bool(ctx, &conf->uppercase_regex_insert);
else {
LOG_CONTEXTUAL_ERR("not a valid option: %s", key);
return false;
@ -3453,6 +3464,7 @@ config_load(struct config *conf, const char *conf_path,
.strikeout_thickness = {.pt = 0., .px = -1},
.dpi_aware = false,
.gamma_correct = false,
.uppercase_regex_insert = true,
.security = {
.osc52 = OSC52_ENABLED,
},