Adjustments and annotations as per splint and flawfinder reports.

This commit is contained in:
Andrew Wood
2023-08-14 22:33:06 +01:00
parent 32f984de56
commit 7f25aff91d
6 changed files with 92 additions and 31 deletions
+4 -3
View File
@@ -55,16 +55,17 @@ struct opts_s { /* structure describing run-time options */
/*@keep@*/ /*@null@*/ char *name; /* display name, if any */
/*@keep@*/ /*@null@*/ char *format; /* output format, if any */
/*@keep@*/ /*@null@*/ char *pidfile; /* PID file, if any */
int argc; /* number of non-option arguments */
unsigned int argc; /* number of non-option arguments */
/*@keep@*/ /*@null@*/ char **argv; /* array of non-option arguments */
unsigned int argv_length; /* allocated array size */
};
/*@-exportlocal@*/
/* splint thinks opts_free is exported but not used - it is used. */
extern /*@null@*/ /*@only@*/ opts_t opts_parse(int, char **);
extern /*@null@*/ /*@only@*/ opts_t opts_parse(unsigned int, char **);
extern void opts_free(/*@only@*/ opts_t);
extern bool opts_add_file(opts_t, char *);
#ifdef __cplusplus
}
+2 -2
View File
@@ -77,7 +77,7 @@ struct pvstate_s {
/***************
* Input files *
***************/
int input_file_count; /* number of input files */
unsigned int input_file_count; /* number of input files */
const char **input_files; /* input files (0=first) */
/*******************
@@ -106,7 +106,7 @@ struct pvstate_s {
int watch_fd; /* fd to watch */
unsigned int width; /* screen width */
unsigned int height; /* screen height */
const char *name; /* display name */
/*@null@*/ const char *name; /* display name */
char default_format[PV_SIZEOF_DEFAULT_FORMAT]; /* default format string */
const char *format_string; /* output format string */
+5 -5
View File
@@ -79,7 +79,7 @@ extern size_t pv_strlcat(char *, const char *, size_t);
/*
* Create a new state structure, and return it, or 0 (NULL) on error.
*/
extern pvstate_t pv_state_alloc(const char *);
extern /*@null@*/ /*@only@*/ pvstate_t pv_state_alloc(const char *);
/*
* Set the formatting string, given a set of old-style formatting options.
@@ -90,7 +90,7 @@ extern void pv_state_set_format(pvstate_t state, bool progress,
bool average_rate, bool bytes,
bool bufpercent,
unsigned int lastwritten,
const char *name);
/*@null@*/ const char *name);
/*
* Set the various options.
@@ -119,9 +119,9 @@ extern void pv_state_name_set(pvstate_t, const char *);
extern void pv_state_format_string_set(pvstate_t, const char *);
extern void pv_state_watch_pid_set(pvstate_t, unsigned int);
extern void pv_state_watch_fd_set(pvstate_t, int);
extern void pv_state_average_rate_window_set(pvstate_t, int);
extern void pv_state_average_rate_window_set(pvstate_t, unsigned int);
extern void pv_state_inputfiles(pvstate_t, int, const char **);
extern void pv_state_inputfiles(pvstate_t, unsigned int, const char **);
/*
* Work out whether we are in the foreground.
@@ -166,7 +166,7 @@ extern void pv_sig_fini(pvstate_t);
/*
* Free a state structure, after which it can no longer be used.
*/
extern void pv_state_free(pvstate_t);
extern void pv_state_free(/*@only@*/ pvstate_t);
#ifdef ENABLE_DEBUGGING