Skip to content

Commit ab779f4

Browse files
committed
Fix printf format specifiers and code style
Replace %d with %u for unsigned types across multiple files, add explicit static_cast<unsigned> casts for printf arguments, remove redundant 'private:' sections, add [[nodiscard]] attributes, fix inline constexpr usage, improve code formatting (brace style, variable declarations), and minor refactoring (rename single-letter variables to descriptive names).
1 parent 7e55b68 commit ab779f4

26 files changed

Lines changed: 215 additions & 180 deletions

File tree

lib-ddp/src/ddpdisplay.cpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,28 @@ static constexpr char kStart[] = "{\"status\":{\"update\":\"change\",\"state\":\
4444
static constexpr char kDiscoverReply[] = "{\"status\":{\"man\":\"%s\",\"mod\":\"Pixel\",\"ver\":\"1.0\",\"mac\":\"%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\"}}";
4545
static constexpr char kConfigReply[] =
4646
"{\"config\":{\"ip\":\"%d.%d.%d.%d\",\"nm\":\"%d.%d.%d.%d\",\"gw\":\"%d.%d.%d.%d\",\"ports\":["
47-
"{\"port\":\"0\",\"ts\":\"0\",\"l\":\"%d\",\"ss\":\"0\"},"
48-
"{\"port\":\"1\",\"ts\":\"0\",\"l\":\"%d\",\"ss\":\"0\"},"
49-
"{\"port\":\"2\",\"ts\":\"0\",\"l\":\"%d\",\"ss\":\"0\"},"
50-
"{\"port\":\"3\",\"ts\":\"0\",\"l\":\"%d\",\"ss\":\"0\"},"
47+
"{\"port\":\"0\",\"ts\":\"0\",\"l\":\"%u\",\"ss\":\"0\"},"
48+
"{\"port\":\"1\",\"ts\":\"0\",\"l\":\"%u\",\"ss\":\"0\"},"
49+
"{\"port\":\"2\",\"ts\":\"0\",\"l\":\"%u\",\"ss\":\"0\"},"
50+
"{\"port\":\"3\",\"ts\":\"0\",\"l\":\"%u\",\"ss\":\"0\"},"
5151
#if CONFIG_DMXNODE_PIXEL_MAX_PORTS > 2
52-
"{\"port\":\"4\",\"ts\":\"0\",\"l\":\"%d\",\"ss\":\"0\"},"
53-
"{\"port\":\"5\",\"ts\":\"0\",\"l\":\"%d\",\"ss\":\"0\"},"
54-
"{\"port\":\"6\",\"ts\":\"0\",\"l\":\"%d\",\"ss\":\"0\"},"
55-
"{\"port\":\"7\",\"ts\":\"0\",\"l\":\"%d\",\"ss\":\"0\"},"
56-
"{\"port\":\"8\",\"ts\":\"0\",\"l\":\"%d\",\"ss\":\"0\"},"
57-
"{\"port\":\"9\",\"ts\":\"0\",\"l\":\"%d\",\"ss\":\"0\"}"
52+
"{\"port\":\"4\",\"ts\":\"0\",\"l\":\"%u\",\"ss\":\"0\"},"
53+
"{\"port\":\"5\",\"ts\":\"0\",\"l\":\"%u\",\"ss\":\"0\"},"
54+
"{\"port\":\"6\",\"ts\":\"0\",\"l\":\"%u\",\"ss\":\"0\"},"
55+
"{\"port\":\"7\",\"ts\":\"0\",\"l\":\"%u\",\"ss\":\"0\"},"
56+
"{\"port\":\"8\",\"ts\":\"0\",\"l\":\"%u\",\"ss\":\"0\"},"
57+
"{\"port\":\"9\",\"ts\":\"0\",\"l\":\"%u\",\"ss\":\"0\"}"
5858
#endif
5959
#if CONFIG_DMXNODE_PIXEL_MAX_PORTS == 16
6060
","
61-
"{\"port\":\"10\",\"ts\":\"0\",\"l\":\"%d\",\"ss\":\"0\"},"
62-
"{\"port\":\"11\",\"ts\":\"0\",\"l\":\"%d\",\"ss\":\"0\"},"
63-
"{\"port\":\"12\",\"ts\":\"0\",\"l\":\"%d\",\"ss\":\"0\"},"
64-
"{\"port\":\"13\",\"ts\":\"0\",\"l\":\"%d\",\"ss\":\"0\"},"
65-
"{\"port\":\"14\",\"ts\":\"0\",\"l\":\"%d\",\"ss\":\"0\"},"
66-
"{\"port\":\"15\",\"ts\":\"0\",\"l\":\"%d\",\"ss\":\"0\"},"
67-
"{\"port\":\"16\",\"ts\":\"0\",\"l\":\"%d\",\"ss\":\"0\"},"
68-
"{\"port\":\"17\",\"ts\":\"0\",\"l\":\"%d\",\"ss\":\"0\"}"
61+
"{\"port\":\"10\",\"ts\":\"0\",\"l\":\"%u\",\"ss\":\"0\"},"
62+
"{\"port\":\"11\",\"ts\":\"0\",\"l\":\"%u\",\"ss\":\"0\"},"
63+
"{\"port\":\"12\",\"ts\":\"0\",\"l\":\"%u\",\"ss\":\"0\"},"
64+
"{\"port\":\"13\",\"ts\":\"0\",\"l\":\"%u\",\"ss\":\"0\"},"
65+
"{\"port\":\"14\",\"ts\":\"0\",\"l\":\"%u\",\"ss\":\"0\"},"
66+
"{\"port\":\"15\",\"ts\":\"0\",\"l\":\"%u\",\"ss\":\"0\"},"
67+
"{\"port\":\"16\",\"ts\":\"0\",\"l\":\"%u\",\"ss\":\"0\"},"
68+
"{\"port\":\"17\",\"ts\":\"0\",\"l\":\"%u\",\"ss\":\"0\"}"
6969

7070
#endif
7171
"]}}";
@@ -180,15 +180,15 @@ void DdpDisplay::HandleQuery() {
180180

181181
const auto kLength =
182182
static_cast<uint32_t>(snprintf(reinterpret_cast<char*>(packet->data), network::udp::kDataSize - 1, json::kConfigReply, IP2STR(network::GetPrimaryIp()), IP2STR(network::GetNetmask()), IP2STR(network::GetGatewayIp()),
183-
active_ports_ > 0 ? count_ : 0, active_ports_ > 1 ? count_ : 0,
183+
active_ports_ > 0 ? static_cast<unsigned>(count_) : 0, active_ports_ > 1 ? static_cast<unsigned>(count_) : 0,
184184
#if CONFIG_DMXNODE_PIXEL_MAX_PORTS > 2
185-
active_ports_ > 2 ? count_ : 0, active_ports_ > 3 ? count_ : 0, active_ports_ > 4 ? count_ : 0, active_ports_ > 5 ? count_ : 0, active_ports_ > 6 ? count_ : 0, active_ports_ > 7 ? count_ : 0,
185+
active_ports_ > 2 ? static_cast<unsigned>(count_) : 0, active_ports_ > 3 ? static_cast<unsigned>(count_) : 0, active_ports_ > 4 ? static_cast<unsigned>(count_) : 0, active_ports_ > 5 ? static_cast<unsigned>(count_) : 0, active_ports_ > 6 ? static_cast<unsigned>(count_) : 0, active_ports_ > 7 ? static_cast<unsigned>(count_) : 0,
186186
#endif
187187
#if CONFIG_DMXNODE_PIXEL_MAX_PORTS == 16
188-
active_ports_ > 8 ? count_ : 0, active_ports_ > 9 ? count_ : 0, active_ports_ > 10 ? count_ : 0, active_ports_ > 11 ? count_ : 0, active_ports_ > 12 ? count_ : 0, active_ports_ > 13 ? count_ : 0,
189-
active_ports_ > 14 ? count_ : 0, active_ports_ > 15 ? count_ : 0,
188+
active_ports_ > 8 ? static_cast<unsigned>(count_) : 0, active_ports_ > 9 ? static_cast<unsigned>(count_) : 0, active_ports_ > 10 ? static_cast<unsigned>(count_) : 0, active_ports_ > 11 ? static_cast<unsigned>(count_) : 0, active_ports_ > 12 ? static_cast<unsigned>(count_) : 0, active_ports_ > 13 ? static_cast<unsigned>(count_) : 0,
189+
active_ports_ > 14 ? static_cast<unsigned>(count_) : 0, active_ports_ > 15 ? static_cast<unsigned>(count_) : 0,
190190
#endif
191-
ddpdisplay::configuration::dmx::kMaxPorts == 0 ? 0 : dmxnode::kUniverseSize, ddpdisplay::configuration::dmx::kMaxPorts == 0 ? 0 : dmxnode::kUniverseSize));
191+
ddpdisplay::configuration::dmx::kMaxPorts == 0 ? 0 : static_cast<unsigned>(dmxnode::kUniverseSize), ddpdisplay::configuration::dmx::kMaxPorts == 0 ? 0 : static_cast<unsigned>(dmxnode::kUniverseSize)));
192192

193193
packet->header.flags1 = ddp::flags1::VER1 | ddp::flags1::REPLY | ddp::flags1::PUSH;
194194
packet->header.len[0] = static_cast<uint8_t>(kLength >> 8);

lib-displayudf/src/json/displayudfparams.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,34 @@ DisplayUdfParams::DisplayUdfParams() {
4949
}
5050

5151
void DisplayUdfParams::SetIntensity(const char* val, uint32_t len) {
52-
if (len > 3) return;
52+
if (len > 3) {
53+
return;
54+
}
5355
store_displayudf.intensity = ParseValue<uint8_t>(val, len);
5456
}
5557

5658
void DisplayUdfParams::SetSleepTimeout(const char* val, uint32_t len) {
57-
if (len > 3) return;
59+
if (len > 3) {
60+
return;
61+
}
5862
store_displayudf.sleep_timeout = ParseValue<uint8_t>(val, len);
5963
}
6064

6165
void DisplayUdfParams::SetFlipVertically(const char* val, uint32_t len) {
62-
if (len != 1) return;
66+
if (len != 1) {
67+
return;
68+
}
6369
store_displayudf.flags = common::SetFlagValue(store_displayudf.flags, Flags::Flag::kFlipVertically, val[0] != '0');
6470
}
6571

6672
void DisplayUdfParams::SetLabel(const char* key, uint32_t key_len, const char* val, uint32_t val_len) {
67-
if (val_len > 1) return;
73+
if (val_len > 1) {
74+
return;
75+
}
6876

6977
DEBUG_PRINTF("%.*s ->%.*s", key_len, key, val_len, val);
7078

71-
const uint32_t kHash = Fnv1a32Runtime(key, static_cast<uint32_t>(key_len));
79+
const uint32_t kHash = Fnv1a32Runtime(key, key_len);
7280
bool matched = false;
7381
size_t i = 0;
7482
size_t j = 0;

lib-dmx/include/dmxsend.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class DmxSend {
4444
public:
4545
void Start(uint32_t port_index) {
4646
DEBUG_ENTRY();
47-
DEBUG_PRINTF("port_index=%d", port_index);
47+
DEBUG_PRINTF("port_index=%u", static_cast<unsigned>(port_index));
4848

4949
assert(port_index < CHAR_BIT);
5050

@@ -66,7 +66,7 @@ class DmxSend {
6666

6767
void Stop(uint32_t port_index) {
6868
DEBUG_ENTRY();
69-
DEBUG_PRINTF("port_index=%d -> %u", port_index, IsStarted(started_, static_cast<uint8_t>(port_index)));
69+
DEBUG_PRINTF("port_index=%u -> %u", static_cast<unsigned>(port_index), IsStarted(started_, static_cast<uint8_t>(port_index)));
7070

7171
assert(port_index < CHAR_BIT);
7272

@@ -121,7 +121,7 @@ class DmxSend {
121121
Dmx::Get()->SetOutputStyle(port_index, output_style == dmxnode::OutputStyle::kConstant ? dmx::OutputStyle::kConstant : dmx::OutputStyle::kDelta);
122122
}
123123

124-
dmxnode::OutputStyle GetOutputStyle(uint32_t port_index) const {
124+
[[nodiscard]] dmxnode::OutputStyle GetOutputStyle(uint32_t port_index) const {
125125
return Dmx::Get()->GetOutputStyle(port_index) == dmx::OutputStyle::kConstant ? dmxnode::OutputStyle::kConstant : dmxnode::OutputStyle::kDelta;
126126
}
127127
#endif
@@ -154,7 +154,6 @@ class DmxSend {
154154
private:
155155
static constexpr bool IsStarted(uint8_t v, uint32_t p) { return (v & (1U << p)) == (1U << p); }
156156

157-
private:
158157
#if defined(CONFIG_DMXSEND_ENABLE_CONFIGUDP)
159158
DmxConfigUdp dmx_config_udp_;
160159
#endif

lib-dmxnode/include/dmxnode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ class DmxNode {
269269
assert(port_index < dmxnode::kMaxPorts);
270270
auto& port = port_[port_index];
271271

272-
snprintf(port.label, dmxnode::kPortNameLength - 1, "Port %u", (1U + port_index));
272+
snprintf(port.label, dmxnode::kPortNameLength - 1, "Port %u", static_cast<unsigned>((1U + port_index)));
273273
port.label[dmxnode::kPortNameLength - 1] = '\0';
274274
}
275275

lib-gd32/src/uart0/uart0.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
#include <cstdint>
3030
#include <cstdio>
31+
#include <cstdarg>
3132

3233
#include "gd32_uart.h"
3334
#if defined(CONFIG_USART0_ENABLE_TX_DMA) || defined(CONFIG_USART0_ENABLE_RX_DMA)

lib-network/include/network_iface.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ void SetDomainName(const char* domainname);
4646
const char* DomainName();
4747

4848
#if defined(H3) || defined(GD32)
49-
[[nodiscard]] inline constexpr const char* InterfaceName() {
49+
[[nodiscard]] constexpr const char* InterfaceName() {
5050
return "eth0";
5151
}
5252
#else
5353
const char* InterfaceName();
5454
#endif
5555

5656
#if defined(H3) || defined(GD32)
57-
inline constexpr uint32_t InterfaceIndex() {
57+
constexpr uint32_t InterfaceIndex() {
5858
return 1;
5959
}
6060
#else
@@ -73,21 +73,25 @@ void SetAutoIp();
7373
bool AutoIp();
7474

7575
// DHCP
76-
inline constexpr bool IsDhcpCapable() {
76+
constexpr bool IsDhcpCapable() {
7777
return true;
7878
}
7979

80-
inline constexpr bool IsDhcpKnown() {
80+
constexpr bool IsDhcpKnown() {
8181
return true;
8282
}
8383

8484
void EnableDhcp();
8585
bool Dhcp();
8686

8787
inline char AddressingMode() {
88-
if (AutoIp()) return 'Z'; // Zeroconf
89-
if (IsDhcpKnown()) return Dhcp() ? 'D' : 'S'; // DHCP or Static
90-
return 'U'; // Unknown
88+
if (AutoIp()) {
89+
return 'Z'; // Zeroconf
90+
}
91+
if (IsDhcpKnown()) {
92+
return Dhcp() ? 'D' : 'S'; // DHCP or Static
93+
}
94+
return 'U'; // Unknown
9195
}
9296

9397
struct Counters {
@@ -99,7 +103,7 @@ struct Counters {
99103
} tx;
100104
};
101105

102-
void GetCounters(Counters& out);
106+
void GetCounters(Counters& counters);
103107
} // namespace network::iface
104108

105109
#endif // NETWORK_IFACE_H_

lib-network/src/apps/ntp/gd32/ptp/ntpclient.cpp

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ namespace net::globals::ptp {
8787
extern uint32_t timestamp[2];
8888
} // namespace net::globals::ptp
8989

90-
#define _NTPFRAC_(x) (4294U * (x) + ((1981U * (x)) >> 11) + ((2911U * (x)) >> 28))
90+
#define _NTPFRAC_(x) ((4294U * (x)) + ((1981U * (x)) >> 11) + ((2911U * (x)) >> 28))
9191
#define NTPFRAC(x) _NTPFRAC_(x / 1000)
9292
// The reverse of the above, needed if we want to set our microsecond
9393
// clock (via clock_settime) based on the incoming time in NTP format.
@@ -130,7 +130,15 @@ static void Print([[maybe_unused]] const char* text, [[maybe_unused]] const stru
130130
#ifndef NDEBUG
131131
const auto kSeconds = static_cast<time_t>(timestamp->seconds - ntp::kJan1970);
132132
const auto* local_time = localtime(&kSeconds);
133-
printf("%s %02d:%02d:%02d.%06d %04d [%u][0x%.8x]\n", text, local_time->tm_hour, local_time->tm_min, local_time->tm_sec, USEC(timestamp->fraction), local_time->tm_year + 1900, timestamp->seconds, timestamp->fraction);
133+
printf("%s %02d:%02d:%02d.%06d %04d [%u][0x%.8x]\n",
134+
text,
135+
static_cast<int>(local_time->tm_hour),
136+
static_cast<int>(local_time->tm_min),
137+
static_cast<int>(local_time->tm_sec),
138+
static_cast<int>(USEC(timestamp->fraction)),
139+
local_time->tm_year + 1900,
140+
static_cast<int>(timestamp->seconds),
141+
static_cast<unsigned>(timestamp->fraction));
134142
#endif
135143
}
136144

@@ -237,9 +245,13 @@ static void Send() {
237245
network::udp::SendWithTimestamp(s_ntp_client.handle, reinterpret_cast<const uint8_t*>(&s_ntp_client.request), kRequestSize, s_ntp_client.server_ip, network::iana::Ports::kPortNtp);
238246

239247
#ifndef NDEBUG
240-
printf("Request: org=%.8x%.8x rx=%.8x%.8x tx=%.8x%.8x\n", __builtin_bswap32(s_ntp_client.request.origin_timestamp_s), __builtin_bswap32(s_ntp_client.request.origin_timestamp_f),
241-
__builtin_bswap32(s_ntp_client.request.receive_timestamp_s), __builtin_bswap32(s_ntp_client.request.receive_timestamp_f), __builtin_bswap32(s_ntp_client.request.transmit_timestamp_s),
242-
__builtin_bswap32(s_ntp_client.request.transmit_timestamp_f));
248+
printf("Request: org=%.8x%.8x rx=%.8x%.8x tx=%.8x%.8x\n",
249+
static_cast<unsigned>(__builtin_bswap32(s_ntp_client.request.origin_timestamp_s)), // NOLINT
250+
static_cast<unsigned>(__builtin_bswap32(s_ntp_client.request.origin_timestamp_f)), // NOLINT
251+
static_cast<unsigned>(__builtin_bswap32(s_ntp_client.request.receive_timestamp_s)), // NOLINT
252+
static_cast<unsigned>(__builtin_bswap32(s_ntp_client.request.receive_timestamp_f)), // NOLINT
253+
static_cast<unsigned>(__builtin_bswap32(s_ntp_client.request.transmit_timestamp_s)), // NOLINT
254+
static_cast<unsigned>(__builtin_bswap32(s_ntp_client.request.transmit_timestamp_f))); // NOLINT
243255
#endif
244256

245257
if (s_ntp_client.state.x > 0) {
@@ -273,10 +285,12 @@ static inline int32_t AbsInt32(int32_t x) {
273285
}
274286

275287
static void UpdatePtpTime() {
276-
int32_t diff_seconds1, diff_nano_seconds1;
288+
int32_t diff_seconds1;
289+
int32_t diff_nano_seconds1;
277290
Difference(s_ntp_client.t1, s_ntp_client.t2, diff_seconds1, diff_nano_seconds1);
278291

279-
int32_t diff_seconds2, diff_nano_seconds2;
292+
int32_t diff_seconds2;
293+
int32_t diff_nano_seconds2;
280294
Difference(s_ntp_client.t4, s_ntp_client.t3, diff_seconds2, diff_nano_seconds2);
281295

282296
const auto kOffsetSeconds = static_cast<int64_t>(diff_seconds1) + static_cast<int64_t>(diff_seconds2);
@@ -292,7 +306,7 @@ static void UpdatePtpTime() {
292306
gd32::ptp::ptptime ptp_get;
293307
Gd32PtpGetTime(&ptp_get);
294308

295-
s_ntp_client.request.reference_timestamp_s = __builtin_bswap32(static_cast<uint32_t>(ptp_get.tv_sec) + ntp::kJan1970);
309+
s_ntp_client.request.reference_timestamp_s = __builtin_bswap32(ptp_get.tv_sec + ntp::kJan1970);
296310
s_ntp_client.request.reference_timestamp_f = __builtin_bswap32(NTPFRAC(ptp_get.tv_nsec));
297311

298312
if ((ptp_offset.tv_sec == 0) && (ptp_offset.tv_nsec > -999999) && (ptp_offset.tv_nsec < 999999)) {
@@ -350,7 +364,13 @@ static void UpdatePtpTime() {
350364
sign = '-';
351365
}
352366

353-
printf(" %s : offset=%c%d.%09d delay=%d.%09d\n", s_ntp_client.state.mode == ntp::Modes::kBasic ? "Basic" : "Interleaved", sign, ptp_offset.tv_sec, ptp_offset.tv_nsec, ptp_delay.tv_sec, ptp_delay.tv_nsec);
367+
printf(" %s : offset=%c%d.%09d delay=%d.%09d\n",
368+
s_ntp_client.state.mode == ntp::Modes::kBasic ? "Basic" : "Interleaved",
369+
sign,
370+
static_cast<int>(ptp_offset.tv_sec),
371+
static_cast<int>(ptp_offset.tv_nsec),
372+
static_cast<int>(ptp_delay.tv_sec),
373+
static_cast<int>(ptp_delay.tv_nsec));
354374
#endif
355375
}
356376

@@ -369,8 +389,13 @@ static void UpdatePtpTime() {
369389
static void Process() {
370390
const auto* const kReply = s_ntp_client.reply;
371391
#ifndef NDEBUG
372-
printf("Response: org=%.8x%.8x rx=%.8x%.8x tx=%.8x%.8x\n", __builtin_bswap32(kReply->origin_timestamp_s), __builtin_bswap32(kReply->origin_timestamp_f), __builtin_bswap32(kReply->receive_timestamp_s),
373-
__builtin_bswap32(kReply->receive_timestamp_f), __builtin_bswap32(kReply->transmit_timestamp_s), __builtin_bswap32(kReply->transmit_timestamp_f));
392+
printf("Response: org=%.8x%.8x rx=%.8x%.8x tx=%.8x%.8x\n",
393+
static_cast<unsigned>(__builtin_bswap32(kReply->origin_timestamp_s)), // NOLINT
394+
static_cast<unsigned>(__builtin_bswap32(kReply->origin_timestamp_f)), // NOLINT
395+
static_cast<unsigned>(__builtin_bswap32(kReply->receive_timestamp_s)), // NOLINT
396+
static_cast<unsigned>(__builtin_bswap32(kReply->receive_timestamp_f)), // NOLINT
397+
static_cast<unsigned>(__builtin_bswap32(kReply->transmit_timestamp_s)), // NOLINT
398+
static_cast<unsigned>(__builtin_bswap32(kReply->transmit_timestamp_f))); // NOLINT
374399
#endif
375400
// If the origin timestamp is equal to the transmit timestamp, the response is in the basic mode.
376401
if ((kReply->origin_timestamp_s == s_ntp_client.request.transmit_timestamp_s) && (kReply->origin_timestamp_f == s_ntp_client.request.transmit_timestamp_f)) {

lib-network/src/core/ipv4/arp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ template <network::arp::EthSend S> static void Query(uint32_t destination_ip, vo
244244
network::memory::Allocator::Instance().Free(record_found->packet.p);
245245
}
246246

247-
printf("size=%u\n", size);
247+
printf("size=%u\n", static_cast<unsigned>(size));
248248
assert(size <= network::memory::kBlockSize);
249249
record_found->packet.p = network::memory::Allocator::Instance().Allocate();
250250
assert(record_found->packet.p != nullptr);

lib-network/src/emac/gd32/emac_debug.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ void emac_debug_run() {
3939
#endif
4040

4141
if ((rxfifo_drop != 0) || (rxdma_drop != 0)) {
42-
printf("%u: RxFIFO: %u RxDMA: %u\n", ++s_counter, rxfifo_drop, rxdma_drop);
42+
printf("%u: RxFIFO: %u RxDMA: %u\n", static_cast<unsigned>(++s_counter), static_cast<unsigned>(rxfifo_drop), static_cast<unsigned>(rxdma_drop));
4343
}
4444
}

lib-network/src/emac/gd32/emac_eth.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ void Send(uint32_t length) {
359359

360360
// Transmits an Ethernet frame with data copying.
361361
void Send(void* buffer, uint32_t length) {
362-
DEBUG_PRINTF("%p -> %u", buffer, length);
362+
DEBUG_PRINTF("%p -> %u", buffer, static_cast<unsigned>(length));
363363

364364
assert(nullptr != buffer);
365365
assert(length <= ENET_MAX_FRAME_SIZE);

0 commit comments

Comments
 (0)