mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 23:40:19 +08:00
nuttx: use sizeof instead of define or number in snprintf
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
committed by
Xiang Xiao
parent
dd7ecd9aef
commit
d252b6229f
@@ -94,7 +94,7 @@ int board_bmp180_initialize(int devno, int busno)
|
||||
{
|
||||
/* Then try to register the barometer sensor in I2C0 */
|
||||
|
||||
snprintf(devpath, 12, "/dev/press%d", devno);
|
||||
snprintf(devpath, sizeof(devpath), "/dev/press%d", devno);
|
||||
ret = bmp180_register(devpath, i2c);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
||||
@@ -137,7 +137,7 @@ int esp32_cs4344_initialize(int port)
|
||||
|
||||
/* Create a device name */
|
||||
|
||||
snprintf(devname, 12, "pcm%d", port);
|
||||
snprintf(devname, sizeof(devname), "pcm%d", port);
|
||||
|
||||
/* Finally, we can register the PCM/CS4344/I2S audio device.
|
||||
*
|
||||
|
||||
@@ -85,7 +85,7 @@ int board_lcd_backpack_init(int devno, int busno, int rows, int cols)
|
||||
|
||||
/* Register the Segment LCD */
|
||||
|
||||
snprintf(devpath, 12, "/dev/slcd%d", devno);
|
||||
snprintf(devpath, sizeof(devpath), "/dev/slcd%d", devno);
|
||||
ret = pcf8574_lcd_backpack_register(devpath, i2c, &cfg);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
||||
@@ -242,7 +242,7 @@ int board_mcp2515_initialize(int devno)
|
||||
|
||||
/* Create the '/dev/canX' name based on 'devno' */
|
||||
|
||||
snprintf(devpath, 10, "/dev/can%d", devno);
|
||||
snprintf(devpath, sizeof(devpath), "/dev/can%d", devno);
|
||||
|
||||
/* Register the CAN driver at "/dev/can0" */
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ int board_sht3x_initialize(int devno, int busno)
|
||||
{
|
||||
/* Then try to register the sensor in I2C Bus */
|
||||
|
||||
snprintf(devpath, 12, "/dev/temp%d", devno);
|
||||
snprintf(devpath, sizeof(devpath), "/dev/temp%d", devno);
|
||||
ret = sht3x_register(devpath, i2c, SHT3X_I2CADDR);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user