diff options
author | Manuel Coenen <manuel@duet3d.com> | 2020-12-08 14:50:54 +0300 |
---|---|---|
committer | Manuel Coenen <manuel@duet3d.com> | 2020-12-08 14:50:54 +0300 |
commit | 84b6882bee082357379ddb2b060e492b86ba4292 (patch) | |
tree | a05e0c908f5720ee51bf6ef4f4edd7ebad9801fb /src/Storage/MassStorage.cpp | |
parent | 1254903e761f38bb4533a7f536d3d8af4d60b617 (diff) |
Remove HAS_MASS_STORAGE and SUPPORT_SCANNER from Duet2_SBC
Fix wrong #import in DataTransfer
Fix compiler and linker errors if HAS_MASS_STORAGE is false but
HAS_LINUX_INTERFACE is true
Diffstat (limited to 'src/Storage/MassStorage.cpp')
-rw-r--r-- | src/Storage/MassStorage.cpp | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/src/Storage/MassStorage.cpp b/src/Storage/MassStorage.cpp index f7123872..458651ef 100644 --- a/src/Storage/MassStorage.cpp +++ b/src/Storage/MassStorage.cpp @@ -111,6 +111,42 @@ static Mutex fsMutex; static FileStore files[MAX_FILES]; #endif +// Construct a full path name from a path and a filename. Returns false if error i.e. filename too long +/*static*/ bool MassStorage::CombineName(const StringRef& outbuf, const char* directory, const char* fileName) noexcept +{ + bool hadError = false; + if (directory != nullptr && directory[0] != 0 && fileName[0] != '/' && (strlen(fileName) < 2 || !isdigit(fileName[0]) || fileName[1] != ':')) + { + hadError = outbuf.copy(directory); + if (!hadError) + { + const size_t len = outbuf.strlen(); + if (len != 0 && outbuf[len - 1] != '/') + { + hadError = outbuf.cat('/'); + } + } + } + else + { + outbuf.Clear(); + } + if (!hadError) + { + hadError = outbuf.cat(fileName); + } + if (hadError) + { + reprap.GetPlatform().MessageF(ErrorMessage, "Filename too long: cap=%u, dir=%.12s%s name=%.12s%s\n", + outbuf.Capacity(), + directory, (strlen(directory) > 12 ? "..." : ""), + fileName, (strlen(fileName) > 12 ? "..." : "") + ); + outbuf.copy("?????"); + } + return !hadError; +} + #if HAS_MASS_STORAGE // Static helper functions FileWriteBuffer *MassStorage::AllocateWriteBuffer() noexcept @@ -271,42 +307,6 @@ void MassStorage::CloseAllFiles() noexcept } } -// Construct a full path name from a path and a filename. Returns false if error i.e. filename too long -/*static*/ bool MassStorage::CombineName(const StringRef& outbuf, const char* directory, const char* fileName) noexcept -{ - bool hadError = false; - if (directory != nullptr && directory[0] != 0 && fileName[0] != '/' && (strlen(fileName) < 2 || !isdigit(fileName[0]) || fileName[1] != ':')) - { - hadError = outbuf.copy(directory); - if (!hadError) - { - const size_t len = outbuf.strlen(); - if (len != 0 && outbuf[len - 1] != '/') - { - hadError = outbuf.cat('/'); - } - } - } - else - { - outbuf.Clear(); - } - if (!hadError) - { - hadError = outbuf.cat(fileName); - } - if (hadError) - { - reprap.GetPlatform().MessageF(ErrorMessage, "Filename too long: cap=%u, dir=%.12s%s name=%.12s%s\n", - outbuf.Capacity(), - directory, (strlen(directory) > 12 ? "..." : ""), - fileName, (strlen(fileName) > 12 ? "..." : "") - ); - outbuf.copy("?????"); - } - return !hadError; -} - // Open a directory to read a file list. Returns true if it contains any files, false otherwise. // If this returns true then the file system mutex is owned. The caller must subsequently release the mutex either // by calling FindNext until it returns false, or by calling AbandonFindNext. |