mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-14 02:08:21 +08:00
Merge branch 'fix/console-coverity-findings' into 'master'
fix(console): Remove dead code findings from coverity Closes IDF-13098 and IDF-13134 See merge request espressif/esp-idf!42324
This commit is contained in:
@@ -175,11 +175,6 @@ static int arg_int_scanfn(struct arg_int* parent, const char* argval) {
|
||||
}
|
||||
}
|
||||
|
||||
/* Safety check for integer overflow. WARNING: this check */
|
||||
/* achieves nothing on machines where size(int)==size(long). */
|
||||
if (val > INT_MAX || val < INT_MIN)
|
||||
errorcode = ARG_ERR_OVERFLOW;
|
||||
|
||||
/* Detect any suffixes (KB,MB,GB) and multiply argument value appropriately. */
|
||||
/* We need to be mindful of integer overflows when using such big numbers. */
|
||||
if (detectsuffix(end, "KB")) /* kilobytes */
|
||||
|
@@ -390,7 +390,7 @@ static void arg_parse_untagged(int argc, char** argv, struct arg_hdr** table, st
|
||||
}
|
||||
}
|
||||
|
||||
/* if a tenative error still remains at this point then register it as a proper error */
|
||||
/* if a tentative error still remains at this point then register it as a proper error */
|
||||
if (errorlast) {
|
||||
arg_register_error(endtable, parentlast, errorlast, optarglast);
|
||||
optind++;
|
||||
@@ -528,7 +528,7 @@ static void arg_cat_option(char* dest, size_t ndest, const char* shortopts, cons
|
||||
if (shortopts) {
|
||||
char option[3];
|
||||
|
||||
/* note: option array[] is initialiazed dynamically here to satisfy */
|
||||
/* note: option array[] is initialized dynamically here to satisfy */
|
||||
/* a deficiency in the watcom compiler wrt static array initializers. */
|
||||
option[0] = '-';
|
||||
option[1] = shortopts[0];
|
||||
@@ -586,7 +586,7 @@ static void arg_cat_optionv(char* dest, size_t ndest, const char* shortopts, con
|
||||
/* "-a|-b|-c" */
|
||||
char shortopt[3];
|
||||
|
||||
/* note: shortopt array[] is initialiazed dynamically here to satisfy */
|
||||
/* note: shortopt array[] is initialized dynamically here to satisfy */
|
||||
/* a deficiency in the watcom compiler wrt static array initializers. */
|
||||
shortopt[0] = '-';
|
||||
shortopt[1] = *c;
|
||||
@@ -865,7 +865,7 @@ void arg_print_glossary(FILE* fp, void** argtable, const char* format) {
|
||||
|
||||
/**
|
||||
* Print a piece of text formatted, which means in a column with a
|
||||
* left and a right margin. The lines are wrapped at whitspaces next
|
||||
* left and a right margin. The lines are wrapped at whitespaces next
|
||||
* to right margin. The function does not indent the first line, but
|
||||
* only the following ones.
|
||||
*
|
||||
@@ -879,11 +879,6 @@ static void arg_print_formatted_ds(arg_dstr_t ds, const unsigned lmargin, const
|
||||
|
||||
assert(strlen(text) < UINT_MAX);
|
||||
|
||||
/* Someone doesn't like us... */
|
||||
if (line_end < line_start) {
|
||||
arg_dstr_catf(ds, "%s\n", text);
|
||||
}
|
||||
|
||||
while (line_end > line_start) {
|
||||
/* Eat leading white spaces. This is essential because while
|
||||
wrapping lines, there will often be a whitespace at beginning
|
||||
@@ -945,7 +940,7 @@ static void arg_print_formatted_ds(arg_dstr_t ds, const unsigned lmargin, const
|
||||
|
||||
/**
|
||||
* Print a piece of text formatted, which means in a column with a
|
||||
* left and a right margin. The lines are wrapped at whitspaces next
|
||||
* left and a right margin. The lines are wrapped at whitespaces next
|
||||
* to right margin. The function does not indent the first line, but
|
||||
* only the following ones.
|
||||
*
|
||||
@@ -1073,7 +1068,7 @@ void arg_free(void** argtable) {
|
||||
do {
|
||||
/*
|
||||
if we encounter a NULL entry then somewhat incorrectly we presume
|
||||
we have come to the end of the array. It isnt strictly true because
|
||||
we have come to the end of the array. It isn't strictly true because
|
||||
an intermediate entry could be NULL with other non-NULL entries to follow.
|
||||
The subsequent argtable entries would then not be freed as they should.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user