Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/Storage')
-rw-r--r--src/Storage/FileData.h47
-rw-r--r--src/Storage/FileInfoParser.h16
-rw-r--r--src/Storage/FileWriteBuffer.h8
-rw-r--r--src/Storage/MassStorage.h20
4 files changed, 51 insertions, 40 deletions
diff --git a/src/Storage/FileData.h b/src/Storage/FileData.h
index ca2a000f..22f4f6bf 100644
--- a/src/Storage/FileData.h
+++ b/src/Storage/FileData.h
@@ -26,7 +26,7 @@ public:
f = other.f;
if (f != nullptr)
{
- f->Duplicate();
+ not_null(f)->Duplicate();
}
}
@@ -62,7 +62,7 @@ public:
{
if (f != nullptr)
{
- bool ok = f->Close();
+ bool ok = not_null(f)->Close();
f = nullptr;
return ok;
}
@@ -70,61 +70,72 @@ public:
}
bool Read(char& b) noexcept
+ pre(IsLive())
{
- return f->Read(b);
+ return not_null(f)->Read(b);
}
int Read(char *buf, size_t nBytes) noexcept
+ pre(IsLive())
{
- return f->Read(buf, nBytes);
+ return not_null(f)->Read(buf, nBytes);
}
# if HAS_MASS_STORAGE || HAS_SBC_INTERFACE
bool Write(char b) noexcept
+ pre(IsLive())
{
- return f->Write(b);
+ return not_null(f)->Write(b);
}
- bool Write(const char *s) noexcept
+ bool Write(const char *_ecv_array s) noexcept
+ pre(IsLive())
{
- return f->Write(s, strlen(s));
+ return not_null(f)->Write(s, strlen(s));
}
- bool Write(const char *s, size_t len) noexcept
+ bool Write(const char *_ecv_array s, size_t len) noexcept
+ pre(IsLive())
{
- return f->Write(s, len);
+ return not_null(f)->Write(s, len);
}
- bool Write(const uint8_t *s, size_t len) noexcept
+ bool Write(const uint8_t *_ecv_array s, size_t len) noexcept
+ pre(IsLive())
{
- return f->Write(s, len);
+ return not_null(f)->Write(s, len);
}
// This returns the CRC32 of data written to a newly-created file. It does not calculate the CRC of an existing file.
uint32_t GetCrc32() const noexcept
+ pre(IsLive())
{
- return f->GetCRC32();
+ return not_null(f)->GetCRC32();
}
bool Flush() noexcept
+ pre(IsLive())
{
- return f->Flush();
+ return not_null(f)->Flush();
}
# endif
FilePosition GetPosition() const noexcept
+ pre(IsLive())
{
- return f->Position();
+ return not_null(f)->Position();
}
bool Seek(FilePosition position) noexcept
+ pre(IsLive())
{
- return f->Seek(position);
+ return not_null(f)->Seek(position);
}
FilePosition Length() const noexcept
+ pre(IsLive())
{
- return f->Length();
+ return not_null(f)->Length();
}
// Move operator
@@ -142,12 +153,12 @@ public:
f = other.f;
if (f != nullptr)
{
- f->Duplicate();
+ not_null(f)->Duplicate();
}
}
private:
- FileStore *f;
+ FileStore * null f;
void Init() noexcept
{
diff --git a/src/Storage/FileInfoParser.h b/src/Storage/FileInfoParser.h
index b350de06..8728a4a5 100644
--- a/src/Storage/FileInfoParser.h
+++ b/src/Storage/FileInfoParser.h
@@ -47,18 +47,18 @@ public:
// The following method needs to be called repeatedly until it doesn't return GCodeResult::notFinished - this may take a few runs
GCodeResult GetFileInfo(const char *filePath, GCodeFileInfo& info, bool quitEarly) noexcept;
- static constexpr const char* SimulatedTimeString = "\n; Simulated print time"; // used by FileInfoParser and MassStorage
+ static constexpr const char *_ecv_array SimulatedTimeString = "\n; Simulated print time"; // used by FileInfoParser and MassStorage
private:
// G-Code parser methods
- bool FindHeight(const char* bufp, size_t len) noexcept;
- bool FindLayerHeight(const char* bufp) noexcept;
- bool FindSlicerInfo(const char* bufp) noexcept;
- bool FindPrintTime(const char* bufp) noexcept;
- bool FindSimulatedTime(const char* bufp) noexcept;
- unsigned int FindFilamentUsed(const char* bufp) noexcept;
- void FindFilamentUsedEmbedded(const char* p, const char *s1, const char *s2, unsigned int &filamentsFound) noexcept;
+ bool FindHeight(const char *_ecv_array bufp, size_t len) noexcept;
+ bool FindLayerHeight(const char *_ecv_array bufp) noexcept;
+ bool FindSlicerInfo(const char *_ecv_array bufp) noexcept;
+ bool FindPrintTime(const char *_ecv_array bufp) noexcept;
+ bool FindSimulatedTime(const char *_ecv_array bufp) noexcept;
+ unsigned int FindFilamentUsed(const char *_ecv_array bufp) noexcept;
+ void FindFilamentUsedEmbedded(const char *_ecv_array p, const char *_ecv_array s1, const char *_ecv_array s2, unsigned int &filamentsFound) noexcept;
// We parse G-Code files in multiple stages. These variables hold the required information
Mutex parserMutex;
diff --git a/src/Storage/FileWriteBuffer.h b/src/Storage/FileWriteBuffer.h
index 26f05fa4..5f5deb39 100644
--- a/src/Storage/FileWriteBuffer.h
+++ b/src/Storage/FileWriteBuffer.h
@@ -40,15 +40,15 @@ public:
#if SAME70
FileWriteBuffer(FileWriteBuffer *n, char *storage) noexcept : next(n), index(0), buf(storage) { }
#else
- FileWriteBuffer(FileWriteBuffer *n) noexcept : next(n), index(0) { }
+ explicit FileWriteBuffer(FileWriteBuffer *n) noexcept : next(n), index(0) { }
#endif
static void UsingSbcMode() { fileWriteBufLen = SbcFileWriteBufLen; } // only called by RepRap on startup
FileWriteBuffer *Next() const noexcept { return next; }
void SetNext(FileWriteBuffer *n) noexcept { next = n; }
- char *Data() noexcept { return buf; }
- const char *Data() const noexcept { return buf; }
+ char *_ecv_array Data() noexcept { return buf; }
+ const char *_ecv_array Data() const noexcept { return buf; }
const size_t BytesStored() const noexcept { return index; }
const size_t BytesLeft() const noexcept { return fileWriteBufLen - index; }
@@ -62,7 +62,7 @@ private:
size_t index;
#if SAME70
- char *buf;
+ char *_ecv_array buf;
#else
alignas(4) char buf[FileWriteBufLen]; // 32-bit aligned buffer for better HSMCI performance
#endif
diff --git a/src/Storage/MassStorage.h b/src/Storage/MassStorage.h
index 3753923b..86b0782f 100644
--- a/src/Storage/MassStorage.h
+++ b/src/Storage/MassStorage.h
@@ -64,30 +64,30 @@ namespace MassStorage
#if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES
bool DirectoryExists(const StringRef& path) noexcept; // Warning: if 'path' has a trailing '/' or '\\' character, it will be removed!
- bool DirectoryExists(const char *path) noexcept;
+ bool DirectoryExists(const char *_ecv_array path) noexcept;
unsigned int GetNumFreeFiles() noexcept;
bool IsDriveMounted(size_t drive) noexcept;
- bool FindFirst(const char *directory, FileInfo &file_info) noexcept;
+ bool FindFirst(const char *_ecv_array directory, FileInfo &file_info) noexcept;
bool FindNext(FileInfo &file_info) noexcept;
void AbandonFindNext() noexcept;
- GCodeResult GetFileInfo(const char *filePath, GCodeFileInfo& info, bool quitEarly) noexcept;
+ GCodeResult GetFileInfo(const char *_ecv_array filePath, GCodeFileInfo& info, bool quitEarly) noexcept;
GCodeResult Mount(size_t card, const StringRef& reply, bool reportSuccess) noexcept;
GCodeResult Unmount(size_t card, const StringRef& reply) noexcept;
void Diagnostics(MessageType mtype) noexcept;
#endif
#if HAS_MASS_STORAGE
- bool EnsurePath(const char* filePath, bool messageIfFailed) noexcept;
- bool MakeDirectory(const char *directory, bool messageIfFailed) noexcept;
- bool Rename(const char *oldFilePath, const char *newFilePath, bool deleteExisting, bool messageIfFailed) noexcept;
- time_t GetLastModifiedTime(const char *filePath) noexcept;
- bool SetLastModifiedTime(const char *file, time_t time) noexcept;
+ bool EnsurePath(const char *_ecv_array filePath, bool messageIfFailed) noexcept;
+ bool MakeDirectory(const char *_ecv_array directory, bool messageIfFailed) noexcept;
+ bool Rename(const char *_ecv_array oldFilePath, const char *_ecv_array newFilePath, bool deleteExisting, bool messageIfFailed) noexcept;
+ time_t GetLastModifiedTime(const char *_ecv_array filePath) noexcept;
+ bool SetLastModifiedTime(const char *_ecv_array file, time_t t) noexcept;
bool CheckDriveMounted(const char* path) noexcept;
bool IsCardDetected(size_t card) noexcept;
unsigned int InvalidateFiles(const FATFS *fs, bool doClose) noexcept; // Invalidate all open files on the specified file system, returning the number of files invalidated
bool AnyFileOpen(const FATFS *fs) noexcept; // Return true if any files are open on the file system
Mutex& GetVolumeMutex(size_t vol) noexcept;
- void RecordSimulationTime(const char *printingFilePath, uint32_t simSeconds) noexcept; // Append the simulated printing time to the end of the file
+ void RecordSimulationTime(const char *_ecv_array printingFilePath, uint32_t simSeconds) noexcept; // Append the simulated printing time to the end of the file
uint16_t GetVolumeSeq(unsigned int volume) noexcept;
enum class InfoResult : uint8_t
@@ -101,7 +101,7 @@ namespace MassStorage
# if SUPPORT_OBJECT_MODEL
inline size_t GetNumVolumes() noexcept { return NumSdCards; }
- const ObjectModel *GetVolume(size_t vol) noexcept;
+ const ObjectModel *_ecv_from GetVolume(size_t vol) noexcept;
# endif
#endif