nuttx: use sizeof instead of define or number in snprintf

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko
2024-08-24 12:54:12 -04:00
committed by Xiang Xiao
parent dd7ecd9aef
commit d252b6229f
83 changed files with 114 additions and 110 deletions
@@ -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" */
+1 -1
View File
@@ -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)
{