Skip to content

Commit

Permalink
Fixed compiler warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fotis Panagiotopoulos authored and xiaoxiang781216 committed Aug 22, 2022
1 parent d1cbbcd commit 0cdb2cf
Show file tree
Hide file tree
Showing 21 changed files with 128 additions and 18 deletions.
6 changes: 4 additions & 2 deletions fsutils/mkfatfs/configfat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions fsutils/mkfatfs/writefat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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" */
Expand Down Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion netutils/netlib/netlib_parsehttpurl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions netutils/telnetd/telnetd_daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@

int telnetd_daemon(int argc, FAR char *argv[])
{
UNUSED(argc);

FAR struct telnetd_s *daemon;
union
{
Expand Down
17 changes: 16 additions & 1 deletion nshlib/nsh_command.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}

Expand All @@ -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
Expand All @@ -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;
}
Expand Down Expand Up @@ -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)
{
Expand Down
6 changes: 6 additions & 0 deletions nshlib/nsh_dbgcmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
9 changes: 9 additions & 0 deletions nshlib/nsh_envcmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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");
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down
33 changes: 30 additions & 3 deletions nshlib/nsh_fscmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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> */
Expand All @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1631,6 +1646,8 @@ int cmd_mv(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#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;

Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -1913,6 +1938,8 @@ int cmd_cmp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#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;
Expand Down
2 changes: 2 additions & 0 deletions nshlib/nsh_mmcmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down
2 changes: 2 additions & 0 deletions nshlib/nsh_mntcmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 6 additions & 0 deletions nshlib/nsh_modcmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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> */
Expand All @@ -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;

Expand Down Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions nshlib/nsh_netcmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Loading

0 comments on commit 0cdb2cf

Please sign in to comment.