mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-24 19:42:27 +03:00
remove (std::nothrow) where nullptr case is not handled
remove legacy new management
This commit is contained in:
@ -203,7 +203,7 @@ int LittleFSImpl::lfs_flash_sync(const struct lfs_config *c) {
|
||||
#endif
|
||||
|
||||
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_LITTLEFS)
|
||||
FS LittleFS = FS(FSImplPtr(new (std::nothrow) littlefs_impl::LittleFSImpl(FS_PHYS_ADDR, FS_PHYS_SIZE, FS_PHYS_PAGE, FS_PHYS_BLOCK, FS_MAX_OPEN_FILES)));
|
||||
FS LittleFS = FS(FSImplPtr(new littlefs_impl::LittleFSImpl(FS_PHYS_ADDR, FS_PHYS_SIZE, FS_PHYS_PAGE, FS_PHYS_BLOCK, FS_MAX_OPEN_FILES)));
|
||||
|
||||
extern "C" void littlefs_request_end(void)
|
||||
{
|
||||
|
@ -324,11 +324,7 @@ class LittleFSFileImpl : public FileImpl
|
||||
{
|
||||
public:
|
||||
LittleFSFileImpl(LittleFSImpl* fs, const char *name, std::shared_ptr<lfs_file_t> fd, int flags, time_t creation) : _fs(fs), _fd(fd), _opened(true), _flags(flags), _creation(creation) {
|
||||
_name = std::shared_ptr<char>(new (std::nothrow) char[strlen(name) + 1], std::default_delete<char[]>());
|
||||
if (!_name) {
|
||||
close();
|
||||
return;
|
||||
}
|
||||
_name = std::shared_ptr<char>(new char[strlen(name) + 1], std::default_delete<char[]>());
|
||||
strcpy(_name.get(), name);
|
||||
}
|
||||
|
||||
@ -521,26 +517,17 @@ public:
|
||||
{
|
||||
memset(&_dirent, 0, sizeof(_dirent));
|
||||
if (dirPath) {
|
||||
_dirPath = std::shared_ptr<char>(new (std::nothrow) char[strlen(dirPath) + 1], std::default_delete<char[]>());
|
||||
if (_dirPath == nullptr) {
|
||||
close();
|
||||
return;
|
||||
}
|
||||
_dirPath = std::shared_ptr<char>(new char[strlen(dirPath) + 1], std::default_delete<char[]>());
|
||||
strcpy(_dirPath.get(), dirPath);
|
||||
}
|
||||
}
|
||||
|
||||
void close () {
|
||||
~LittleFSDirImpl() override {
|
||||
if (_opened) {
|
||||
lfs_dir_close(_fs->getFS(), _getDir());
|
||||
_opened = false;
|
||||
}
|
||||
}
|
||||
|
||||
~LittleFSDirImpl() override {
|
||||
close();
|
||||
}
|
||||
|
||||
FileImplPtr openFile(OpenMode openMode, AccessMode accessMode) override {
|
||||
if (!_valid) {
|
||||
return FileImplPtr();
|
||||
|
Reference in New Issue
Block a user