Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix trivial compiler Warnings #13476

Merged
merged 28 commits into from
Sep 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
fcb81d3
fixed warnings: comparison of integer expressions of different signed…
talorion Aug 21, 2020
f90d062
fixed warnings: removed unused variables
talorion Aug 21, 2020
d11ce60
fixed warnings: printf format missmatch
talorion Aug 21, 2020
8d1553c
fixed warnings: suggest parentheses around '&&' within '||'
talorion Aug 21, 2020
accadee
fixed warnings: unused variable
talorion Aug 21, 2020
ca74659
fixed warnings: comparison of integer expressions of different signed…
talorion Aug 21, 2020
30e0ff6
fixed warnings: deprecated call of events::EventQueue::call_in(int. F)
talorion Aug 22, 2020
c7d520e
fixed warnings: deprecated call of bool rtos::Semaphore::try_acquire_…
talorion Aug 22, 2020
2a6f006
fixed warnings: comparison of integer expressions of different signed…
talorion Aug 22, 2020
9af18af
fixed warnings: comparison of integer expressions of different signed…
talorion Aug 22, 2020
a721767
fixed warnings: comparison of integer expressions of different signed…
talorion Aug 22, 2020
f58633c
fixed warnings: deprecated call of Timer::read_ms()
talorion Aug 22, 2020
e3080a6
fixed warnings: static method defined but not used
talorion Aug 22, 2020
fa0ab3e
resolved astyle - coding format.
talorion Aug 22, 2020
f789de3
Update connectivity/drivers/cellular/QUECTEL/BC95/QUECTEL_BC95_Cellul…
talorion Aug 26, 2020
f8d90dd
suggested change by Hugues Kamba
talorion Aug 26, 2020
73116b7
suggested change by Hugues Kamba
talorion Aug 26, 2020
f901436
resolved astyle - coding format.
talorion Aug 26, 2020
8a3425e
Update connectivity/drivers/cellular/TELIT/ME310/TELIT_ME310_Cellular…
talorion Aug 27, 2020
0e032ea
Update connectivity/libraries/ppp/source/ppp_service.cpp
talorion Aug 27, 2020
4670c7f
fixed compile errors
talorion Aug 27, 2020
124fbd4
Update connectivity/drivers/cellular/TELIT/ME310/TELIT_ME310_Cellular…
talorion Aug 27, 2020
99adbfa
fixed compile errors
talorion Aug 27, 2020
65fa697
Update connectivity/drivers/cellular/TELIT/ME310/TELIT_ME310_Cellular…
talorion Aug 27, 2020
6488381
made sslctxID constexpr
talorion Aug 27, 2020
2b4268a
Update connectivity/drivers/cellular/TELIT/ME310/TELIT_ME310_Cellular…
talorion Aug 27, 2020
6bf4dda
Update connectivity/libraries/ppp/source/ppp_service.cpp
talorion Aug 27, 2020
c4b93fe
Update connectivity/drivers/802.15.4_RF/atmel-rf-driver/source/Nanost…
talorion Aug 27, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void CellularContext::validate_ip_address()
CellularContext::pdp_type_t CellularContext::string_to_pdp_type(const char *pdp_type_str)
{
pdp_type_t pdp_type = DEFAULT_PDP_TYPE;
int len = strlen(pdp_type_str);
size_t len = strlen(pdp_type_str);

if (len == 6 && memcmp(pdp_type_str, "IPV4V6", len) == 0) {
pdp_type = IPV4V6_PDP_TYPE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ void CellularStateMachine::retry_state_or_fail()
void CellularStateMachine::state_init()
{
change_timeout(_state_timeout_power_on);
tr_info("Start connecting (timeout %d ms)", _state_timeout_power_on);
tr_info("Start connecting (timeout %d ms)", _state_timeout_power_on.count());
_cb_data.error = _cellularDevice.is_ready();
_status = _cb_data.error ? 0 : DEVICE_READY;
if (_cb_data.error != NSAPI_ERROR_OK) {
Expand All @@ -324,7 +324,7 @@ void CellularStateMachine::state_init()
void CellularStateMachine::state_power_on()
{
change_timeout(_state_timeout_power_on);
tr_info("Modem power ON (timeout %d ms)", _state_timeout_power_on);
tr_info("Modem power ON (timeout %d ms)", _state_timeout_power_on.count());
if (power_on()) {
enter_to_state(STATE_DEVICE_READY);
} else {
Expand Down Expand Up @@ -408,7 +408,7 @@ void CellularStateMachine::state_device_ready()
void CellularStateMachine::state_sim_pin()
{
change_timeout(_state_timeout_sim_pin);
tr_info("Setup SIM (timeout %d ms)", _state_timeout_sim_pin);
tr_info("Setup SIM (timeout %d ms)", _state_timeout_sim_pin.count());
if (open_sim()) {
bool success = false;
for (int type = 0; type < CellularNetwork::C_MAX; type++) {
Expand Down Expand Up @@ -473,7 +473,7 @@ void CellularStateMachine::state_registering()
// we are already registered, go to attach
enter_to_state(STATE_ATTACHING_NETWORK);
} else {
tr_info("Network registration (timeout %d ms)", _state_timeout_registration);
tr_info("Network registration (timeout %d ms)", _state_timeout_registration.count());
change_timeout(_state_timeout_registration);
if (!_command_success && !_plmn) { // don't call set_registration twice for manual registration
_cb_data.error = _network.set_registration(_plmn);
Expand All @@ -487,7 +487,7 @@ void CellularStateMachine::state_attaching()
{
if (_status != ATTACHED_TO_NETWORK) {
change_timeout(_state_timeout_connect);
tr_info("Attaching network (timeout %d ms)", _state_timeout_connect);
tr_info("Attaching network (timeout %d ms)", _state_timeout_connect.count());
_cb_data.error = _network.set_attach();
}
if (_cb_data.error == NSAPI_ERROR_OK) {
Expand Down Expand Up @@ -635,7 +635,7 @@ void CellularStateMachine::event()
tr_debug("%s => %s", get_state_string((CellularStateMachine::CellularState)_state),
get_state_string((CellularStateMachine::CellularState)_next_state));
} else {
tr_info("Continue after %d seconds", _event_timeout);
tr_info("Continue after %d seconds", _event_timeout.count());
}
_state = _next_state;
if (_event_timeout == -1s) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,13 @@ nsapi_size_or_error_t QUECTEL_BC95_CellularStack::socket_sendto_impl(CellularSoc

// check for network congestion
device_err_t err = _at.get_last_device_error();
if (err.errType == DeviceErrorTypeErrorCME &&
(err.errCode == AT_UART_BUFFER_ERROR || err.errCode == AT_BACK_OFF_TIMER) || err.errCode == AT_UPLINK_BUSY) {
if (
(
err.errType == DeviceErrorTypeErrorCME
&& (err.errCode == AT_UART_BUFFER_ERROR || err.errCode == AT_BACK_OFF_TIMER)
)
|| err.errCode == AT_UPLINK_BUSY
) {
if (socket->proto == NSAPI_UDP) {
if (retry < 3) {
retry++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@
#include "CellularLog.h"
#include "netsocket/TLSSocket.h"

static const int sslctxID = 1;

using namespace mbed;
using namespace std::chrono_literals;

constexpr int sslctxID = 1;
constexpr auto socket_timeout = 1s;


TELIT_ME310_CellularStack::TELIT_ME310_CellularStack(ATHandler &atHandler, int cid, nsapi_ip_stack_t stack_type, AT_CellularDevice &device) :
AT_CellularStack(atHandler, cid, stack_type, device)
Expand Down Expand Up @@ -66,7 +70,6 @@ nsapi_error_t TELIT_ME310_CellularStack::socket_connect(nsapi_socket_t handle, c
activate_ipeasy_context(_cid);
}

int modem_connect_id = -1;
int err = NSAPI_ERROR_NO_CONNECTION;

int request_connect_id = find_socket_index(socket);
Expand Down Expand Up @@ -224,9 +227,7 @@ nsapi_error_t TELIT_ME310_CellularStack::deactivate_ipeasy_context(int context_i

nsapi_error_t TELIT_ME310_CellularStack::create_socket_impl(CellularSocket *socket)
{
int modem_connect_id = -1;
int remote_port = 1;
int err = -1;

if (!is_ipeasy_context_activated(_cid)) {
tr_debug("IPEasy context not active for %d", _cid);
Expand Down Expand Up @@ -399,7 +400,6 @@ nsapi_size_or_error_t TELIT_ME310_CellularStack::socket_recvfrom_impl(CellularSo
}

if (socket->proto == NSAPI_UDP) {
int data_left = -1;
// UDP has remote_IP and remote_port parameters
_at.read_string(ip_address, sizeof(ip_address));
port = _at.read_int();
Expand All @@ -408,7 +408,7 @@ nsapi_size_or_error_t TELIT_ME310_CellularStack::socket_recvfrom_impl(CellularSo
_at.skip_param();

srecv_size = _at.read_int();
data_left = _at.read_int();
_at.read_int();
if (srecv_size > size) {
srecv_size = size;
}
Expand Down Expand Up @@ -440,7 +440,7 @@ nsapi_size_or_error_t TELIT_ME310_CellularStack::socket_recvfrom_impl(CellularSo
// read() should not fail
success = false;
}
} else if (timer.read_ms() < ME310_SOCKET_TIMEOUT) {
} else if (timer.elapsed_time() < socket_timeout) {
// Wait for URCs
_at.process_oob();
} else {
Expand Down Expand Up @@ -643,4 +643,4 @@ nsapi_error_t TELIT_ME310_CellularStack::setsockopt(nsapi_socket_t handle, int l

return ret;
}
#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ namespace mbed {
#define ME310_SOCKET_BIND_FAIL 556
#define ME310_IPEASY_ACTIVATED_CONTEXT 1
#define ME310_IPEASY_DEACTIVATED_CONTEXT 0
#define ME310_SOCKET_TIMEOUT 1000
#define CTRL_Z "\x1a"
#define ESC "\x1b"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ nsapi_size_or_error_t UBLOX_AT_CellularStack::socket_sendto_impl(CellularSocket
MBED_ASSERT(socket->id != -1);

int sent_len = 0;
uint8_t ch = 0;

if (socket->proto == NSAPI_UDP) {
if (size > UBLOX_MAX_PACKET_SIZE) {
Expand Down Expand Up @@ -372,7 +371,7 @@ UBLOX_AT_CellularStack::CellularSocket *UBLOX_AT_CellularStack::find_socket(int
{
CellularSocket *socket = NULL;

for (unsigned int x = 0; (socket == NULL) && (x < _device.get_property(AT_CellularDevice::PROPERTY_SOCKET_COUNT)); x++) {
for (ptrdiff_t x = 0; (socket == NULL) && (x < _device.get_property(AT_CellularDevice::PROPERTY_SOCKET_COUNT)); x++) {
if (_socket) {
if (_socket[x]->id == id) {
socket = (_socket[x]);
Expand Down
5 changes: 3 additions & 2 deletions connectivity/libraries/ppp/source/ppp_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ extern "C" { // "pppos.h" is missing extern C
/* Timeout to wait for PPP connection to be terminated
* (LCP Terminate-Request is answered with Terminate-Ack)
*/
#define PPP_TERMINATION_TIMEOUT 30000
using namespace std::chrono_literals;
constexpr auto PPP_TERMINATION_TIMEOUT = 30s;


// If both IPCP and IPCP6 are made, how long to wait for both to complete
#define PPP_IPCP_IPCP6_DELAY 5000
Expand Down Expand Up @@ -655,4 +657,3 @@ MBED_WEAK PPP &PPP::get_default_instance()
*/

/* --------------------------------- End Of File ------------------------------ */

3 changes: 2 additions & 1 deletion connectivity/libraries/ppp/source/ppp_service_if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,8 @@ extern "C" {
}

void *cb_ptr = reinterpret_cast<void *>(ppp_service_sys_timeout_id);
int unique_id = ppp_service_ptr->event_queue_get()->call_in(msecs, mbed::callback(ppp_sys_timeout_callback, cb_ptr));
auto duration = std::chrono::milliseconds(msecs);
int unique_id = ppp_service_ptr->event_queue_get()->call_in(duration, mbed::callback(ppp_sys_timeout_callback, cb_ptr));
if (unique_id == 0) {
tr_error("No free memory for timeout equeue");
ppp_service_if_mutex->unlock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void tcp_test_drop_reset()
}
#endif

#ifdef FEA_TRACE_SUPPORT
#if defined(FEA_TRACE_SUPPORT) && MBED_CONF_MBED_TRACE_ENABLE && (MBED_TRACE_MAX_LEVEL >= TRACE_LEVEL_DEBUG)
static const char *trace_tcp_flags(uint16_t flags)
{
static char buf[9];
Expand Down
5 changes: 3 additions & 2 deletions connectivity/netsocket/source/nsapi_dns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,12 @@ static nsapi_size_or_error_t nsapi_dns_query_multiple(NetworkStack *stack, const
nsapi_addr *tmp = new (std::nothrow) nsapi_addr_t [MBED_CONF_NSAPI_DNS_ADDRESSES_LIMIT];
int cached = nsapi_dns_cache_find(host, version, tmp);
if (cached > 0) {
for (int i = 0; i < MIN(cached, addr_count); i++) {
unsigned int us_cached = cached;
for (unsigned int i = 0; i < MIN(us_cached, addr_count); i++) {
addr[i] = tmp[i];
}
delete [] tmp;
return MIN(cached, addr_count);
return MIN(us_cached, addr_count);
}
delete [] tmp;
// create a udp socket
Expand Down
2 changes: 1 addition & 1 deletion drivers/source/SFDP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ int sfdp_iterate_next_largest_erase_type(uint8_t &bitfield,
largest_erase_type = idx;
if ((size > (int)(smptbl.erase_type_size_arr[largest_erase_type])) &&
((smptbl.region_high_boundary[region] - offset)
> (int)(smptbl.erase_type_size_arr[largest_erase_type]))) {
> (uint64_t)(smptbl.erase_type_size_arr[largest_erase_type]))) {
break;
} else {
bitfield &= ~type_mask;
Expand Down