good const, bad const, fixing -Wincompatible-pointer-types-discards-qualifiers

This commit is contained in:
Philippe Teuwen 2019-04-10 10:21:42 +02:00
commit 7f76fea21a
45 changed files with 124 additions and 124 deletions

View file

@ -236,7 +236,7 @@ int opterr = 1; /* if error message should be printed */
int optind = 1; /* index into parent argv vector */
int optopt = '?'; /* character checked for validity */
int optreset; /* reset getopt */
char *optarg; /* argument associated with option */
const char *optarg; /* argument associated with option */
#endif
#define PRINT_ERROR ((opterr) && (*options != ':'))
@ -259,7 +259,7 @@ static int parse_long_options(char *const *, const char *,
static int gcd(int, int);
static void permute_args(int, int, int, char *const *);
static char *place = EMSG; /* option letter processing */
static const char *place = EMSG; /* option letter processing */
/* XXX: set optreset to 1 rather than these two */
static int nonopt_start = -1; /* first non option argument (for permute) */
@ -377,7 +377,7 @@ permute_args(int panonopt_start, int panonopt_end, int opt_end,
static int
parse_long_options(char *const *nargv, const char *options,
const struct option *long_options, int *idx, int short_too) {
char *current_argv, *has_equal;
const char *current_argv, *has_equal;
size_t current_argv_len;
int i, match;
@ -4325,9 +4325,9 @@ void arg_print_option(FILE *fp,
static
void arg_print_gnuswitch(FILE *fp, struct arg_hdr * *table) {
int tabindex;
char *format1 = " -%c";
char *format2 = " [-%c";
char *suffix = "";
const char *format1 = " -%c";
const char *format2 = " [-%c";
const char *suffix = "";
/* print all mandatory switches that are without argument values */
for (tabindex = 0;

View file

@ -14,12 +14,12 @@
void **argtable = NULL;
size_t argtableLen = 0;
char *programName = NULL;
char *programHint = NULL;
char *programHelp = NULL;
const char *programName = NULL;
const char *programHint = NULL;
const char *programHelp = NULL;
char buf[500] = {0};
int CLIParserInit(char *vprogramName, char *vprogramHint, char *vprogramHelp) {
int CLIParserInit(const char *vprogramName, const char *vprogramHint, const char *vprogramHelp) {
argtable = NULL;
argtableLen = 0;
programName = vprogramName;

View file

@ -31,7 +31,7 @@
#define CLIGetHexWithReturn(paramnum, data, datalen) if (CLIParamHexToBuf(arg_get_str(paramnum), data, sizeof(data), datalen)) {CLIParserFree();return 1;}
#define CLIGetStrWithReturn(paramnum, data, datalen) if (CLIParamStrToBuf(arg_get_str(paramnum), data, sizeof(data), datalen)) {CLIParserFree();return 1;}
int CLIParserInit(char *vprogramName, char *vprogramHint, char *vprogramHelp);
int CLIParserInit(const char *vprogramName, const char *vprogramHint, const char *vprogramHelp);
int CLIParserParseString(const char *str, void *vargtable[], size_t vargtableLen, bool allowEmptyExec);
int CLIParserParseStringEx(const char *str, void *vargtable[], size_t vargtableLen, bool allowEmptyExec, bool clueData);
int CLIParserParseArg(int argc, char **argv, void *vargtable[], size_t vargtableLen, bool allowEmptyExec);

View file

@ -68,7 +68,7 @@ int getopt_long_only(int, char *const *, const char *,
#define _GETOPT_DECLARED
int getopt(int, char *const [], const char *);
extern char *optarg; /* getopt(3) external variables */
extern const char *optarg; /* getopt(3) external variables */
extern int optind, opterr, optopt;
#endif
#ifndef _OPTRESET_DECLARED