Skip to content

Commit f9b23d4

Browse files
author
Arto Kinnunen
authored
Fix compiler warnings (ARMmbed#1740)
Fix IAR compiler warnings: -Warning[Pe188]: enumerated type mixed with another type -Warning[Pe177]: variable "ret" was declared but never referenced Fix ARM compiler warning: -warning: ARMmbed#1295-D: Deprecated declaration thread_router_bootstrap_ random_upgrade_jitter - give arg types -warning: ARMmbed#68-D: integer conversion resulted in a change of sign -warning: ARMmbed#111-D: statement is unreachable -Do not use multicast address to indicate error.
1 parent 32fe4b8 commit f9b23d4

File tree

9 files changed

+21
-23
lines changed

9 files changed

+21
-23
lines changed

source/6LoWPAN/Thread/thread_extension.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,6 @@ static void thread_extension_relay_socket_cb(void *cb_res)
698698
uint16_t payload_len;
699699
char *destination_uri_ptr = THREAD_URI_RELAY_RECEIVE;
700700
sckt_data = cb_res;
701-
int ret MAYBE_UNUSED = -1;
702701

703702
protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(sckt_data->interface_id);
704703

source/6LoWPAN/Thread/thread_router_bootstrap.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,7 @@ uint16_t thread_router_bootstrap_child_count_get(protocol_interface_info_entry_t
12161216
}
12171217
mle_neigh_table_list_t *mle_table = mle_class_active_list_get(cur->id);
12181218
if (!mle_table) {
1219-
return -1;
1219+
return 0;
12201220
}
12211221
ns_list_foreach(mle_neigh_table_entry_t, cur_entry, mle_table) {
12221222
if (thread_router_addr_from_addr(cur_entry->short_adr) == router_address) {
@@ -1230,12 +1230,12 @@ static uint16_t thread_router_bootstrap_child_address_generate(protocol_interfac
12301230
{
12311231
mle_neigh_table_list_t *mle_table = mle_class_active_list_get(cur->id);
12321232
if (!mle_table) {
1233-
return -1;
1233+
return 0xfffe;
12341234
}
12351235

12361236
if (thread_router_bootstrap_child_count_get(cur) >= cur->thread_info->maxChildCount) {
12371237
tr_info("Maximum count %d reached", cur->thread_info->maxChildCount);
1238-
return 0xffff;
1238+
return 0xfffe;
12391239
}
12401240

12411241
bool address_allocated = false;
@@ -1254,24 +1254,24 @@ static uint16_t thread_router_bootstrap_child_address_generate(protocol_interfac
12541254
}
12551255
if (address_allocated){
12561256
// all possible addresses already allocated
1257-
return 0xffff;
1257+
return 0xfffe;
12581258
}
12591259
return ((mac_helper_mac16_address_get(cur) & THREAD_ROUTER_MASK) | cur->thread_info->lastAllocatedChildAddress);
12601260
}
12611261

12621262
static bool thread_child_id_request(protocol_interface_info_entry_t *cur, mle_neigh_table_entry_t *entry_temp)
12631263
{
12641264
//Remove All Short address links from router
1265-
if (entry_temp->short_adr != 0xffff) {
1265+
if (entry_temp->short_adr < 0xfffe) {
12661266
protocol_6lowpan_release_short_link_address_from_neighcache(cur, entry_temp->short_adr);
12671267
}
12681268

1269-
//allocate child address if current is router, 0xffff or not our child
1269+
//allocate child address if current is router, >0xfffe or not our child
12701270
if (!thread_addr_is_child(mac_helper_mac16_address_get(cur), entry_temp->short_adr)) {
12711271
entry_temp->short_adr = thread_router_bootstrap_child_address_generate(cur);
12721272
}
12731273

1274-
if (entry_temp->short_adr == 0xffff) {
1274+
if (entry_temp->short_adr >= 0xfffe) {
12751275
return false;
12761276
}
12771277

@@ -1900,9 +1900,9 @@ void thread_router_bootstrap_mle_receive_cb(int8_t interface_id, mle_message_t *
19001900
uint32_t timeout = 0;
19011901
uint64_t active_timestamp = 0;
19021902
uint64_t pending_timestamp = 0;
1903-
mle_tlv_info_t addressRegisterTlv = {0};
1904-
mle_tlv_info_t challengeTlv = {0};
1905-
mle_tlv_info_t tlv_req = {0};
1903+
mle_tlv_info_t addressRegisterTlv = {.tlvType = MLE_TYPE_SRC_ADDRESS};
1904+
mle_tlv_info_t challengeTlv = {.tlvType = MLE_TYPE_SRC_ADDRESS};
1905+
mle_tlv_info_t tlv_req = {.tlvType = MLE_TYPE_SRC_ADDRESS};
19061906
entry_temp = mle_class_get_entry_by_ll64(cur->id, linkMargin, mle_msg->packet_src_address, false, NULL);
19071907

19081908
if (mle_tlv_read_8_bit_tlv(MLE_TYPE_STATUS, mle_msg->data_ptr, mle_msg->data_length, &status)) {

source/6LoWPAN/Thread/thread_router_bootstrap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void thread_router_bootstrap_active_router_attach(struct protocol_interface_info
6464
int thread_router_bootstrap_route_tlv_push(protocol_interface_info_entry_t *cur, uint8_t *route_tlv, uint8_t route_len, uint8_t linkMargin, mle_neigh_table_entry_t *entry);
6565
void thread_router_bootstrap_mle_receive_cb(int8_t interface_id, mle_message_t *mle_msg, struct mle_security_header *security_headers);
6666
void thread_router_bootstrap_timer(protocol_interface_info_entry_t *cur, uint32_t ticks);
67-
uint32_t thread_router_bootstrap_random_upgrade_jitter();
67+
uint32_t thread_router_bootstrap_random_upgrade_jitter(void);
6868
void thread_router_bootstrap_advertiment_analyze(protocol_interface_info_entry_t *cur, uint8_t *src_address, mle_neigh_table_entry_t *entry_temp, uint16_t shortAddress);
6969

7070
void thread_router_bootstrap_multicast_forwarder_enable(protocol_interface_info_entry_t *cur, buffer_t *buf);

source/6LoWPAN/Thread/thread_routing.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ static inline thread_link_quality_e thread_quality_combine(thread_link_quality_e
183183
/* Return the quality (worse of incoming and outgoing quality) for a neighbour router */
184184
static inline thread_link_quality_e thread_neighbour_router_quality(const thread_router_link_t *neighbour)
185185
{
186-
return thread_quality_combine(neighbour->incoming_quality, neighbour->outgoing_quality);
186+
return thread_quality_combine((thread_link_quality_e) neighbour->incoming_quality, (thread_link_quality_e) neighbour->outgoing_quality);
187187
}
188188

189189

@@ -690,8 +690,8 @@ int_fast8_t thread_routing_add_link(protocol_interface_info_entry_t *cur,
690690
if (our_quality_to_other_neighbour < QUALITY_10dB) {
691691
continue;
692692
}
693-
thread_link_quality_e neighbours_incoming_quality_to_other_neighbour = (byte & ROUTE_DATA_IN_MASK) >> ROUTE_DATA_IN_SHIFT;
694-
thread_link_quality_e neighbours_outgoing_quality_to_other_neighbour = (byte & ROUTE_DATA_OUT_MASK) >> ROUTE_DATA_OUT_SHIFT;
693+
thread_link_quality_e neighbours_incoming_quality_to_other_neighbour = (thread_link_quality_e) ((byte & ROUTE_DATA_IN_MASK) >> ROUTE_DATA_IN_SHIFT);
694+
thread_link_quality_e neighbours_outgoing_quality_to_other_neighbour = (thread_link_quality_e) ((byte & ROUTE_DATA_OUT_MASK) >> ROUTE_DATA_OUT_SHIFT);
695695
thread_link_quality_e neighbours_quality_to_other_neighbour = thread_quality_combine(neighbours_incoming_quality_to_other_neighbour,
696696
neighbours_outgoing_quality_to_other_neighbour);
697697
if (neighbours_quality_to_other_neighbour < our_quality_to_other_neighbour) {

source/MAC/IEEE802_15_4/mac_mcps_sap.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ static int8_t mac_virtual_mlme_nap_req_handler(protocol_interface_rf_mac_setup_s
227227
}
228228

229229
mlme_scan_t mlme_scan_req;
230-
mlme_scan_req.ScanType = *ptr++;
231-
mlme_scan_req.ScanChannels.channel_page = *ptr++;
230+
mlme_scan_req.ScanType = (mac_scan_type_t) *ptr++;
231+
mlme_scan_req.ScanChannels.channel_page = (channel_page_e) *ptr++;
232232
memcpy(mlme_scan_req.ScanChannels.channel_mask, ptr, 32);
233233
ptr += 32;
234234
mlme_scan_req.ScanDuration = *ptr++;
@@ -239,14 +239,13 @@ static int8_t mac_virtual_mlme_nap_req_handler(protocol_interface_rf_mac_setup_s
239239
memcpy(mlme_scan_req.Key.Keysource, ptr, 8);
240240
mac_mlme_scan_request(&mlme_scan_req, rf_mac_setup);
241241
return 0;
242-
break;
243242
}
244243
case MLME_SET:{
245244
if (mlme_req->ptr_length < 3) {
246245
return -1;
247246
}
248247
mlme_set_t mlme_set_req;
249-
mlme_set_req.attr = *ptr++;
248+
mlme_set_req.attr = (mlme_attr_t) *ptr++;
250249
mlme_set_req.attr_index = *ptr++;
251250
mlme_set_req.value_pointer = ptr;
252251
mlme_set_req.value_size = mlme_req->ptr_length - 2;

source/MAC/IEEE802_15_4/mac_mlme.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1255,7 +1255,7 @@ int8_t mac_mlme_virtual_confirmation_handle(int8_t driver_id, const uint8_t *dat
12551255
if (!mac_setup) {
12561256
return -1;
12571257
}
1258-
mlme_primitive primitive = *data_ptr;
1258+
mlme_primitive primitive = (mlme_primitive) *data_ptr;
12591259
if (primitive == MLME_SCAN) {
12601260
mlme_scan_conf_t *resp = ns_dyn_mem_temporary_alloc(sizeof(mlme_scan_conf_t));
12611261
if (!resp) {

source/MAC/virtual_rf/virtual_rf_client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ static int8_t phy_rf_virtual_rx(const uint8_t *data_ptr, uint16_t data_len,int8_
138138
return -1;
139139
}
140140
phy_msg.id = MACTUN_MLME_NAP_EXTENSION;
141-
phy_msg.message.mlme_request.primitive = *data_ptr++;
141+
phy_msg.message.mlme_request.primitive = (mlme_primitive) *data_ptr++;
142142
phy_msg.message.mlme_request.mlme_ptr = data_ptr;
143143
phy_msg.message.mlme_request.ptr_length = (data_len - 2);
144144

source/Service_Libs/mdns/ns_fnet_port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ fnet_socket_t fnet_socket(fnet_address_family_t family, fnet_socket_type_t type,
131131
fnet_return_t fnet_socket_bind( fnet_socket_t s, const struct sockaddr *name, fnet_size_t namelen )
132132
{
133133
(void)namelen;
134-
ns_address_t ns_source_addr = {0};
134+
ns_address_t ns_source_addr;
135135
int8_t socket_id = (int8_t)(long)s;
136136
fnet_return_t fnet_ret_val = FNET_ERR;
137137
const struct sockaddr_in6 *namein6 = (const struct sockaddr_in6 *) name;

source/libNET/src/multicast_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ int_fast8_t multicast_mpl_set_default_parameters(int8_t interface_id,
185185
uint8_t control_message_k,
186186
uint8_t control_message_timer_expirations)
187187
{
188-
protocol_interface_info_entry_t *interface = protocol_stack_interface_info_get(interface_id);
188+
protocol_interface_info_entry_t *interface = protocol_stack_interface_info_get_by_id(interface_id);
189189
if (!interface) {
190190
return -1;
191191
}

0 commit comments

Comments
 (0)