mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-15 00:02:49 +03:00
remove (std::nothrow) where nullptr case is not handled
remove legacy new management
This commit is contained in:
@ -128,7 +128,7 @@ void setup(void){
|
||||
Serial.println("MDNS responder started");
|
||||
}
|
||||
|
||||
server.getServer().setRSACert(new (std::nothrow) BearSSL::X509List(serverCert), new (std::nothrow) BearSSL::PrivateKey(serverKey));
|
||||
server.getServer().setRSACert(new BearSSL::X509List(serverCert), new BearSSL::PrivateKey(serverKey));
|
||||
|
||||
server.on("/", handleRoot);
|
||||
|
||||
|
@ -111,7 +111,7 @@ void setup() {
|
||||
ESP.restart();
|
||||
}
|
||||
|
||||
server.getServer().setRSACert(new (std::nothrow) BearSSL::X509List(serverCert), new (std::nothrow) BearSSL::PrivateKey(serverKey));
|
||||
server.getServer().setRSACert(new BearSSL::X509List(serverCert), new BearSSL::PrivateKey(serverKey));
|
||||
server.on("/",showcredentialpage); //for this simple example, just show a simple page for changing credentials at the root
|
||||
server.on("/" + change_creds,handlecredentialchange); //handles submission of credentials from the client
|
||||
server.onNotFound(redirect);
|
||||
|
@ -266,7 +266,7 @@ void ESP8266WebServerTemplate<ServerType>::on(const Uri &uri, HTTPMethod method,
|
||||
|
||||
template <typename ServerType>
|
||||
void ESP8266WebServerTemplate<ServerType>::on(const Uri &uri, HTTPMethod method, ESP8266WebServerTemplate<ServerType>::THandlerFunction fn, ESP8266WebServerTemplate<ServerType>::THandlerFunction ufn) {
|
||||
_addRequestHandler(new (std::nothrow) FunctionRequestHandler<ServerType>(fn, ufn, uri, method));
|
||||
_addRequestHandler(new FunctionRequestHandler<ServerType>(fn, ufn, uri, method));
|
||||
}
|
||||
|
||||
template <typename ServerType>
|
||||
@ -288,7 +288,7 @@ void ESP8266WebServerTemplate<ServerType>::_addRequestHandler(RequestHandlerType
|
||||
|
||||
template <typename ServerType>
|
||||
void ESP8266WebServerTemplate<ServerType>::serveStatic(const char* uri, FS& fs, const char* path, const char* cache_header) {
|
||||
_addRequestHandler(new (std::nothrow) StaticRequestHandler<ServerType>(fs, path, uri, cache_header));
|
||||
_addRequestHandler(new StaticRequestHandler<ServerType>(fs, path, uri, cache_header));
|
||||
}
|
||||
|
||||
template <typename ServerType>
|
||||
@ -645,9 +645,7 @@ void ESP8266WebServerTemplate<ServerType>::collectHeaders(const char* headerKeys
|
||||
_headerKeysCount = headerKeysCount + 1;
|
||||
if (_currentHeaders)
|
||||
delete[]_currentHeaders;
|
||||
_currentHeaders = new (std::nothrow) RequestArgument[_headerKeysCount];
|
||||
if (_currentHeaders == nullptr)
|
||||
return;
|
||||
_currentHeaders = new RequestArgument[_headerKeysCount];
|
||||
_currentHeaders[0].key = FPSTR(AUTHORIZATION_HEADER);
|
||||
for (int i = 1; i < _headerKeysCount; i++){
|
||||
_currentHeaders[i].key = headerKeys[i-1];
|
||||
|
@ -283,9 +283,7 @@ void ESP8266WebServerTemplate<ServerType>::_parseArguments(const String& data) {
|
||||
_currentArgCount = _parseArgumentsPrivate(data, nullArgHandler());
|
||||
|
||||
// allocate one more, this is needed because {"plain": plainBuf} is always added
|
||||
_currentArgs = new (std::nothrow) RequestArgument[_currentArgCount + 1];
|
||||
if (_currentArgs == nullptr)
|
||||
return;
|
||||
_currentArgs = new RequestArgument[_currentArgCount + 1];
|
||||
|
||||
(void)_parseArgumentsPrivate(data, storeArgHandler<ServerType>());
|
||||
}
|
||||
@ -372,11 +370,7 @@ bool ESP8266WebServerTemplate<ServerType>::_parseForm(ClientType& client, const
|
||||
//start reading the form
|
||||
if (line == ("--"+boundary)){
|
||||
if(_postArgs) delete[] _postArgs;
|
||||
_postArgs = new (std::nothrow) RequestArgument[WEBSERVER_MAX_POST_ARGS];
|
||||
if (_postArgs == nullptr) {
|
||||
DBGWS("Parse form: oom\n");
|
||||
return false;
|
||||
}
|
||||
_postArgs = new RequestArgument[WEBSERVER_MAX_POST_ARGS];
|
||||
_postArgsLen = 0;
|
||||
while(1){
|
||||
String argName;
|
||||
@ -434,11 +428,7 @@ bool ESP8266WebServerTemplate<ServerType>::_parseForm(ClientType& client, const
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
_currentUpload.reset(new (std::nothrow) HTTPUpload());
|
||||
if (_currentUpload == nullptr) {
|
||||
DBGWS("Parse form: oom\n");
|
||||
return false;
|
||||
}
|
||||
_currentUpload.reset(new HTTPUpload());
|
||||
_currentUpload->status = UPLOAD_FILE_START;
|
||||
_currentUpload->name = argName;
|
||||
_currentUpload->filename = argFilename;
|
||||
@ -531,9 +521,7 @@ readfile:
|
||||
arg.value = _currentArgs[iarg].value;
|
||||
}
|
||||
if (_currentArgs) delete[] _currentArgs;
|
||||
_currentArgs = new (std::nothrow) RequestArgument[_postArgsLen];
|
||||
if (_currentArgs == nullptr)
|
||||
return false;
|
||||
_currentArgs = new RequestArgument[_postArgsLen];
|
||||
for (iarg = 0; iarg < _postArgsLen; iarg++){
|
||||
RequestArgument& arg = _currentArgs[iarg];
|
||||
arg.key = _postArgs[iarg].key;
|
||||
|
@ -16,7 +16,7 @@ class Uri {
|
||||
virtual ~Uri() {}
|
||||
|
||||
virtual Uri* clone() const {
|
||||
return new (std::nothrow) Uri(_uri);
|
||||
return new Uri(_uri);
|
||||
};
|
||||
|
||||
virtual bool canHandle(const String &requestUri, __attribute__((unused)) std::vector<String> &pathArgs) {
|
||||
|
@ -10,7 +10,7 @@ class UriBraces : public Uri {
|
||||
explicit UriBraces(const String &uri) : Uri(uri) {};
|
||||
|
||||
Uri* clone() const override final {
|
||||
return new (std::nothrow) UriBraces(_uri);
|
||||
return new UriBraces(_uri);
|
||||
};
|
||||
|
||||
bool canHandle(const String &requestUri, std::vector<String> &pathArgs) override final {
|
||||
|
@ -11,7 +11,7 @@ class UriGlob : public Uri {
|
||||
explicit UriGlob(const String &uri) : Uri(uri) {};
|
||||
|
||||
Uri* clone() const override final {
|
||||
return new (std::nothrow) UriGlob(_uri);
|
||||
return new UriGlob(_uri);
|
||||
};
|
||||
|
||||
bool canHandle(const String &requestUri, __attribute__((unused)) std::vector<String> &pathArgs) override final {
|
||||
|
@ -25,7 +25,7 @@ class UriRegex : public Uri {
|
||||
}
|
||||
|
||||
Uri* clone() const override final {
|
||||
return new (std::nothrow) UriRegex(_uri);
|
||||
return new UriRegex(_uri);
|
||||
};
|
||||
|
||||
bool canHandle(const String &requestUri, std::vector<String> &pathArgs) override final {
|
||||
|
Reference in New Issue
Block a user