]> granicus.if.org Git - neomutt/commitdiff
coverity
authorRichard Russon <rich@flatcap.org>
Wed, 25 Jul 2018 13:36:05 +0000 (14:36 +0100)
committerRichard Russon <rich@flatcap.org>
Wed, 25 Jul 2018 14:08:29 +0000 (15:08 +0100)
config/dump.c
config/long.c
config/number.c
main.c

index d1c6d45ca592cf488d87cb8d0140d0504cf26265..4811543bd9c4658dd13baeb492fd81eacb08fca4 100644 (file)
@@ -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)
     {
index 8489c4a60f7e1dbf572d8c828e72e3a80a94a194..142e8de1aa8888c3b741ab2b2a5777ece1e50add 100644 (file)
@@ -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;
index e40e34f71c8a80d544ad3e9cd04dcf8073e604a7..a6ef7a0fe0d432077944b65dfeacf1c82886844e 100644 (file)
@@ -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 413a92edbb443283e3d5f2c2d028dc8053d74f0d..f6e37e959220081032770b1189955a27cb1fe9a8 100644 (file)
--- 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");
     }