diff --git a/components/802.15.4_RF/atmel-rf-driver/source/NanostackRfPhyAtmel.cpp b/components/802.15.4_RF/atmel-rf-driver/source/NanostackRfPhyAtmel.cpp index abb2ee93e9..be59a4afcd 100644 --- a/components/802.15.4_RF/atmel-rf-driver/source/NanostackRfPhyAtmel.cpp +++ b/components/802.15.4_RF/atmel-rf-driver/source/NanostackRfPhyAtmel.cpp @@ -524,7 +524,7 @@ static void rf_if_reset_radio(void) #else rf->spi.frequency(MBED_CONF_ATMEL_RF_LOW_SPI_SPEED); #endif - rf->IRQ.rise(0); + rf->IRQ.rise(nullptr); rf->RST = 1; ThisThread::sleep_for(2); rf->RST = 0; diff --git a/components/wifi/esp8266-driver/ESP8266/ESP8266.cpp b/components/wifi/esp8266-driver/ESP8266/ESP8266.cpp index 9a31dac111..357db71251 100644 --- a/components/wifi/esp8266-driver/ESP8266/ESP8266.cpp +++ b/components/wifi/esp8266-driver/ESP8266/ESP8266.cpp @@ -41,7 +41,7 @@ ESP8266::ESP8266(PinName tx, PinName rx, bool debug, PinName rts, PinName cts) : _sdk_v(-1, -1, -1), _at_v(-1, -1, -1), _tcp_passive(false), - _callback(0), + _callback(), _serial(tx, rx, MBED_CONF_ESP8266_SERIAL_BAUDRATE), _serial_rts(rts), _serial_cts(cts), diff --git a/components/wifi/esp8266-driver/ESP8266Interface.cpp b/components/wifi/esp8266-driver/ESP8266Interface.cpp index 3aeb82a5b9..13ac0bc6b3 100644 --- a/components/wifi/esp8266-driver/ESP8266Interface.cpp +++ b/components/wifi/esp8266-driver/ESP8266Interface.cpp @@ -71,7 +71,7 @@ ESP8266Interface::ESP8266Interface() _connect_retval(NSAPI_ERROR_OK), _disconnect_retval(NSAPI_ERROR_OK), _conn_stat(NSAPI_STATUS_DISCONNECTED), - _conn_stat_cb(NULL), + _conn_stat_cb(), _global_event_queue(mbed_event_queue()), // Needs to be set before attaching event() to SIGIO _oob_event_id(0), _connect_event_id(0), @@ -113,7 +113,7 @@ ESP8266Interface::ESP8266Interface(PinName tx, PinName rx, bool debug, PinName r _connect_retval(NSAPI_ERROR_OK), _disconnect_retval(NSAPI_ERROR_OK), _conn_stat(NSAPI_STATUS_DISCONNECTED), - _conn_stat_cb(NULL), + _conn_stat_cb(), _global_event_queue(mbed_event_queue()), // Needs to be set before attaching event() to SIGIO _oob_event_id(0), _connect_event_id(0), diff --git a/drivers/SerialBase.h b/drivers/SerialBase.h index e57483ed93..b91304233e 100644 --- a/drivers/SerialBase.h +++ b/drivers/SerialBase.h @@ -216,7 +216,7 @@ public: /** Begin asynchronous write using 8bit buffer. * * The write operation ends with any of the enabled events and invokes - * registered callback function (which can be NULL to not receive callback at all). + * registered callback function (which can be empty to not receive callback at all). * Events that are not enabled by event argument are simply ignored. * Operation has to be ended explicitly by calling abort_write() when * no events are enabled. @@ -233,7 +233,7 @@ public: /** Begin asynchronous write using 16bit buffer. * * The write operation ends with any of the enabled events and invokes - * registered callback function (which can be NULL to not receive callback at all). + * registered callback function (which can be empty to not receive callback at all). * Events that are not enabled by event argument are simply ignored. * Operation has to be ended explicitly by calling abort_write() when * no events are enabled. @@ -256,7 +256,7 @@ public: /** Begin asynchronous reading using 8bit buffer. * * The read operation ends with any of the enabled events and invokes registered - * callback function (which can be NULL to not receive callback at all). + * callback function (which can be empty to not receive callback at all). * Events that are not enabled by event argument are simply ignored. * Operation has to be ended explicitly by calling abort_read() when * no events are enabled. @@ -274,7 +274,7 @@ public: /** Begin asynchronous reading using 16bit buffer. * * The read operation ends with any of the enabled events and invokes registered - * callback function (which can be NULL to not receive callback at all). + * callback function (which can be empty to not receive callback at all). * Events that are not enabled by event argument are simply ignored. * Operation has to be ended explicitly by calling abort_read() when * no events are enabled. diff --git a/drivers/internal/PolledQueue.h b/drivers/internal/PolledQueue.h index d8964218b0..97c02a83e0 100644 --- a/drivers/internal/PolledQueue.h +++ b/drivers/internal/PolledQueue.h @@ -42,7 +42,7 @@ public: * * @param cb Callback called when dispatch needs to be called */ - PolledQueue(mbed::Callback cb = NULL); + PolledQueue(mbed::Callback cb = nullptr); virtual ~PolledQueue(); diff --git a/drivers/internal/USBDevice.h b/drivers/internal/USBDevice.h index bc9902e1c8..f03f7f8095 100644 --- a/drivers/internal/USBDevice.h +++ b/drivers/internal/USBDevice.h @@ -147,7 +147,7 @@ public: * @param callback Method pointer to be called when a packet is transferred * @returns true if successful, false otherwise */ - bool endpoint_add(usb_ep_t endpoint, uint32_t max_packet, usb_ep_type_t type, mbed::Callback callback = NULL); + bool endpoint_add(usb_ep_t endpoint, uint32_t max_packet, usb_ep_type_t type, mbed::Callback callback = nullptr); /** * Add an endpoint diff --git a/drivers/source/CAN.cpp b/drivers/source/CAN.cpp index 4dc91810a4..6688829c8e 100644 --- a/drivers/source/CAN.cpp +++ b/drivers/source/CAN.cpp @@ -56,7 +56,7 @@ CAN::~CAN() // Detaching interrupts releases the sleep lock if it was locked for (int irq = 0; irq < IrqCnt; irq++) { - attach(NULL, (IrqType)irq); + attach(nullptr, (IrqType)irq); } can_irq_free(&_can); can_free(&_can); @@ -147,7 +147,7 @@ void CAN::attach(Callback func, IrqType type) if (_irq[(CanIrqType)type]) { sleep_manager_unlock_deep_sleep(); } - _irq[(CanIrqType)type] = NULL; + _irq[(CanIrqType)type] = nullptr; can_irq_set(&_can, (CanIrqType)type, 0); } unlock(); diff --git a/drivers/source/InterruptIn.cpp b/drivers/source/InterruptIn.cpp index a4ab5f0135..113213a289 100644 --- a/drivers/source/InterruptIn.cpp +++ b/drivers/source/InterruptIn.cpp @@ -26,8 +26,8 @@ namespace mbed { // constructor, with a default value for the PinMode. InterruptIn::InterruptIn(PinName pin) : gpio(), gpio_irq(), - _rise(NULL), - _fall(NULL) + _rise(), + _fall() { // No lock needed in the constructor irq_init(pin); @@ -37,8 +37,8 @@ InterruptIn::InterruptIn(PinName pin) : gpio(), InterruptIn::InterruptIn(PinName pin, PinMode mode) : gpio(), gpio_irq(), - _rise(NULL), - _fall(NULL) + _rise(), + _fall() { // No lock needed in the constructor irq_init(pin); @@ -76,7 +76,7 @@ void InterruptIn::rise(Callback func) _rise = func; gpio_irq_set(&gpio_irq, IRQ_RISE, 1); } else { - _rise = NULL; + _rise = nullptr; gpio_irq_set(&gpio_irq, IRQ_RISE, 0); } core_util_critical_section_exit(); @@ -89,7 +89,7 @@ void InterruptIn::fall(Callback func) _fall = func; gpio_irq_set(&gpio_irq, IRQ_FALL, 1); } else { - _fall = NULL; + _fall = nullptr; gpio_irq_set(&gpio_irq, IRQ_FALL, 0); } core_util_critical_section_exit(); diff --git a/drivers/source/SPI.cpp b/drivers/source/SPI.cpp index 71f4f76221..cec9518fd0 100644 --- a/drivers/source/SPI.cpp +++ b/drivers/source/SPI.cpp @@ -151,14 +151,14 @@ SPI::~SPI() lock(); /* Make sure a stale pointer isn't left in peripheral's owner field */ if (_peripheral->owner == this) { - _peripheral->owner = NULL; + _peripheral->owner = nullptr; } unlock(); } SPI::spi_peripheral_s *SPI::_lookup(SPI::SPIName name) { - SPI::spi_peripheral_s *result = NULL; + SPI::spi_peripheral_s *result = nullptr; core_util_critical_section_enter(); for (int idx = 0; idx < _peripherals_used; idx++) { if (_peripherals[idx].name == name) { diff --git a/drivers/source/Serial.cpp b/drivers/source/Serial.cpp index e972818af1..d76672d060 100644 --- a/drivers/source/Serial.cpp +++ b/drivers/source/Serial.cpp @@ -28,11 +28,11 @@ Serial::Serial(const serial_pinmap_t &static_pinmap, const char *name, int baud) { } -Serial::Serial(PinName tx, PinName rx, int baud): SerialBase(tx, rx, baud), Stream(NULL) +Serial::Serial(PinName tx, PinName rx, int baud): SerialBase(tx, rx, baud), Stream() { } -Serial::Serial(const serial_pinmap_t &static_pinmap, int baud): SerialBase(static_pinmap, baud), Stream(NULL) +Serial::Serial(const serial_pinmap_t &static_pinmap, int baud): SerialBase(static_pinmap, baud), Stream() { } diff --git a/drivers/source/SerialBase.cpp b/drivers/source/SerialBase.cpp index 824785139b..dc607224fb 100644 --- a/drivers/source/SerialBase.cpp +++ b/drivers/source/SerialBase.cpp @@ -34,21 +34,13 @@ SerialBase::SerialBase(PinName tx, PinName rx, int baud) : { // No lock needed in the constructor - for (size_t i = 0; i < sizeof _irq / sizeof _irq[0]; i++) { - _irq[i] = NULL; - } - (this->*_init_func)(); } SerialBase::SerialBase(const serial_pinmap_t &static_pinmap, int baud) : #if DEVICE_SERIAL_ASYNCH - _thunk_irq(this), _tx_usage(DMA_USAGE_NEVER), - _rx_usage(DMA_USAGE_NEVER), _tx_callback(NULL), - _rx_callback(NULL), _tx_asynch_set(false), - _rx_asynch_set(false), + _thunk_irq(this), #endif - _serial(), _baud(baud), _tx_pin(static_pinmap.tx_pin), _rx_pin(static_pinmap.rx_pin), @@ -57,10 +49,6 @@ SerialBase::SerialBase(const serial_pinmap_t &static_pinmap, int baud) : { // No lock needed in the constructor - for (size_t i = 0; i < sizeof _irq / sizeof _irq[0]; i++) { - _irq[i] = NULL; - } - (this->*_init_func)(); } @@ -118,7 +106,7 @@ void SerialBase::attach(Callback func, IrqType type) if (_irq[type]) { sleep_manager_unlock_deep_sleep(); } - _irq[type] = NULL; + _irq[type] = nullptr; serial_irq_set(&_serial, (SerialIrq)type, 0); } core_util_critical_section_exit(); @@ -187,7 +175,7 @@ void SerialBase::enable_input(bool enable) core_util_critical_section_enter(); if (enable) { // Enable rx IRQ and lock deep sleep if a rx handler is attached - // (indicated by rx IRQ callback not NULL) + // (indicated by rx IRQ callback not empty) if (_irq[RxIrq]) { _irq[RxIrq].call(); sleep_manager_lock_deep_sleep(); @@ -197,7 +185,7 @@ void SerialBase::enable_input(bool enable) // Disable rx IRQ serial_irq_set(&_serial, (SerialIrq)RxIrq, 0); // Unlock deep sleep if a rx handler is attached - // (indicated by rx IRQ callback not NULL) + // (indicated by rx IRQ callback not empty) if (_irq[RxIrq]) { sleep_manager_unlock_deep_sleep(); } @@ -224,7 +212,7 @@ void SerialBase::enable_output(bool enable) core_util_critical_section_enter(); if (enable) { // Enable tx IRQ and lock deep sleep if a tx handler is attached - // (indicated by tx IRQ callback not NULL) + // (indicated by tx IRQ callback not empty) if (_irq[TxIrq]) { _irq[TxIrq].call(); sleep_manager_lock_deep_sleep(); @@ -234,7 +222,7 @@ void SerialBase::enable_output(bool enable) // Disable tx IRQ serial_irq_set(&_serial, (SerialIrq)TxIrq, 0); // Unlock deep sleep if a tx handler is attached - // (indicated by tx IRQ callback not NULL) + // (indicated by tx IRQ callback not empty) if (_irq[TxIrq]) { sleep_manager_unlock_deep_sleep(); } @@ -297,7 +285,7 @@ SerialBase::~SerialBase() // Detaching interrupts releases the sleep lock if it was locked for (int irq = 0; irq < IrqCnt; irq++) { - attach(NULL, (IrqType)irq); + attach(nullptr, (IrqType)irq); } } @@ -389,7 +377,7 @@ void SerialBase::abort_write(void) lock(); core_util_critical_section_enter(); if (_tx_asynch_set) { - _tx_callback = NULL; + _tx_callback = nullptr; _tx_asynch_set = false; serial_tx_abort_asynch(&_serial); sleep_manager_unlock_deep_sleep(); @@ -403,7 +391,7 @@ void SerialBase::abort_read(void) lock(); core_util_critical_section_enter(); if (_rx_asynch_set) { - _rx_callback = NULL; + _rx_callback = nullptr; _rx_asynch_set = false; serial_rx_abort_asynch(&_serial); sleep_manager_unlock_deep_sleep(); @@ -475,7 +463,7 @@ void SerialBase::interrupt_handler_asynch(void) if (_rx_asynch_set && rx_event) { event_callback_t cb = _rx_callback; _rx_asynch_set = false; - _rx_callback = NULL; + _rx_callback = nullptr; if (cb) { cb.call(rx_event); } @@ -486,7 +474,7 @@ void SerialBase::interrupt_handler_asynch(void) if (_tx_asynch_set && tx_event) { event_callback_t cb = _tx_callback; _tx_asynch_set = false; - _tx_callback = NULL; + _tx_callback = nullptr; if (cb) { cb.call(tx_event); } diff --git a/drivers/source/Ticker.cpp b/drivers/source/Ticker.cpp index 3114abdf33..47b4960295 100644 --- a/drivers/source/Ticker.cpp +++ b/drivers/source/Ticker.cpp @@ -23,12 +23,12 @@ namespace mbed { -Ticker::Ticker() : TimerEvent(), _delay(0), _function(0), _lock_deepsleep(true) +Ticker::Ticker() : TimerEvent(), _delay(0), _lock_deepsleep(true) { } // When low power ticker is in use, then do not disable deep sleep. -Ticker::Ticker(const ticker_data_t *data) : TimerEvent(data), _delay(0), _function(0), _lock_deepsleep(!data->interface->runs_in_deep_sleep) +Ticker::Ticker(const ticker_data_t *data) : TimerEvent(data), _delay(0), _lock_deepsleep(!data->interface->runs_in_deep_sleep) { } diff --git a/drivers/source/UARTSerial.cpp b/drivers/source/UARTSerial.cpp index 91be64e083..e9036e3ece 100644 --- a/drivers/source/UARTSerial.cpp +++ b/drivers/source/UARTSerial.cpp @@ -67,7 +67,7 @@ void UARTSerial::set_baud(int baud) void UARTSerial::set_data_carrier_detect(PinName dcd_pin, bool active_high) { delete _dcd_irq; - _dcd_irq = NULL; + _dcd_irq = nullptr; if (dcd_pin != NC) { _dcd_irq = new InterruptIn(dcd_pin); @@ -361,7 +361,7 @@ void UARTSerial::enable_rx_irq() void UARTSerial::disable_rx_irq() { - SerialBase::attach(NULL, RxIrq); + SerialBase::attach(nullptr, RxIrq); _rx_irq_enabled = false; } @@ -373,7 +373,7 @@ void UARTSerial::enable_tx_irq() void UARTSerial::disable_tx_irq() { - SerialBase::attach(NULL, TxIrq); + SerialBase::attach(nullptr, TxIrq); _tx_irq_enabled = false; } diff --git a/drivers/source/usb/AsyncOp.cpp b/drivers/source/usb/AsyncOp.cpp index 229d5c7062..351dff32f7 100644 --- a/drivers/source/usb/AsyncOp.cpp +++ b/drivers/source/usb/AsyncOp.cpp @@ -85,9 +85,9 @@ void AsyncOp::complete() core_util_critical_section_enter(); mbed::Callback cb = _callback; - _callback = NULL; - _list = NULL; - if (_wait != NULL) { + _callback = nullptr; + _list = nullptr; + if (_wait != nullptr) { _wait->release(); } @@ -115,11 +115,11 @@ void AsyncOp::_abort(bool timeout) core_util_critical_section_enter(); OperationListBase *list = _list; if (list) { - _callback = NULL; + _callback = nullptr; _aborted = true; - _wait = NULL; + _wait = nullptr; _timeout = timeout; - _list = NULL; + _list = nullptr; } core_util_critical_section_exit(); if (list) { diff --git a/drivers/source/usb/USBDevice.cpp b/drivers/source/usb/USBDevice.cpp index 40c3b0df93..6d3cfc87d4 100644 --- a/drivers/source/usb/USBDevice.cpp +++ b/drivers/source/usb/USBDevice.cpp @@ -1177,7 +1177,7 @@ void USBDevice::endpoint_remove(usb_ep_t endpoint) _phy->endpoint_abort(endpoint); } - info->callback = NULL; + info->callback = nullptr; info->flags = 0; info->pending = 0; info->max_packet_size = 0; diff --git a/features/cellular/framework/AT/AT_CellularDevice.cpp b/features/cellular/framework/AT/AT_CellularDevice.cpp index 2aed8c7042..b4b5375c6d 100644 --- a/features/cellular/framework/AT/AT_CellularDevice.cpp +++ b/features/cellular/framework/AT/AT_CellularDevice.cpp @@ -53,10 +53,10 @@ AT_CellularDevice::AT_CellularDevice(FileHandle *fh) : CellularDevice(fh), AT_CellularDevice::~AT_CellularDevice() { if (get_property(PROPERTY_AT_CGEREP)) { - _at->set_urc_handler("+CGEV: NW DEACT", 0); - _at->set_urc_handler("+CGEV: ME DEACT", 0); - _at->set_urc_handler("+CGEV: NW PDN D", 0); - _at->set_urc_handler("+CGEV: ME PDN D", 0); + _at->set_urc_handler("+CGEV: NW DEACT", nullptr); + _at->set_urc_handler("+CGEV: ME DEACT", nullptr); + _at->set_urc_handler("+CGEV: NW PDN D", nullptr); + _at->set_urc_handler("+CGEV: ME PDN D", nullptr); } // make sure that all is deleted even if somewhere close was not called and reference counting is messed up. diff --git a/features/cellular/framework/AT/AT_CellularNetwork.cpp b/features/cellular/framework/AT/AT_CellularNetwork.cpp index d91b45d093..a2b6f3577f 100644 --- a/features/cellular/framework/AT/AT_CellularNetwork.cpp +++ b/features/cellular/framework/AT/AT_CellularNetwork.cpp @@ -72,7 +72,7 @@ static const char *const rat_str[AT_CellularNetwork::RAT_MAX] = { AT_CellularNetwork::AT_CellularNetwork(ATHandler &atHandler, AT_CellularDevice &device) : - _connection_status_cb(NULL), _ciotopt_network_support_cb(NULL), _op_act(RAT_UNKNOWN), + _connection_status_cb(), _ciotopt_network_support_cb(), _op_act(RAT_UNKNOWN), _connect_status(NSAPI_STATUS_DISCONNECTED), _supported_network_opt(CIOT_OPT_MAX), _at(atHandler), _device(device) { @@ -101,15 +101,15 @@ AT_CellularNetwork::~AT_CellularNetwork() (void)set_packet_domain_event_reporting(false); for (int type = 0; type < CellularNetwork::C_MAX; type++) { if (_device.get_property((AT_CellularDevice::CellularProperty)type) != RegistrationModeDisable) { - _at.set_urc_handler(at_reg[type].urc_prefix, 0); + _at.set_urc_handler(at_reg[type].urc_prefix, nullptr); } } if (_device.get_property(AT_CellularDevice::PROPERTY_AT_CGEREP)) { - _at.set_urc_handler("+CGEV: ME DET", 0); - _at.set_urc_handler("+CGEV: NW DET", 0); + _at.set_urc_handler("+CGEV: ME DET", nullptr); + _at.set_urc_handler("+CGEV: NW DET", nullptr); } - _at.set_urc_handler("+CCIOTOPTI:", 0); + _at.set_urc_handler("+CCIOTOPTI:", nullptr); } void AT_CellularNetwork::urc_cgev() diff --git a/features/cellular/framework/AT/AT_CellularSMS.cpp b/features/cellular/framework/AT/AT_CellularSMS.cpp index af526013ab..142d920b94 100644 --- a/features/cellular/framework/AT/AT_CellularSMS.cpp +++ b/features/cellular/framework/AT/AT_CellularSMS.cpp @@ -177,7 +177,7 @@ static const unsigned char gsm_to_ascii[] = { const int GSM_TO_ASCII_TABLE_SIZE = sizeof(gsm_to_ascii) / sizeof(gsm_to_ascii[0]); -AT_CellularSMS::AT_CellularSMS(ATHandler &at, AT_CellularDevice &device) : _cb(0), _mode(CellularSMSMmodeText), +AT_CellularSMS::AT_CellularSMS(ATHandler &at, AT_CellularDevice &device) : _cb(), _mode(CellularSMSMmodeText), _use_8bit_encoding(false), _sim_wait_time(0), _sms_message_ref_number(1), _sms_info(NULL), _at(at), _device(device) { diff --git a/features/cellular/framework/device/ATHandler.cpp b/features/cellular/framework/device/ATHandler.cpp index c24eb9152a..1fe82c2c2d 100644 --- a/features/cellular/framework/device/ATHandler.cpp +++ b/features/cellular/framework/device/ATHandler.cpp @@ -291,7 +291,7 @@ void ATHandler::set_is_filehandle_usable(bool usable) _fileHandle->sigio(Callback(this, &ATHandler::event)); } else { _fileHandle->set_blocking(true); // set back to default state - _fileHandle->sigio(NULL); + _fileHandle->sigio(nullptr); } _is_fh_usable = usable; } diff --git a/features/cellular/framework/device/CellularContext.cpp b/features/cellular/framework/device/CellularContext.cpp index 35c174b0b1..f5a65c0f44 100644 --- a/features/cellular/framework/device/CellularContext.cpp +++ b/features/cellular/framework/device/CellularContext.cpp @@ -59,12 +59,11 @@ MBED_WEAK CellularContext *CellularContext::get_default_nonip_instance() } CellularContext::CellularContext() : _next(0), _stack(0), _pdp_type(DEFAULT_PDP_TYPE), - _authentication_type(CellularContext::CHAP), _connect_status(NSAPI_STATUS_DISCONNECTED), _status_cb(0), + _authentication_type(CellularContext::CHAP), _connect_status(NSAPI_STATUS_DISCONNECTED), _status_cb(), _cid(-1), _new_context_set(false), _is_context_active(false), _is_context_activated(false), - _apn(0), _uname(0), _pwd(0), _dcd_pin(NC), _active_high(false), _cp_netif(0), _retry_array_length(0), - _retry_count(0), _device(0), _nw(0), _is_blocking(true), _nonip_req(false), _cp_in_use(false) + _apn(0), _uname(0), _pwd(0), _dcd_pin(NC), _active_high(false), _cp_netif(0), _retry_timeout_array(), + _retry_array_length(0), _retry_count(0), _device(0), _nw(0), _is_blocking(true), _nonip_req(false), _cp_in_use(false) { - memset(_retry_timeout_array, 0, sizeof(_retry_timeout_array)); } void CellularContext::cp_data_received() diff --git a/features/cellular/framework/device/CellularDevice.cpp b/features/cellular/framework/device/CellularDevice.cpp index 602a3e38a1..4ceaaca081 100644 --- a/features/cellular/framework/device/CellularDevice.cpp +++ b/features/cellular/framework/device/CellularDevice.cpp @@ -40,7 +40,7 @@ CellularDevice::CellularDevice(FileHandle *fh) : _sms_ref_count(0), #endif //MBED_CONF_CELLULAR_USE_SMS _info_ref_count(0), _fh(fh), _queue(10 * EVENTS_EVENT_SIZE), _state_machine(0), - _status_cb(0), _nw(0) + _status_cb(), _nw(0) #ifdef MBED_CONF_RTOS_PRESENT , _queue_thread(osPriorityNormal, 2048, NULL, "cellular_queue") #endif // MBED_CONF_RTOS_PRESENT diff --git a/features/cellular/framework/device/CellularStateMachine.cpp b/features/cellular/framework/device/CellularStateMachine.cpp index dd8696e8cd..dded03921b 100644 --- a/features/cellular/framework/device/CellularStateMachine.cpp +++ b/features/cellular/framework/device/CellularStateMachine.cpp @@ -50,7 +50,7 @@ namespace mbed { CellularStateMachine::CellularStateMachine(CellularDevice &device, events::EventQueue &queue, CellularNetwork &nw) : _cellularDevice(device), _state(STATE_INIT), _next_state(_state), _target_state(_state), - _event_status_cb(0), _network(nw), _queue(queue), _sim_pin(0), _retry_count(0), + _event_status_cb(), _network(nw), _queue(queue), _sim_pin(0), _retry_count(0), _event_timeout(-1), _event_id(-1), _plmn(0), _command_success(false), _is_retry(false), _cb_data(), _current_event(CellularDeviceReady), _status(0) { @@ -345,7 +345,7 @@ bool CellularStateMachine::device_ready() #endif // MBED_CONF_CELLULAR_DEBUG_AT send_event_cb(CellularDeviceReady); - _cellularDevice.set_ready_cb(0); + _cellularDevice.set_ready_cb(nullptr); return true; } diff --git a/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp b/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp index 54674199d4..c0e10d71ed 100644 --- a/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp +++ b/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp @@ -35,9 +35,9 @@ GEMALTO_CINTERION_CellularStack::GEMALTO_CINTERION_CellularStack(ATHandler &atHa GEMALTO_CINTERION_CellularStack::~GEMALTO_CINTERION_CellularStack() { - _at.set_urc_handler("^SIS:", 0); - _at.set_urc_handler("^SISW:", 0); - _at.set_urc_handler("^SISR:", 0); + _at.set_urc_handler("^SIS:", nullptr); + _at.set_urc_handler("^SISW:", nullptr); + _at.set_urc_handler("^SISR:", nullptr); } void GEMALTO_CINTERION_CellularStack::urc_sis() diff --git a/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.cpp b/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.cpp index 2f4e3550a4..7c25bc627a 100644 --- a/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.cpp +++ b/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.cpp @@ -48,8 +48,8 @@ QUECTEL_BC95_CellularStack::~QUECTEL_BC95_CellularStack() _event_queue->cancel(_txfull_event_id); } - _at.set_urc_handler("+NSONMI:", NULL); - _at.set_urc_handler("+NSOCLI:", NULL); + _at.set_urc_handler("+NSONMI:", nullptr); + _at.set_urc_handler("+NSOCLI:", nullptr); } nsapi_error_t QUECTEL_BC95_CellularStack::socket_listen(nsapi_socket_t handle, int backlog) diff --git a/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_CellularContext.cpp b/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_CellularContext.cpp index f7ed3b40c7..72ba2458a5 100644 --- a/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_CellularContext.cpp +++ b/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_CellularContext.cpp @@ -39,7 +39,7 @@ QUECTEL_BG96_CellularContext::QUECTEL_BG96_CellularContext(ATHandler &at, Cellul QUECTEL_BG96_CellularContext::~QUECTEL_BG96_CellularContext() { if (_nonip_req) { - _at.set_urc_handler("+QIND:", 0); + _at.set_urc_handler("+QIND:", nullptr); } } diff --git a/features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26_CellularStack.cpp b/features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26_CellularStack.cpp index 83ed44a19c..45bee63716 100644 --- a/features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26_CellularStack.cpp +++ b/features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26_CellularStack.cpp @@ -39,14 +39,14 @@ QUECTEL_M26_CellularStack::QUECTEL_M26_CellularStack(ATHandler &atHandler, int c QUECTEL_M26_CellularStack::~QUECTEL_M26_CellularStack() { - _at.set_urc_handler("5, CLOSED", NULL); - _at.set_urc_handler("4, CLOSED", NULL); - _at.set_urc_handler("3, CLOSED", NULL); - _at.set_urc_handler("2, CLOSED", NULL); - _at.set_urc_handler("1, CLOSED", NULL); - _at.set_urc_handler("0, CLOSED", NULL); + _at.set_urc_handler("5, CLOSED", nullptr); + _at.set_urc_handler("4, CLOSED", nullptr); + _at.set_urc_handler("3, CLOSED", nullptr); + _at.set_urc_handler("2, CLOSED", nullptr); + _at.set_urc_handler("1, CLOSED", nullptr); + _at.set_urc_handler("0, CLOSED", nullptr); - _at.set_urc_handler("+QIRDI:", NULL); + _at.set_urc_handler("+QIRDI:", nullptr); } nsapi_error_t QUECTEL_M26_CellularStack::socket_listen(nsapi_socket_t handle, int backlog) diff --git a/features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX.cpp b/features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX.cpp index c27182c093..b100ca9958 100644 --- a/features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX.cpp +++ b/features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX.cpp @@ -52,7 +52,7 @@ void UBLOX_N2XX::set_at_urcs_impl() UBLOX_N2XX::~UBLOX_N2XX() { - _at->set_urc_handler("+NPIN:", NULL); + _at->set_urc_handler("+NPIN:", nullptr); } // Callback for Sim Pin. diff --git a/features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX_CellularStack.cpp b/features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX_CellularStack.cpp index de9d65ec6f..c3fc9df5ce 100644 --- a/features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX_CellularStack.cpp +++ b/features/cellular/framework/targets/UBLOX/N2XX/UBLOX_N2XX_CellularStack.cpp @@ -31,7 +31,7 @@ UBLOX_N2XX_CellularStack::UBLOX_N2XX_CellularStack(ATHandler &atHandler, int cid UBLOX_N2XX_CellularStack::~UBLOX_N2XX_CellularStack() { - _at.set_urc_handler("+NSONMI:", NULL); + _at.set_urc_handler("+NSONMI:", nullptr); } nsapi_error_t UBLOX_N2XX_CellularStack::socket_listen(nsapi_socket_t handle, int backlog) diff --git a/features/netsocket/nsapi_ppp.h b/features/netsocket/nsapi_ppp.h index 8d47dffe6a..b23a03ac86 100644 --- a/features/netsocket/nsapi_ppp.h +++ b/features/netsocket/nsapi_ppp.h @@ -47,7 +47,7 @@ nsapi_error_t nsapi_ppp_set_blocking(bool blocking); * * @return 0 on success, negative error code on failure */ -nsapi_error_t nsapi_ppp_connect(FileHandle *stream, Callback status_cb = 0, const char *uname = 0, const char *pwd = 0, const nsapi_ip_stack_t stack = DEFAULT_STACK); +nsapi_error_t nsapi_ppp_connect(FileHandle *stream, Callback status_cb = nullptr, const char *uname = 0, const char *pwd = 0, const nsapi_ip_stack_t stack = DEFAULT_STACK); /** Close a PPP connection * diff --git a/features/storage/filesystem/fat/FATFileSystem.cpp b/features/storage/filesystem/fat/FATFileSystem.cpp index 1a77738e08..88dbdebcbd 100644 --- a/features/storage/filesystem/fat/FATFileSystem.cpp +++ b/features/storage/filesystem/fat/FATFileSystem.cpp @@ -93,7 +93,7 @@ public: Deferred &operator=(const Deferred &); public: - Deferred(T t, Callback ondefer = NULL) + Deferred(T t, Callback ondefer = nullptr) : _t(t), _ondefer(ondefer) { } diff --git a/platform/SharedPtr.h b/platform/SharedPtr.h index 22f81f9ec3..73a3b3c80d 100644 --- a/platform/SharedPtr.h +++ b/platform/SharedPtr.h @@ -44,9 +44,9 @@ namespace mbed { * // Increase reference count * SharedPtr ptr2( ptr ); * - * ptr = NULL; // Reference to the struct instance is still held by ptr2 + * ptr = nullptr; // Reference to the struct instance is still held by ptr2 * - * ptr2 = NULL; // The raw pointer is freed + * ptr2 = nullptr; // The raw pointer is freed * } * @endcode *