nuttx: improve C89 compatibility in common code
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
parent
e85afaf6cf
commit
c70b7f6b3d
@ -501,9 +501,11 @@ static void es8388_setvolume(FAR struct es8388_dev_s *priv,
|
||||
|
||||
static void es8388_setmclkfrequency(FAR struct es8388_dev_s *priv)
|
||||
{
|
||||
int i;
|
||||
|
||||
priv->mclk = 0;
|
||||
|
||||
for (int i = 0; i < nitems(es8388_mclk_rate); i++)
|
||||
for (i = 0; i < nitems(es8388_mclk_rate); i++)
|
||||
{
|
||||
if (es8388_mclk_rate[i].sample_rate == priv->samprate)
|
||||
{
|
||||
|
@ -139,10 +139,11 @@ static void lcddrv_spiif_deselect(FAR struct lcddrv_lcd_s *lcd)
|
||||
static int lcddrv_spiif_sendmulti(FAR struct lcddrv_lcd_s *lcd,
|
||||
FAR const uint16_t *wd, uint32_t nwords)
|
||||
{
|
||||
uint32_t t;
|
||||
FAR struct lcddrv_spiif_lcd_s *priv = (FAR struct lcddrv_spiif_lcd_s *)lcd;
|
||||
|
||||
SPI_SETBITS(priv->spi, 16);
|
||||
for (uint32_t t = 0; t < nwords; t++)
|
||||
for (t = 0; t < nwords; t++)
|
||||
{
|
||||
SPI_SEND(priv->spi, *wd++);
|
||||
}
|
||||
|
@ -335,10 +335,11 @@ static int fakesensor_thread(int argc, char** argv)
|
||||
if (sensor->batch)
|
||||
{
|
||||
uint32_t batch_num = sensor->batch / sensor->interval;
|
||||
|
||||
uint64_t event_timestamp =
|
||||
sensor_get_timestamp() - sensor->interval * batch_num;
|
||||
for (int i = 0; i < batch_num; i++)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < batch_num; i++)
|
||||
{
|
||||
fakesensor_push_event(&sensor->lower, event_timestamp);
|
||||
event_timestamp += sensor->interval;
|
||||
|
@ -863,10 +863,14 @@ size_t iconv(iconv_t cd, FAR char **in, FAR size_t *inb,
|
||||
c += 128;
|
||||
for (d = 0; d <= c; )
|
||||
{
|
||||
int i;
|
||||
|
||||
k = 0;
|
||||
for (int i = 0; i < 126; i++)
|
||||
for (i = 0; i < 126; i++)
|
||||
{
|
||||
for (int j = 0; j < 190; j++)
|
||||
int j;
|
||||
|
||||
for (j = 0; j < 190; j++)
|
||||
{
|
||||
if (g_gb18030[i][j] - d <= c - d)
|
||||
{
|
||||
@ -1060,10 +1064,14 @@ size_t iconv(iconv_t cd, FAR char **in, FAR size_t *inb,
|
||||
c += 0xac00;
|
||||
for (d = 0xac00; d <= c; )
|
||||
{
|
||||
int i;
|
||||
|
||||
k = 0;
|
||||
for (int i = 0; i < 93; i++)
|
||||
for (i = 0; i < 93; i++)
|
||||
{
|
||||
for (int j = 0; j < 94; j++)
|
||||
int j;
|
||||
|
||||
for (j = 0; j < 94; j++)
|
||||
{
|
||||
if (g_ksc[i][j] - d <= c - d)
|
||||
{
|
||||
|
@ -123,6 +123,7 @@ int can_getsockopt(FAR struct socket *psock, int level, int option,
|
||||
else
|
||||
{
|
||||
int count = conn->filter_count;
|
||||
int i;
|
||||
|
||||
if (*value_len < count * sizeof(struct can_filter))
|
||||
{
|
||||
@ -133,9 +134,9 @@ int can_getsockopt(FAR struct socket *psock, int level, int option,
|
||||
*value_len = count * sizeof(struct can_filter);
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
((struct can_filter *)value)[i] = conn->filters[i];
|
||||
((FAR struct can_filter *)value)[i] = conn->filters[i];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -138,9 +138,11 @@ int can_setsockopt(FAR struct socket *psock, int level, int option,
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
count = value_len / sizeof(struct can_filter);
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
conn->filters[i] = ((struct can_filter *)value)[i];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user