Fixed compiler warnings.

This commit is contained in:
Fotis Panagiotopoulos 2022-08-22 16:17:00 +03:00 committed by Xiang Xiao
parent d1cbbcdb41
commit 0cdb2cfa48
21 changed files with 128 additions and 18 deletions

View File

@ -74,7 +74,7 @@ struct fat_config_s
* offset 3.
*/
const static uint8_t g_bootcodeblob[] =
static const uint8_t g_bootcodeblob[] =
{
0x0e, 0x1f, 0xbe, 0x00, 0x7c, 0xac, 0x22, 0xc0, 0x74, 0x0b, 0x56,
0xb4, 0x0e, 0xbb, 0x07, 0x00, 0xcd, 0x10, 0x5e, 0xeb, 0xf0, 0x32,
@ -341,6 +341,8 @@ static inline uint8_t
mkfatfs_clustersearchlimits(FAR struct fat_format_s *fmt,
FAR struct fat_var_s *var)
{
UNUSED(var);
uint8_t mxclustshift;
/* Did the caller already pick the cluster size? If not, the clustshift
@ -721,7 +723,7 @@ mkfatfs_clustersearch(FAR struct fat_format_s *fmt,
if (var->fv_fattype != 32)
{
/* Calculate the number of sectors reqired to contain the selected
/* Calculate the number of sectors required to contain the selected
* number of root directory entries. This value is save in the var
* structure but will be overwritten if FAT32 is selected. FAT32 uses
* a cluster chain for the root directory, so the concept of the number

View File

@ -67,7 +67,7 @@ static int mkfatfs_devwrite(FAR const struct fat_format_s *fmt,
/* Convert the sector number to a byte offset */
if (sector < 0 || sector >= fmt->ff_nsectors)
if (sector < 0 || sector >= (off_t)fmt->ff_nsectors)
{
ferr("sector out of range: %ju\n", (intmax_t)sector);
return -ESPIPE;
@ -320,6 +320,8 @@ static inline void mkfatfs_initmbr(FAR struct fat_format_s *fmt,
static inline void mkfatfs_initfsinfo(FAR struct fat_format_s *fmt,
FAR struct fat_var_s *var)
{
UNUSED(fmt);
memset(var->fv_sect, 0, var->fv_sectorsize);
/* 4@0: 0x41615252 = "RRaA" */
@ -481,8 +483,8 @@ static inline int mkfatfs_writefat(FAR struct fat_format_s *fmt,
FAR struct fat_var_s *var)
{
off_t offset = fmt->ff_rsvdseccount;
int fatno;
int sectno;
uint8_t fatno;
uint32_t sectno;
int ret;
/* Loop for each FAT copy */

View File

@ -51,7 +51,7 @@ int netlib_parsehttpurl(FAR const char *url, FAR uint16_t *port,
{
FAR const char *src = url;
FAR char *dest;
int bytesleft;
size_t bytesleft;
int ret = OK;
size_t pathlen;

View File

@ -80,6 +80,8 @@
int telnetd_daemon(int argc, FAR char *argv[])
{
UNUSED(argc);
FAR struct telnetd_s *daemon;
union
{

View File

@ -788,6 +788,8 @@ static inline void help_allcmds(FAR struct nsh_vtbl_s *vtbl)
#ifndef CONFIG_NSH_DISABLE_HELP
static inline void help_builtins(FAR struct nsh_vtbl_s *vtbl)
{
UNUSED(vtbl);
#ifdef CONFIG_NSH_BUILTIN_APPS
FAR const struct builtin_s *builtin;
unsigned int builtins_per_line;
@ -968,6 +970,8 @@ static int cmd_help(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
static int cmd_unrecognized(FAR struct nsh_vtbl_s *vtbl, int argc,
char **argv)
{
UNUSED(argc);
nsh_error(vtbl, g_fmtcmdnotfound, argv[0]);
return ERROR;
}
@ -979,6 +983,10 @@ static int cmd_unrecognized(FAR struct nsh_vtbl_s *vtbl, int argc,
#ifndef CONFIG_NSH_DISABLESCRIPT
static int cmd_true(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(vtbl);
UNUSED(argc);
UNUSED(argv);
return OK;
}
@ -991,6 +999,10 @@ static int cmd_true(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#ifndef CONFIG_NSH_DISABLESCRIPT
static int cmd_false(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(vtbl);
UNUSED(argc);
UNUSED(argv);
return ERROR;
}
#endif
@ -1002,6 +1014,9 @@ static int cmd_false(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#ifndef CONFIG_NSH_DISABLE_EXIT
static int cmd_exit(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
UNUSED(argv);
nsh_exit(vtbl, 0);
return OK;
}
@ -1107,7 +1122,7 @@ int nsh_extmatch_count(FAR char *name, FAR int *matches, int namelen)
int nr_matches = 0;
int i;
for (i = 0; i < NUM_CMDS; i++)
for (i = 0; i < (int)NUM_CMDS; i++)
{
if (strncmp(name, g_cmdmap[i].cmd, namelen) == 0)
{

View File

@ -71,6 +71,8 @@ struct dbgmem_s
static int mem_parse(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv,
FAR struct dbgmem_s *mem)
{
UNUSED(vtbl);
FAR char *pcvalue = strchr(argv[1], '=');
unsigned long lvalue = 0;
@ -327,6 +329,8 @@ void nsh_dumpbuffer(FAR struct nsh_vtbl_s *vtbl, FAR const char *msg,
#ifndef CONFIG_NSH_DISABLE_XD
int cmd_xd(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
{
UNUSED(argc);
FAR char *addr;
FAR char *endptr;
int nbytes;
@ -493,6 +497,8 @@ int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
#ifdef HAVE_IRQINFO
int cmd_irqinfo(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
{
UNUSED(argc);
return nsh_catfile(vtbl, argv[0], CONFIG_NSH_PROC_MOUNTPOINT "/irqs");
}
#endif

View File

@ -155,6 +155,8 @@ static inline FAR const char *nsh_getwd(const char *wd)
static int nsh_dumpvar(FAR struct nsh_vtbl_s *vtbl, FAR void *arg,
FAR const char *pair)
{
UNUSED(arg);
nsh_output(vtbl, "%s\n", pair);
return OK;
}
@ -360,6 +362,8 @@ int cmd_echo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#ifndef CONFIG_NSH_DISABLE_ENV
int cmd_env(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
return nsh_catfile(vtbl, argv[0],
CONFIG_NSH_PROC_MOUNTPOINT "/self/group/env");
}
@ -373,6 +377,9 @@ int cmd_env(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#ifndef CONFIG_NSH_DISABLE_PWD
int cmd_pwd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
UNUSED(argv);
nsh_output(vtbl, "%s\n", nsh_getcwd());
return OK;
}
@ -531,6 +538,8 @@ int cmd_set(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#ifndef CONFIG_NSH_DISABLE_UNSET
int cmd_unset(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
#if defined(CONFIG_NSH_VARS) || !defined(CONFIG_DISABLE_ENVIRON)
int status;
#endif

View File

@ -399,6 +399,8 @@ int cmd_basename(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#ifndef CONFIG_NSH_DISABLE_DIRNAME
int cmd_dirname(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
FAR char *filename;
/* Usage: dirname <path>
@ -458,6 +460,8 @@ int cmd_cat(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#if defined(CONFIG_SYSLOG_DEVPATH) && !defined(CONFIG_NSH_DISABLE_DMESG)
int cmd_dmesg(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
return nsh_catfile(vtbl, argv[0], CONFIG_SYSLOG_DEVPATH);
}
#endif
@ -469,6 +473,8 @@ int cmd_dmesg(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#ifndef CONFIG_NSH_DISABLE_CP
int cmd_cp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
struct stat buf;
FAR char *srcpath = NULL;
FAR char *destpath = NULL;
@ -1269,6 +1275,7 @@ int cmd_mkfatfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
FAR char *fullpath;
bool badarg;
int option;
int rootdirentries;
int ret = ERROR;
/* mkfatfs [-F <fatsize>] <block-driver> */
@ -1289,8 +1296,12 @@ int cmd_mkfatfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
break;
case 'r':
fmt.ff_rootdirentries = atoi(optarg);
if (fmt.ff_rootdirentries < 0)
rootdirentries = atoi(optarg);
if (rootdirentries >= 0)
{
fmt.ff_rootdirentries = rootdirentries;
}
else
{
nsh_error(vtbl, g_fmtargrange, argv[0]);
badarg = true;
@ -1363,6 +1374,8 @@ int cmd_mkfatfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
!defined(CONFIG_NSH_DISABLE_MKFIFO)
int cmd_mkfifo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
FAR char *fullpath = nsh_getfullpath(vtbl, argv[1]);
int ret = ERROR;
@ -1584,6 +1597,8 @@ int cmd_mksmartfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#ifndef CONFIG_NSH_DISABLE_MV
int cmd_mv(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
FAR char *oldpath;
FAR char *newpath;
int ret;
@ -1631,6 +1646,8 @@ errout_with_oldpath:
#if !defined(CONFIG_NSH_DISABLE_READLINK) && defined(CONFIG_PSEUDOFS_SOFTLINKS)
int cmd_readlink(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
FAR char *fullpath;
ssize_t len;
@ -1725,6 +1742,8 @@ static int unlink_recursive(FAR char *path)
int cmd_rm(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
bool recursive = (strcmp(argv[1], "-r") == 0);
FAR char *fullpath = nsh_getfullpath(vtbl, recursive ? argv[2] : argv[1]);
char buf[PATH_MAX];
@ -1763,6 +1782,8 @@ int cmd_rm(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#ifndef CONFIG_NSH_DISABLE_RMDIR
int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
FAR char *fullpath = nsh_getfullpath(vtbl, argv[1]);
int ret = ERROR;
@ -1790,6 +1811,8 @@ int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#ifndef CONFIG_NSH_DISABLE_SOURCE
int cmd_source(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
return nsh_script(vtbl, argv[0], argv[1]);
}
#endif
@ -1802,6 +1825,8 @@ int cmd_source(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#ifndef CONFIG_NSH_DISABLE_CMP
int cmd_cmp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
FAR char *path1 = NULL;
FAR char *path2 = NULL;
off_t total_read = 0;
@ -1880,7 +1905,7 @@ int cmd_cmp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
/* A partial read indicates the end of file (usually) */
if (nbytesread1 < (size_t)sizeof(buf1))
if (nbytesread1 < (ssize_t)sizeof(buf1))
{
break;
}
@ -1913,6 +1938,8 @@ errout:
#ifndef CONFIG_NSH_DISABLE_TRUNCATE
int cmd_truncate(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
FAR char *fullpath;
FAR char *endptr;
struct stat buf;

View File

@ -39,6 +39,8 @@
int cmd_free(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
return nsh_catfile(vtbl, argv[0], CONFIG_NSH_PROC_MOUNTPOINT "/meminfo");
}

View File

@ -361,6 +361,8 @@ int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && !defined(CONFIG_NSH_DISABLE_UMOUNT)
int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
char *fullpath = nsh_getfullpath(vtbl, argv[1]);
int ret = ERROR;

View File

@ -44,6 +44,8 @@
int cmd_insmod(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
FAR void *handle;
/* Usage: insmod <filepath> <modulename> */
@ -66,6 +68,8 @@ int cmd_insmod(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
int cmd_rmmod(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
FAR void *handle;
int ret;
@ -99,6 +103,8 @@ int cmd_rmmod(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MODULE)
int cmd_lsmod(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
FILE *stream;
/* Usage: lsmod */

View File

@ -184,13 +184,13 @@ static inline void net_statistics(FAR struct nsh_vtbl_s *vtbl)
#if !defined(CONFIG_NSH_DISABLE_IFUPDOWN) || !defined(CONFIG_NSH_DISABLE_IFCONFIG)
static int ifconfig_callback(FAR struct nsh_vtbl_s *vtbl, FAR char *devname)
{
char buffer[IFNAMSIZ + 12];
char buffer[NAME_MAX + 12];
DEBUGASSERT(vtbl != NULL && devname != NULL);
/* Construct the full path to the /proc/net entry for this device */
snprintf(buffer, IFNAMSIZ + 12,
snprintf(buffer, NAME_MAX + 12,
CONFIG_NSH_PROC_MOUNTPOINT "/net/%s", devname);
nsh_catfile(vtbl, "ifconfig", buffer);

View File

@ -794,7 +794,7 @@ static FAR char *nsh_filecat(FAR struct nsh_vtbl_s *vtbl, FAR char *s1,
size_t allocsize;
ssize_t nbytesread;
FAR char *argument;
int index;
unsigned index;
int fd;
int ret;
@ -1186,7 +1186,7 @@ static FAR char *nsh_argexpand(FAR struct nsh_vtbl_s *vtbl,
while (len > 0 && *ptr != '\0')
{
FAR char *prev = working + len - 1;
int bcount;
unsigned bcount;
bool quoted;
/* Check if the current character is quoted */
@ -2740,6 +2740,9 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline)
#if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_LOOPS)
int cmd_break(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
UNUSED(argv);
FAR struct nsh_parser_s *np = &vtbl->np;
/* Break outside of a loop is ignored */

View File

@ -44,6 +44,8 @@
#ifndef CONFIG_NSH_DISABLE_USERADD
int cmd_useradd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
int ret;
ret = passwd_adduser(argv[1], argv[2]);
@ -65,6 +67,8 @@ int cmd_useradd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#ifndef CONFIG_NSH_DISABLE_USERDEL
int cmd_userdel(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
int ret;
ret = passwd_deluser(argv[1]);
@ -86,6 +90,8 @@ int cmd_userdel(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#ifndef CONFIG_NSH_DISABLE_PASSWD
int cmd_passwd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
int ret;
ret = passwd_update(argv[1], argv[2]);

View File

@ -226,6 +226,8 @@ static void nsh_parse_statusline(FAR char *line,
static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath,
FAR struct dirent *entryp, FAR void *pvarg)
{
UNUSED(pvarg);
struct nsh_taskstatus_s status;
FAR char *filepath;
FAR char *line;
@ -546,6 +548,8 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath,
#ifndef CONFIG_NSH_DISABLE_EXEC
int cmd_exec(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
{
UNUSED(argc);
FAR char *endptr;
uintptr_t addr;
@ -556,7 +560,7 @@ int cmd_exec(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
return ERROR;
}
nsh_output(vtbl, "Calling %p\n", (exec_t)addr);
nsh_output(vtbl, "Calling %p\n", (void*)addr);
return ((exec_t)addr)();
}
#endif
@ -568,6 +572,9 @@ int cmd_exec(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
#ifndef CONFIG_NSH_DISABLE_PS
int cmd_ps(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
UNUSED(argv);
nsh_output(vtbl, "%5s ", "PID");
nsh_output(vtbl, "%5s ", "GROUP");
@ -711,6 +718,8 @@ invalid_arg:
#ifndef CONFIG_NSH_DISABLE_SLEEP
int cmd_sleep(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
char *endptr;
long secs;
@ -733,6 +742,8 @@ int cmd_sleep(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#ifndef CONFIG_NSH_DISABLE_USLEEP
int cmd_usleep(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
char *endptr;
long usecs;

View File

@ -349,6 +349,8 @@ int cmd_reboot(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#if defined(CONFIG_BOARDCTL_RESET_CAUSE) && !defined(CONFIG_NSH_DISABLE_RESET_CAUSE)
int cmd_reset_cause(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
int ret;
struct boardioc_reset_cause_s cause;

View File

@ -68,6 +68,9 @@ enum telnetd_state_e
int nsh_telnetmain(int argc, FAR char *argv[])
{
UNUSED(argc);
UNUSED(argv);
FAR struct console_stdio_s *pstate = nsh_newconsole(true);
FAR struct nsh_vtbl_s *vtbl;
int ret;
@ -353,6 +356,10 @@ int nsh_telnetstart(sa_family_t family)
#ifndef CONFIG_NSH_DISABLE_TELNETD
int cmd_telnetd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(vtbl);
UNUSED(argc);
UNUSED(argv);
sa_family_t family = AF_UNSPEC;
/* If both IPv6 and IPv4 are enabled, then the address family must

View File

@ -76,6 +76,8 @@
static inline int binaryexpression(FAR struct nsh_vtbl_s *vtbl, char **argv)
{
UNUSED(vtbl);
char *endptr;
long integer1;
long integer2;

View File

@ -291,6 +291,8 @@ errout_bad_parm:
#ifndef CONFIG_NSH_DISABLE_TIME
int cmd_time(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
UNUSED(argc);
struct timespec start;
#ifndef CONFIG_NSH_DISABLEBG
bool bgsave;

View File

@ -67,7 +67,9 @@ struct cmdhist_s
/* <esc>[K is the VT100 command erases to the end of the line. */
#ifdef CONFIG_READLINE_ECHO
static const char g_erasetoeol[] = VT100_CLEAREOL;
#endif
#ifdef CONFIG_READLINE_TABCOMPLETION
/* Prompt string to present at the beginning of the line */
@ -280,13 +282,13 @@ static void tab_completion(FAR struct rl_common_s *vtbl, char *buf,
RL_PUTC(vtbl, ' ');
RL_PUTC(vtbl, ' ');
for (j = 0; j < strlen(name); j++)
for (j = 0; j < (int)strlen(name); j++)
{
/* Removing characters that aren't common to all the
* matches.
*/
if (j < sizeof(tmp_name) && name[j] != tmp_name[j])
if (j < (int)sizeof(tmp_name) && name[j] != tmp_name[j])
{
tmp_name[j] = '\0';
}
@ -341,7 +343,7 @@ static void tab_completion(FAR struct rl_common_s *vtbl, char *buf,
if (g_readline_prompt != NULL)
{
for (i = 0; i < strlen(g_readline_prompt); i++)
for (i = 0; i < (int)strlen(g_readline_prompt); i++)
{
RL_PUTC(vtbl, g_readline_prompt[i]);
}

View File

@ -188,6 +188,8 @@ static void readline_write(FAR struct rl_common_s *vtbl,
ssize_t readline_fd(FAR char *buf, int buflen, int infd, int outfd)
{
UNUSED(outfd);
struct readline_s vtbl;
/* Set up the vtbl structure */