1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-23 08:45:22 +03:00

remove (std::nothrow) where nullptr case is not handled

remove legacy new management
This commit is contained in:
david gauchard
2020-08-24 09:51:58 +02:00
parent a16e1e5b8a
commit 11f7d1766e
42 changed files with 125 additions and 326 deletions

View File

@ -106,9 +106,9 @@ void ArduinoOTAClass::setRebootOnSuccess(bool reboot){
_rebootOnSuccess = reboot;
}
bool ArduinoOTAClass::begin(bool useMDNS) {
void ArduinoOTAClass::begin(bool useMDNS) {
if (_initialized)
return true;
return;
_useMDNS = useMDNS;
@ -126,13 +126,11 @@ bool ArduinoOTAClass::begin(bool useMDNS) {
_udp_ota = 0;
}
_udp_ota = new (std::nothrow) UdpContext;
if (_udp_ota == nullptr)
return false;
_udp_ota = new UdpContext;
_udp_ota->ref();
if(!_udp_ota->listen(IP_ADDR_ANY, _port))
return false;
return;
_udp_ota->onRx(std::bind(&ArduinoOTAClass::_onRx, this));
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_MDNS)
@ -151,7 +149,6 @@ bool ArduinoOTAClass::begin(bool useMDNS) {
#ifdef OTA_DEBUG
OTA_DEBUG.printf("OTA server at: %s.local:%u\n", _hostname.c_str(), _port);
#endif
return true;
}
int ArduinoOTAClass::parseInt(){

View File

@ -60,7 +60,7 @@ class ArduinoOTAClass
void onProgress(THandlerFunction_Progress fn);
//Starts the ArduinoOTA service
bool begin(bool useMDNS = true);
void begin(bool useMDNS = true);
//Call this in loop() to run the service. Also calls MDNS.update() when begin() or begin(true) is used.
void handle();