diff --git a/Sming/Arch/Esp32/Services/Profiling/TaskStat.cpp b/Sming/Arch/Esp32/Services/Profiling/TaskStat.cpp index 97a69e98db..8a83c1e20b 100644 --- a/Sming/Arch/Esp32/Services/Profiling/TaskStat.cpp +++ b/Sming/Arch/Esp32/Services/Profiling/TaskStat.cpp @@ -27,7 +27,7 @@ struct TaskStat::Info { TaskStat::TaskStat(Print& out) : out(out) { #if CONFIG_FREERTOS_USE_TRACE_FACILITY && CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS - taskInfo.reset(new Info[2]); + taskInfo = std::make_unique(2); #endif } diff --git a/Sming/Arch/Host/Components/driver/hw_timer.cpp b/Sming/Arch/Host/Components/driver/hw_timer.cpp index e0d8f2c28c..0ceacae8fa 100644 --- a/Sming/Arch/Host/Components/driver/hw_timer.cpp +++ b/Sming/Arch/Host/Components/driver/hw_timer.cpp @@ -205,7 +205,7 @@ static std::unique_ptr timer1; void hw_timer_init(void) { - timer1.reset(new CTimerThread("Timer1")); + timer1 = std::make_unique("Timer1"); } void hw_timer_cleanup() diff --git a/Sming/Arch/Host/Components/driver/uart_server.cpp b/Sming/Arch/Host/Components/driver/uart_server.cpp index aadc360bd1..86bcdb8ed3 100644 --- a/Sming/Arch/Host/Components/driver/uart_server.cpp +++ b/Sming/Arch/Host/Components/driver/uart_server.cpp @@ -170,9 +170,9 @@ void startup(const Config& config) auto& server = servers[i]; if(devname == nullptr) { - server.reset(new CUartPort(i)); + server = std::make_unique(i); } else { - server.reset(new CUartDevice(i, devname, config.baud[i])); + server = std::make_unique(i, devname, config.baud[i]); } server->execute(); } @@ -450,7 +450,7 @@ void* CUartDevice::thread_routine() while(!done) { if(txsem.timedwait(IDLE_SLEEP_MS * 1000)) { if(uart != nullptr && !device) { - device.reset(new SerialDevice); + device = std::make_unique(); char res = device->openDevice(deviceName, uart->baud_rate); if(res != 1) { host_debug_e("UART%u error %d opening serial device '%s'", uart_nr, res, deviceName); diff --git a/Sming/Arch/Rp2040/Components/rp2040/src/wifi.cpp b/Sming/Arch/Rp2040/Components/rp2040/src/wifi.cpp index 4c87e488a7..3f4bc29f78 100644 --- a/Sming/Arch/Rp2040/Components/rp2040/src/wifi.cpp +++ b/Sming/Arch/Rp2040/Components/rp2040/src/wifi.cpp @@ -26,14 +26,12 @@ namespace { class Decompressor { public: - explicit Decompressor(const FSTR::ObjectBase& data) + explicit Decompressor(const FSTR::ObjectBase& data) : stream(new FlashMemoryStream(data)) { - stream.reset(new FlashMemoryStream(data)); } - explicit Decompressor(Storage::Partition part) + explicit Decompressor(Storage::Partition part) : stream(new Storage::PartitionStream(part)) { - stream.reset(new Storage::PartitionStream(part)); } bool init() @@ -90,13 +88,13 @@ std::unique_ptr decompressor; int cyw43_storage_init() { #ifdef CYW43_FIRMWARE - decompressor.reset(new Decompressor(cyw43_firmware)); + decompressor = std::make_unique(cyw43_firmware); #else auto part = Storage::findPartition("cyw43_fw"); if(!part) { debug_e("Failed to find CYW43 firmware partition"); } else { - decompressor.reset(new Decompressor(part)); + decompressor = std::make_unique(part); } #endif diff --git a/Sming/Components/Hosted/include/Hosted/Transport/TcpClientTransport.h b/Sming/Components/Hosted/include/Hosted/Transport/TcpClientTransport.h index 4ab6e1c9ac..0971b0c496 100644 --- a/Sming/Components/Hosted/include/Hosted/Transport/TcpClientTransport.h +++ b/Sming/Components/Hosted/include/Hosted/Transport/TcpClientTransport.h @@ -25,10 +25,9 @@ namespace Transport class TcpClientTransport : public TcpTransport { public: - TcpClientTransport(TcpClient& client) + TcpClientTransport(TcpClient& client) : stream(new TcpClientStream(client)) { client.setReceiveDelegate(TcpClientDataDelegate(&TcpClientTransport::process, this)); - stream.reset(new TcpClientStream(client)); } protected: diff --git a/Sming/Components/IFS b/Sming/Components/IFS index 36637f4e20..274e4b7495 160000 --- a/Sming/Components/IFS +++ b/Sming/Components/IFS @@ -1 +1 @@ -Subproject commit 36637f4e207e14d2484b9b827c573f1ba54392cd +Subproject commit 274e4b7495ed8ac54a2c52b6659414bc147f8e6c diff --git a/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp b/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp index 73921ae8e7..303dea5fb6 100644 --- a/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp +++ b/Sming/Components/Network/Arch/Esp32/Platform/StationImpl.cpp @@ -522,7 +522,7 @@ bool StationImpl::smartConfigStart(SmartConfigType sctype, SmartConfigDelegate c return false; } - smartConfigEventInfo.reset(new SmartConfigEventInfo{}); + smartConfigEventInfo = std::make_unique(); if(!smartConfigEventInfo) { return false; } diff --git a/Sming/Components/Network/Arch/Esp8266/Platform/AccessPointImpl.cpp b/Sming/Components/Network/Arch/Esp8266/Platform/AccessPointImpl.cpp index 775dc07f70..d83ef86dd3 100644 --- a/Sming/Components/Network/Arch/Esp8266/Platform/AccessPointImpl.cpp +++ b/Sming/Components/Network/Arch/Esp8266/Platform/AccessPointImpl.cpp @@ -82,7 +82,7 @@ bool AccessPointImpl::config(const String& ssid, String password, AUTH_MODE mode debugf("AP configuration was updated"); } else { debugf("Set AP configuration in background"); - runConfig.reset(new softap_config(config)); + runConfig = std::make_unique(config); } } else { debugf("AP configuration loaded"); diff --git a/Sming/Components/rboot/include/Network/RbootHttpUpdater.h b/Sming/Components/rboot/include/Network/RbootHttpUpdater.h index c17ba2db7b..fda0ce60c8 100644 --- a/Sming/Components/rboot/include/Network/RbootHttpUpdater.h +++ b/Sming/Components/rboot/include/Network/RbootHttpUpdater.h @@ -37,15 +37,14 @@ class RbootHttpUpdater : protected HttpClient std::unique_ptr stream; // (optional) output stream to use. Item(String url, uint32_t targetOffset, size_t size, RbootOutputStream* stream) - : url(url), targetOffset(targetOffset), size(size) + : url(url), targetOffset(targetOffset), size(size), stream(stream) { - this->stream.reset(stream); } RbootOutputStream* getStream() { if(!stream) { - stream.reset(new RbootOutputStream(targetOffset, size)); + stream = std::make_unique(targetOffset, size); } return stream.get(); } diff --git a/Sming/Components/ssl/Axtls/AxConnection.h b/Sming/Components/ssl/Axtls/AxConnection.h index a73b7aedea..1099094b80 100644 --- a/Sming/Components/ssl/Axtls/AxConnection.h +++ b/Sming/Components/ssl/Axtls/AxConnection.h @@ -61,7 +61,7 @@ class AxConnection : public Connection const Certificate* getCertificate() const override { if(!certificate && ssl->x509_ctx != nullptr) { - certificate.reset(new AxCertificate(ssl)); + certificate = std::make_unique(ssl); } return certificate.get(); diff --git a/Sming/Components/ssl/BearSsl/BrClientConnection.cpp b/Sming/Components/ssl/BearSsl/BrClientConnection.cpp index ed41eab55d..35906f9172 100644 --- a/Sming/Components/ssl/BearSsl/BrClientConnection.cpp +++ b/Sming/Components/ssl/BearSsl/BrClientConnection.cpp @@ -69,8 +69,8 @@ void BrClientConnection::startCert(uint32_t length) return; } - certificate.reset(new BrCertificate); - x509Decoder.reset(new X509Decoder(&certificate->subject, &certificate->issuer)); + certificate = std::make_unique(); + x509Decoder = std::make_unique(&certificate->subject, &certificate->issuer); auto& types = context.session.validators.fingerprintTypes; resetHash(certSha1Context, types.contains(Fingerprint::Type::CertSha1)); diff --git a/Sming/Components/ssl/BearSsl/BrConnection.cpp b/Sming/Components/ssl/BearSsl/BrConnection.cpp index fc37057eef..faf06c890d 100644 --- a/Sming/Components/ssl/BearSsl/BrConnection.cpp +++ b/Sming/Components/ssl/BearSsl/BrConnection.cpp @@ -106,7 +106,7 @@ int BrConnection::init(size_t bufferSize, bool bidi) bufferSize += MAX_OUT_OVERHEAD; } debug_i("Using buffer size of %u bytes", bufferSize); - buffer.reset(new uint8_t[bufferSize]); + buffer = std::make_unique(bufferSize); if(!buffer) { debug_e("Buffer allocation failed"); return -BR_ERR_BAD_PARAM; diff --git a/Sming/Components/ssl/src/Session.cpp b/Sming/Components/ssl/src/Session.cpp index c896799ce5..115325894f 100644 --- a/Sming/Components/ssl/src/Session.cpp +++ b/Sming/Components/ssl/src/Session.cpp @@ -200,7 +200,7 @@ void Session::handshakeComplete(bool success) // If requested, take a copy of the session ID for later re-use if(options.sessionResume) { if(!sessionId) { - sessionId.reset(new SessionId); + sessionId = std::make_unique(); } *sessionId = connection->getSessionId(); } diff --git a/Sming/Core/Data/CsvReader.h b/Sming/Core/Data/CsvReader.h index a8aa9cc151..596a62a27e 100644 --- a/Sming/Core/Data/CsvReader.h +++ b/Sming/Core/Data/CsvReader.h @@ -47,10 +47,9 @@ class CsvReader */ CsvReader(IDataSourceStream* source, char fieldSeparator = ',', const CStringArray& headings = nullptr, size_t maxLineLength = 2048) - : fieldSeparator(fieldSeparator), userHeadingsProvided(headings), maxLineLength(maxLineLength), + : source(source), fieldSeparator(fieldSeparator), userHeadingsProvided(headings), maxLineLength(maxLineLength), headings(headings) { - this->source.reset(source); reset(); } diff --git a/Sming/Core/Data/Stream/EndlessMemoryStream.cpp b/Sming/Core/Data/Stream/EndlessMemoryStream.cpp index 50eb5e7f8a..b5690166ed 100644 --- a/Sming/Core/Data/Stream/EndlessMemoryStream.cpp +++ b/Sming/Core/Data/Stream/EndlessMemoryStream.cpp @@ -27,7 +27,7 @@ bool EndlessMemoryStream::seek(int len) size_t EndlessMemoryStream::write(const uint8_t* buffer, size_t size) { if(!stream) { - stream.reset(new MemoryDataStream()); + stream = std::make_unique(); } return stream->write(buffer, size); diff --git a/Sming/Core/Data/Stream/SectionStream.cpp b/Sming/Core/Data/Stream/SectionStream.cpp index 56e663e52f..9ae9c977f1 100644 --- a/Sming/Core/Data/Stream/SectionStream.cpp +++ b/Sming/Core/Data/Stream/SectionStream.cpp @@ -22,7 +22,7 @@ void SectionStream::scanSource(uint8_t maxSections) constexpr size_t bufSize{512}; char buffer[bufSize]; - sections.reset(new Section[maxSections]{}); + sections = std::make_unique(maxSections); size_t offset{0}; while(sectionCount < maxSections && !stream->isFinished()) { diff --git a/Sming/Core/Data/StreamTransformer.cpp b/Sming/Core/Data/StreamTransformer.cpp index 8014cbfd7c..efdd91032a 100644 --- a/Sming/Core/Data/StreamTransformer.cpp +++ b/Sming/Core/Data/StreamTransformer.cpp @@ -20,8 +20,8 @@ uint16_t StreamTransformer::readMemoryBlock(char* data, int bufSize) return 0; } - if(tempStream == nullptr) { - tempStream.reset(new CircularBuffer(NETWORK_SEND_BUFFER_SIZE + 10)); + if(!tempStream) { + tempStream = std::make_unique(NETWORK_SEND_BUFFER_SIZE + 10); } // Use provided buffer as a temporary store for this operation diff --git a/Sming/Libraries/DiskStorage b/Sming/Libraries/DiskStorage index c467f3f0f9..3c649c03d4 160000 --- a/Sming/Libraries/DiskStorage +++ b/Sming/Libraries/DiskStorage @@ -1 +1 @@ -Subproject commit c467f3f0f9f504aecf134ec45780971da1595399 +Subproject commit 3c649c03d4a2e7b21c3648184ad8ebe9e0723c96 diff --git a/Sming/Libraries/FatIFS b/Sming/Libraries/FatIFS index b4c11f4f28..be552e65fa 160000 --- a/Sming/Libraries/FatIFS +++ b/Sming/Libraries/FatIFS @@ -1 +1 @@ -Subproject commit b4c11f4f28deb99fe48c25a16f0f72915202c05d +Subproject commit be552e65fa4b0bcacdaa1516d8ed75f7107228fb diff --git a/Sming/Libraries/HardwareSPI b/Sming/Libraries/HardwareSPI index 7f6516c7eb..5c8a52121a 160000 --- a/Sming/Libraries/HardwareSPI +++ b/Sming/Libraries/HardwareSPI @@ -1 +1 @@ -Subproject commit 7f6516c7eb24a3b3bf92e5f64c1722a268b0d553 +Subproject commit 5c8a52121aa788495c21172ceb724cfc1975411b diff --git a/Sming/Libraries/IOControl b/Sming/Libraries/IOControl index f860a2ae08..b84671a34d 160000 --- a/Sming/Libraries/IOControl +++ b/Sming/Libraries/IOControl @@ -1 +1 @@ -Subproject commit f860a2ae08d70819f4d4487f9ed559dc0164615c +Subproject commit b84671a34d452c49a0743b33070942c4bae3a474 diff --git a/Sming/Libraries/OtaNetwork/src/include/Ota/Network/HttpUpgrader.h b/Sming/Libraries/OtaNetwork/src/include/Ota/Network/HttpUpgrader.h index 4d1e8f3259..edf0d1502b 100644 --- a/Sming/Libraries/OtaNetwork/src/include/Ota/Network/HttpUpgrader.h +++ b/Sming/Libraries/OtaNetwork/src/include/Ota/Network/HttpUpgrader.h @@ -46,7 +46,7 @@ class HttpUpgrader : protected HttpClient ReadWriteStream* getStream() { if(!stream) { - stream.reset(new Ota::UpgradeOutputStream(partition)); + stream = std::make_unique(partition); } return stream.get(); } diff --git a/Sming/Libraries/Yeelight/YeelightBulb.cpp b/Sming/Libraries/Yeelight/YeelightBulb.cpp index b7d23e77a0..132ec579c7 100644 --- a/Sming/Libraries/Yeelight/YeelightBulb.cpp +++ b/Sming/Libraries/Yeelight/YeelightBulb.cpp @@ -34,7 +34,7 @@ bool YeelightBulb::connect() return true; } - connection.reset(new TcpClient(TcpClientDataDelegate(&YeelightBulb::onResponse, this))); + connection = std::make_unique(TcpClientDataDelegate(&YeelightBulb::onResponse, this)); connection->setTimeOut(USHRT_MAX); // Stay connected forever diff --git a/samples/Basic_Audio/app/application.cpp b/samples/Basic_Audio/app/application.cpp index d0a2f3e1be..30c549a672 100644 --- a/samples/Basic_Audio/app/application.cpp +++ b/samples/Basic_Audio/app/application.cpp @@ -57,7 +57,7 @@ static struct { Serial << _F("Generating sine wave table @ ") << frequency << _F(" Hz, ") << sampleCount << _F(" samples") << endl; - samples.reset(new uint16_t[sampleCount]); + samples = std::make_unique(sampleCount); if(!samples) { debug_e("Memory allocation failed"); return false; diff --git a/samples/Basic_Ota/app/application.cpp b/samples/Basic_Ota/app/application.cpp index 2663252230..f9aa5f7153 100644 --- a/samples/Basic_Ota/app/application.cpp +++ b/samples/Basic_Ota/app/application.cpp @@ -49,7 +49,7 @@ void doUpgrade() Serial.println(F("Updating...")); // need a clean object, otherwise if run before and failed will not run again - otaUpdater.reset(new Ota::Network::HttpUpgrader); + otaUpdater = std::make_unique(); // select rom slot to flash auto part = ota.getNextBootPartition(); diff --git a/samples/Basic_Serial/include/SerialTransmitDemo.h b/samples/Basic_Serial/include/SerialTransmitDemo.h index 2e9d032cb7..0b0afa31c9 100644 --- a/samples/Basic_Serial/include/SerialTransmitDemo.h +++ b/samples/Basic_Serial/include/SerialTransmitDemo.h @@ -8,9 +8,8 @@ class SerialTransmitDemo { public: - SerialTransmitDemo(HardwareSerial& serial, IDataSourceStream* stream) : serial(serial) + SerialTransmitDemo(HardwareSerial& serial, IDataSourceStream* stream) : serial(serial), stream(stream) { - this->stream.reset(stream); serial.onTransmitComplete(TransmitCompleteDelegate(&SerialTransmitDemo::onTransmitComplete, this)); }