mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 05:03:35 +08:00
Fix many format strings.
Fixes these invalid format strings:
- A `%d` for a pointer (replaced it by `%p`)
- A 0x%08x (and a 0x%0x8!) for a pointer (replaced by %p)
- 2 cases of `%d` for a `ssize_t` (replaced it by `%zi`)
- 1 case of a %u for an `int` (replaced by %i)
- 3 cases of %d for a `long` (replaced by %ld)
- 19 cases of `%d`, `%i`, `%u` or `%lu` for a `size_t` (replaced it by `%zu`)
- An unused formatting argument (removed it)
- A missing `%d` (added it)
- A missing `%s` (added it)
- 2 cases of `%llu` for a `uint64_t` (replaced it by `"%" PRIu64`)
- 6 cases of giving a string directly as format string (replaced it by `("%s", string)`)
- 2 cases of %*-s, which should probably have been %-*s.
(Looks like NuttX accepts (the invalid) %*-s, but other platforms don't.)
- A %04x for a `uint32_t` (replaced by "%04" PRIx32)
This commit is contained in:
@@ -128,7 +128,7 @@ int start(enum BATT_SMBUS_BUS busid)
|
||||
|
||||
if (busid == BATT_SMBUS_BUS_ALL && bus_options[i].dev != nullptr) {
|
||||
// This device is already started.
|
||||
PX4_INFO("Smart battery %d already started", bus_options[i].dev);
|
||||
PX4_INFO("Smart battery %p already started", bus_options[i].dev);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -853,7 +853,7 @@ test()
|
||||
sz = read(fd, &report, sizeof(report));
|
||||
|
||||
if (sz != sizeof(report)) {
|
||||
PX4_ERR("read failed: got %d vs exp. %d", sz, sizeof(report));
|
||||
PX4_ERR("read failed: got %zi vs exp. %zu", sz, sizeof(report));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -822,7 +822,7 @@ test()
|
||||
sz = px4_read(fd, &report, sizeof(report));
|
||||
|
||||
if (sz != sizeof(report)) {
|
||||
PX4_ERR("read failed: got %d vs exp. %d", sz, sizeof(report));
|
||||
PX4_ERR("read failed: got %zi vs exp. %zu", sz, sizeof(report));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -3182,7 +3182,7 @@ test(void)
|
||||
ret = write(fd, servos, sizeof(servos));
|
||||
|
||||
if (ret != (int)sizeof(servos)) {
|
||||
err(1, "error writing PWM servo data, wrote %lu got %d", sizeof(servos), ret);
|
||||
err(1, "error writing PWM servo data, wrote %zu got %d", sizeof(servos), ret);
|
||||
}
|
||||
|
||||
if (direction > 0) {
|
||||
|
||||
@@ -778,19 +778,19 @@ int frsky_telemetry_main(int argc, char *argv[])
|
||||
case SPORT:
|
||||
PX4_INFO("running: SPORT");
|
||||
PX4_INFO("port: %s", device_name);
|
||||
PX4_INFO("packets sent: %d", sentPackets);
|
||||
PX4_INFO("packets sent: %ld", sentPackets);
|
||||
break;
|
||||
|
||||
case SPORT_SINGLE_WIRE:
|
||||
PX4_INFO("running: SPORT (single wire)");
|
||||
PX4_INFO("port: %s", device_name);
|
||||
PX4_INFO("packets sent: %d", sentPackets);
|
||||
PX4_INFO("packets sent: %ld", sentPackets);
|
||||
break;
|
||||
|
||||
case DTYPE:
|
||||
PX4_INFO("running: DTYPE");
|
||||
PX4_INFO("port: %s", device_name);
|
||||
PX4_INFO("packets sent: %d", sentPackets);
|
||||
PX4_INFO("packets sent: %ld", sentPackets);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user