Skip to content

Commit 69c6cc3

Browse files
committed
Networking: Fix some ARMC6 warnings
Some int-versus-long and signed-versus-unsigned format string mismatches, and missing `class` keyword.
1 parent dc1198b commit 69c6cc3

File tree

8 files changed

+16
-12
lines changed

8 files changed

+16
-12
lines changed

components/wifi/esp8266-driver/ESP8266/ESP8266.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@
1515
*/
1616

1717
#if DEVICE_SERIAL && DEVICE_INTERRUPTIN && defined(MBED_CONF_EVENTS_PRESENT) && defined(MBED_CONF_NSAPI_PRESENT) && defined(MBED_CONF_RTOS_PRESENT)
18+
#ifndef __STDC_FORMAT_MACROS
19+
#define __STDC_FORMAT_MACROS
20+
#endif
21+
#include <inttypes.h>
22+
1823
#include <string.h>
19-
#include <stdint.h>
2024
#include <stdlib.h>
2125

2226
#include "ESP8266.h"
@@ -601,7 +605,7 @@ nsapi_error_t ESP8266::send(int id, const void *data, uint32_t amount)
601605
set_timeout(ESP8266_SEND_TIMEOUT);
602606
_busy = false;
603607
_error = false;
604-
if (!_parser.send("AT+CIPSEND=%d,%lu", id, amount)) {
608+
if (!_parser.send("AT+CIPSEND=%d,%" PRIu32, id, amount)) {
605609
tr_debug("ESP8266::send(): AT+CIPSEND failed");
606610
goto END;
607611
}
@@ -734,7 +738,7 @@ int32_t ESP8266::_recv_tcp_passive(int id, void *data, uint32_t amount, uint32_t
734738
amount = amount > 2048 ? 2048 : amount;
735739

736740
// NOTE: documentation v3.0 says '+CIPRECVDATA:<data_len>,' but it's not how the FW responds...
737-
bool done = _parser.send("AT+CIPRECVDATA=%d,%lu", id, amount)
741+
bool done = _parser.send("AT+CIPRECVDATA=%d,%" PRIu32, id, amount)
738742
&& _parser.recv("OK\n");
739743

740744
_sock_i[id].tcp_data = NULL;
@@ -1056,7 +1060,7 @@ void ESP8266::_oob_tcp_data_hdlr()
10561060

10571061
MBED_ASSERT(_sock_active_id >= 0 && _sock_active_id < 5);
10581062

1059-
if (!_parser.recv("%ld:", &len)) {
1063+
if (!_parser.recv("%" SCNd32 ":", &len)) {
10601064
return;
10611065
}
10621066

features/lwipstack/LWIPStack.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class LWIP : public OnboardNetworkStack, private mbed::NonCopyable<LWIP> {
126126
virtual char *get_gateway(char *buf, nsapi_size_t buflen);
127127

128128
private:
129-
friend LWIP;
129+
friend class LWIP;
130130

131131
Interface();
132132

features/nanostack/mbed-mesh-api/mbed-mesh-api/NanostackEthernetInterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Nanostack::EthernetInterface : public Nanostack::Interface {
3030
virtual nsapi_error_t bringdown();
3131

3232
private:
33-
friend Nanostack;
33+
friend class Nanostack;
3434
friend class NanostackEthernetInterface;
3535
EthernetInterface(NanostackEthernetPhy &phy) : Interface(phy) {}
3636
nsapi_error_t initialize();

features/nanostack/mbed-mesh-api/source/LoWPANNDInterface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Nanostack::LoWPANNDInterface : public Nanostack::MeshInterface {
3333
virtual nsapi_error_t bringdown();
3434
virtual char *get_gateway(char *buf, nsapi_size_t buflen);
3535

36-
friend Nanostack;
36+
friend class Nanostack;
3737
friend class ::LoWPANNDInterface;
3838
private:
3939
LoWPANNDInterface(NanostackRfPhy &phy) : MeshInterface(phy) { }

features/nanostack/mbed-mesh-api/source/ThreadInterface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Nanostack::ThreadInterface : public Nanostack::MeshInterface {
3030
nsapi_ip_stack_t stack = IPV6_STACK,
3131
bool blocking = true);
3232
virtual nsapi_error_t bringdown();
33-
friend Nanostack;
33+
friend class Nanostack;
3434
friend class ::ThreadInterface;
3535
private:
3636
ThreadInterface(NanostackRfPhy &phy) : MeshInterface(phy), eui64_set(false) { }

features/nanostack/mbed-mesh-api/source/WisunInterface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Nanostack::WisunInterface : public Nanostack::MeshInterface {
3333
virtual nsapi_error_t bringdown();
3434
virtual char *get_gateway(char *buf, nsapi_size_t buflen);
3535

36-
friend Nanostack;
36+
friend class Nanostack;
3737
friend class ::WisunInterface;
3838
private:
3939
WisunInterface(NanostackRfPhy &phy) : MeshInterface(phy) { }

features/nanostack/mbed-mesh-api/source/nd_tasklet.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ static void initialize_channel_list(void)
103103

104104
arm_nwk_set_channel_list(tasklet_data_ptr->network_interface_id, &tasklet_data_ptr->channel_list);
105105

106-
tr_debug("Channel: %ld", channel);
106+
tr_debug("Channel: %" PRIu32, channel);
107107
tr_debug("Channel page: %d", tasklet_data_ptr->channel_list.channel_page);
108-
tr_debug("Channel mask: 0x%.8lx", tasklet_data_ptr->channel_list.channel_mask[word_index]);
108+
tr_debug("Channel mask: 0x%.8" PRIx32, tasklet_data_ptr->channel_list.channel_mask[word_index]);
109109
}
110110

111111
/*

features/nanostack/mbed-mesh-api/source/thread_tasklet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ void thread_tasklet_configure_and_connect_to_network(void)
319319
thread_tasklet_data_ptr->channel_list.channel_mask[0] = MBED_CONF_MBED_MESH_API_THREAD_CONFIG_CHANNEL_MASK;
320320

321321
TRACE_DETAIL("channel page: %d", thread_tasklet_data_ptr->channel_list.channel_page);
322-
TRACE_DETAIL("channel mask: 0x%.8lx", thread_tasklet_data_ptr->channel_list.channel_mask[0]);
322+
TRACE_DETAIL("channel mask: 0x%.8" PRIx32, thread_tasklet_data_ptr->channel_list.channel_mask[0]);
323323

324324
// PSKd
325325
const char PSKd[] = MBED_CONF_MBED_MESH_API_THREAD_PSKD;

0 commit comments

Comments
 (0)