From: Richard Russon Date: Wed, 25 Jul 2018 13:36:05 +0000 (+0100) Subject: coverity X-Git-Tag: 2019-10-25~732^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8b9f951f3ebff1d6451b922e14121e1346211181;p=neomutt coverity --- diff --git a/config/dump.c b/config/dump.c index d1c6d45ca..4811543bd 100644 --- a/config/dump.c +++ b/config/dump.c @@ -215,7 +215,8 @@ void dump_config_neo(struct ConfigSet *cs, struct HashElem *he, if (flags & CS_DUMP_SHOW_DEFAULTS) { const struct ConfigSetType *cst = cs_get_type_def(cs, he->type); - printf("# %s %s %s\n", cst->name, name, value->data); + if (cst) + printf("# %s %s %s\n", cst->name, name, value->data); } } @@ -252,8 +253,8 @@ bool dump_config(struct ConfigSet *cs, int style, int flags) if ((type == DT_SYNONYM) && !(flags & CS_DUMP_SHOW_SYNONYMS)) continue; - if ((type == DT_DISABLED) && !(flags & CS_DUMP_SHOW_DISABLED)) - continue; + // if ((type == DT_DISABLED) && !(flags & CS_DUMP_SHOW_DISABLED)) + // continue; if (type != DT_SYNONYM) { diff --git a/config/long.c b/config/long.c index 8489c4a60..142e8de1a 100644 --- a/config/long.c +++ b/config/long.c @@ -59,12 +59,6 @@ static int long_string_set(const struct ConfigSet *cs, void *var, struct ConfigD return CSR_ERR_INVALID | CSR_INV_TYPE; } - if ((num < LONG_MIN) || (num > LONG_MAX)) - { - mutt_buffer_printf(err, "Long is too big: %s", value); - return CSR_ERR_INVALID | CSR_INV_TYPE; - } - if ((num < 0) && (cdef->type & DT_NOT_NEGATIVE)) { mutt_buffer_printf(err, "Option %s may not be negative", cdef->name); @@ -136,12 +130,6 @@ static int long_native_set(const struct ConfigSet *cs, void *var, if (!cs || !var || !cdef) return CSR_ERR_CODE; /* LCOV_EXCL_LINE */ - if ((value < LONG_MIN) || (value > LONG_MAX)) - { - mutt_buffer_printf(err, "Invalid long: %ld", value); - return CSR_ERR_INVALID | CSR_INV_TYPE; - } - if ((value < 0) && (cdef->type & DT_NOT_NEGATIVE)) { mutt_buffer_printf(err, "Option %s may not be negative", cdef->name); @@ -202,7 +190,7 @@ static int long_reset(const struct ConfigSet *cs, void *var, int rc = cdef->validator(cs, cdef, cdef->initial, err); if (CSR_RESULT(rc) != CSR_SUCCESS) - return rc | CSR_INV_VALIDATOR; + return (rc | CSR_INV_VALIDATOR); } *(short *) var = cdef->initial; diff --git a/config/number.c b/config/number.c index e40e34f71..a6ef7a0fe 100644 --- a/config/number.c +++ b/config/number.c @@ -61,7 +61,7 @@ static int number_string_set(const struct ConfigSet *cs, void *var, struct Confi int num = 0; if (mutt_str_atoi(value, &num) < 0) { - mutt_buffer_printf(err, "Invalid number: %s", NONULL(value)); + mutt_buffer_printf(err, "Invalid number: %s", value); return CSR_ERR_INVALID | CSR_INV_TYPE; } diff --git a/main.c b/main.c index 413a92edb..f6e37e959 100644 --- a/main.c +++ b/main.c @@ -149,7 +149,7 @@ static void test_parse_set(void) snprintf(line, sizeof(line), tests[t], commands[c], vars[v]); printf("%-26s", line); int rc = mutt_parse_rc_line(line, tmp, err); - printf("%2d %s\n", rc, NONULL(err->data)); + printf("%2d %s\n", rc, err->data); } printf("\n"); }