Silence some warnings

This commit is contained in:
Paul A. Patience 2016-05-26 12:01:15 -04:00
parent b36d125e33
commit f8f7b7582c
12 changed files with 100 additions and 73 deletions

View file

@ -65,15 +65,18 @@ static int devnull_poll(FAR struct file *filep, FAR struct pollfd *fds,
static const struct file_operations devnull_fops =
{
0, /* open */
0, /* close */
NULL, /* open */
NULL, /* close */
devnull_read, /* read */
devnull_write, /* write */
0, /* seek */
0 /* ioctl */
NULL, /* seek */
NULL /* ioctl */
#ifndef CONFIG_DISABLE_POLL
, devnull_poll /* poll */
#endif
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */
#endif
};
/****************************************************************************

View file

@ -65,15 +65,18 @@ static int devzero_poll(FAR struct file *filep, FAR struct pollfd *fds,
static const struct file_operations devzero_fops =
{
0, /* open */
0, /* close */
NULL, /* open */
NULL, /* close */
devzero_read, /* read */
devzero_write, /* write */
0, /* seek */
0 /* ioctl */
NULL, /* seek */
NULL /* ioctl */
#ifndef CONFIG_DISABLE_POLL
, devzero_poll /* poll */
#endif
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */
#endif
};
/****************************************************************************

View file

@ -140,12 +140,15 @@ static const struct file_operations userled_fops =
{
userled_open, /* open */
userled_close, /* close */
0, /* read */
NULL, /* read */
userled_write, /* write */
0, /* seek */
NULL, /* seek */
userled_ioctl /* ioctl */
#ifndef CONFIG_DISABLE_POLL
, 0 /* poll */
, NULL /* poll */
#endif
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */
#endif
};
@ -441,7 +444,7 @@ static int userled_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
/* Check that a valid LED is being set */
if (led < 8 * sizeof(userled_set_t) &&
if ((size_t)led < 8 * sizeof(userled_set_t) &&
(priv->lu_supported & (1 << led)) != 0)
{
/* Update the LED state */

View file

@ -107,16 +107,19 @@ static int loop_geometry(FAR struct inode *inode,
static const struct block_operations g_bops =
{
loop_open, /* open */
loop_close, /* close */
loop_read, /* read */
loop_open, /* open */
loop_close, /* close */
loop_read, /* read */
#ifdef CONFIG_FS_WRITABLE
loop_write, /* write */
loop_write, /* write */
#else
NULL, /* write */
NULL, /* write */
#endif
loop_geometry, /* geometry */
NULL /* ioctl */
NULL /* ioctl */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */
#endif
};
/****************************************************************************

View file

@ -92,7 +92,7 @@ static void pipecommon_semtake(sem_t *sem);
* Name: pipecommon_semtake
****************************************************************************/
static void pipecommon_semtake(sem_t *sem)
static void pipecommon_semtake(FAR sem_t *sem)
{
while (sem_wait(sem) != 0)
{
@ -109,7 +109,8 @@ static void pipecommon_semtake(sem_t *sem)
****************************************************************************/
#ifndef CONFIG_DISABLE_POLL
static void pipecommon_pollnotify(FAR struct pipe_dev_s *dev, pollevent_t eventset)
static void pipecommon_pollnotify(FAR struct pipe_dev_s *dev,
pollevent_t eventset)
{
int i;
@ -120,7 +121,7 @@ static void pipecommon_pollnotify(FAR struct pipe_dev_s *dev, pollevent_t events
for (i = 0; i < CONFIG_DEV_PIPE_NPOLLWAITERS; i++)
{
struct pollfd *fds = dev->d_fds[i];
FAR struct pollfd *fds = dev->d_fds[i];
if (fds)
{
fds->revents |= eventset & (fds->events | POLLERR | POLLHUP);
@ -158,7 +159,7 @@ FAR struct pipe_dev_s *pipecommon_allocdev(void)
/* Allocate a private structure to manage the pipe */
dev = (struct pipe_dev_s *)kmm_malloc(sizeof(struct pipe_dev_s));
dev = (FAR struct pipe_dev_s *)kmm_malloc(sizeof(struct pipe_dev_s));
if (dev)
{
/* Initialize the private structure */
@ -190,10 +191,10 @@ void pipecommon_freedev(FAR struct pipe_dev_s *dev)
int pipecommon_open(FAR struct file *filep)
{
FAR struct inode *inode = filep->f_inode;
FAR struct pipe_dev_s *dev = inode->i_private;
int sval;
int ret;
FAR struct inode *inode = filep->f_inode;
FAR struct pipe_dev_s *dev = inode->i_private;
int sval;
int ret;
DEBUGASSERT(dev != NULL);
@ -302,9 +303,9 @@ int pipecommon_open(FAR struct file *filep)
int pipecommon_close(FAR struct file *filep)
{
struct inode *inode = filep->f_inode;
struct pipe_dev_s *dev = inode->i_private;
int sval;
FAR struct inode *inode = filep->f_inode;
FAR struct pipe_dev_s *dev = inode->i_private;
int sval;
DEBUGASSERT(dev && dev->d_refs > 0);
@ -408,14 +409,14 @@ int pipecommon_close(FAR struct file *filep)
ssize_t pipecommon_read(FAR struct file *filep, FAR char *buffer, size_t len)
{
struct inode *inode = filep->f_inode;
struct pipe_dev_s *dev = inode->i_private;
FAR struct inode *inode = filep->f_inode;
FAR struct pipe_dev_s *dev = inode->i_private;
#ifdef CONFIG_DEV_PIPEDUMP
FAR uint8_t *start = (FAR uint8_t *)buffer;
FAR uint8_t *start = (FAR uint8_t *)buffer;
#endif
ssize_t nread = 0;
int sval;
int ret;
ssize_t nread = 0;
int sval;
int ret;
DEBUGASSERT(dev);
@ -467,7 +468,7 @@ ssize_t pipecommon_read(FAR struct file *filep, FAR char *buffer, size_t len)
/* Then return whatever is available in the pipe (which is at least one byte) */
nread = 0;
while (nread < len && dev->d_wrndx != dev->d_rdndx)
while ((size_t)nread < len && dev->d_wrndx != dev->d_rdndx)
{
*buffer++ = dev->d_buffer[dev->d_rdndx];
if (++dev->d_rdndx >= CONFIG_DEV_PIPE_SIZE)
@ -497,14 +498,15 @@ ssize_t pipecommon_read(FAR struct file *filep, FAR char *buffer, size_t len)
* Name: pipecommon_write
****************************************************************************/
ssize_t pipecommon_write(FAR struct file *filep, FAR const char *buffer, size_t len)
ssize_t pipecommon_write(FAR struct file *filep, FAR const char *buffer,
size_t len)
{
struct inode *inode = filep->f_inode;
struct pipe_dev_s *dev = inode->i_private;
ssize_t nwritten = 0;
ssize_t last;
int nxtwrndx;
int sval;
FAR struct inode *inode = filep->f_inode;
FAR struct pipe_dev_s *dev = inode->i_private;
ssize_t nwritten = 0;
ssize_t last;
int nxtwrndx;
int sval;
DEBUGASSERT(dev);
pipe_dumpbuffer("To PIPE:", (FAR uint8_t *)buffer, len);
@ -559,7 +561,8 @@ ssize_t pipecommon_write(FAR struct file *filep, FAR const char *buffer, size_t
/* Is the write complete? */
if (++nwritten >= len)
nwritten++;
if ((size_t)nwritten >= len)
{
/* Yes.. Notify all of the waiting readers that more data is available */
@ -717,7 +720,7 @@ int pipecommon_poll(FAR struct file *filep, FAR struct pollfd *fds,
{
/* This is a request to tear down the poll. */
struct pollfd **slot = (struct pollfd **)fds->priv;
FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv;
#ifdef CONFIG_DEBUG
if (!slot)
@ -745,9 +748,9 @@ errout:
int pipecommon_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
{
FAR struct inode *inode = filep->f_inode;
struct pipe_dev_s *dev = inode->i_private;
int ret = -EINVAL;
FAR struct inode *inode = filep->f_inode;
FAR struct pipe_dev_s *dev = inode->i_private;
int ret = -EINVAL;
#ifdef CONFIG_DEBUG
/* Some sanity checking */
@ -792,7 +795,7 @@ int pipecommon_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
count = dev->d_wrndx - dev->d_rdndx;
}
*(int *)arg = count;
*(FAR int *)arg = count;
ret = 0;
}
break;
@ -812,7 +815,7 @@ int pipecommon_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
count = ((CONFIG_DEV_PIPE_SIZE - dev->d_wrndx) + dev->d_rdndx) - 1;
}
*(int *)arg = count;
*(FAR int *)arg = count;
ret = 0;
}
break;

View file

@ -70,14 +70,17 @@ static int lowconsole_ioctl(struct file *filep, int cmd, unsigned long arg);
static const struct file_operations g_consoleops =
{
0, /* open */
0, /* close */
NULL, /* open */
NULL, /* close */
lowconsole_read, /* read */
lowconsole_write, /* write */
0, /* seek */
NULL, /* seek */
lowconsole_ioctl /* ioctl */
#ifndef CONFIG_DISABLE_POLL
, 0 /* poll */
, NULL /* poll */
#endif
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */
#endif
};

View file

@ -103,6 +103,9 @@ static const struct file_operations g_serialops =
#ifndef CONFIG_DISABLE_POLL
, uart_poll /* poll */
#endif
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */
#endif
};
/************************************************************************************
@ -487,7 +490,7 @@ static ssize_t uart_write(FAR struct file *filep, FAR const char *buffer,
* interrupted transfer.
*/
if (buflen < nwritten)
if (buflen < (size_t)nwritten)
{
/* Some data was transferred. Return the number of bytes that
* were successfully transferred.
@ -557,7 +560,7 @@ static ssize_t uart_read(FAR struct file *filep, FAR char *buffer, size_t buflen
* data from the end of the buffer.
*/
while (recvd < buflen)
while ((size_t)recvd < buflen)
{
#ifdef CONFIG_SERIAL_REMOVABLE
/* If the removable device is no longer connected, refuse to read any

View file

@ -123,14 +123,17 @@ static int ramlog_poll(FAR struct file *filep, FAR struct pollfd *fds,
static const struct file_operations g_ramlogfops =
{
0, /* open */
0, /* close */
ramlog_read, /* read */
ramlog_write, /* write */
0, /* seek */
0 /* ioctl */
NULL, /* open */
NULL, /* close */
ramlog_read, /* read */
ramlog_write, /* write */
NULL, /* seek */
NULL /* ioctl */
#ifndef CONFIG_DISABLE_POLL
, ramlog_poll /* poll */
, ramlog_poll /* poll */
#endif
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */
#endif
};
@ -206,7 +209,7 @@ static void ramlog_pollnotify(FAR struct ramlog_dev_s *priv,
static int ramlog_addchar(FAR struct ramlog_dev_s *priv, char ch)
{
irqstate_t flags;
int nexthead;
size_t nexthead;
/* Disable interrupts (in case we are NOT called from interrupt handler) */
@ -271,7 +274,7 @@ static ssize_t ramlog_read(FAR struct file *filep, FAR char *buffer, size_t len)
/* Loop until something is read */
for (nread = 0; nread < len; )
for (nread = 0; (size_t)nread < len; )
{
/* Get the next byte from the buffer */
@ -437,7 +440,7 @@ static ssize_t ramlog_write(FAR struct file *filep, FAR const char *buffer, size
* interrupts.
*/
for (nwritten = 0; nwritten < len; nwritten++)
for (nwritten = 0; (size_t)nwritten < len; nwritten++)
{
/* Get the next character to output */
@ -529,7 +532,7 @@ int ramlog_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
FAR struct inode *inode = filep->f_inode;
FAR struct ramlog_dev_s *priv;
pollevent_t eventset;
int ndx;
size_t ndx;
int ret;
int i;

View file

@ -114,10 +114,13 @@ static const struct file_operations g_timerops =
timer_close, /* close */
timer_read, /* read */
timer_write, /* write */
0, /* seek */
NULL, /* seek */
timer_ioctl /* ioctl */
#ifndef CONFIG_DISABLE_POLL
, 0 /* poll */
, NULL /* poll */
#endif
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */
#endif
};

View file

@ -73,7 +73,7 @@ FAR char *strcasestr(FAR const char *str, FAR const char *substr)
{
FAR const char *candidate; /* Candidate in str with matching start character */
char ch; /* First character of the substring */
int len; /* The length of the substring */
size_t len; /* The length of the substring */
/* Special case the empty substring */

View file

@ -49,7 +49,7 @@ FAR char *strstr(FAR const char *str, FAR const char *substr)
{
FAR const char *candidate; /* Candidate in str with matching start character */
char ch; /* First character of the substring */
int len; /* The length of the substring */
size_t len; /* The length of the substring */
/* Special case the empty substring */

View file

@ -74,9 +74,9 @@ void mm_extend(FAR struct mm_heap_s *heap, FAR void *mem, size_t size,
DEBUGASSERT(heap && mem);
#if CONFIG_MM_REGIONS > 1
DEBUGASSERT(size >= MIN_EXTEND && (unsigned)region < heap->mm_nregions);
DEBUGASSERT(size >= MIN_EXTEND && (size_t)region < (size_t)heap->mm_nregions);
#else
DEBUGASSERT(size >= MIN_EXTEND && (unsigned)region == 0);
DEBUGASSERT(size >= MIN_EXTEND && region == 0);
#endif
/* Make sure that the memory region are properly aligned */