diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-01-04 21:15:22 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-01-04 21:15:22 +0300 |
commit | 5bd28a1aea25e83e6e1d7a0ca50cd000e7baf1a7 (patch) | |
tree | 059d11bfc384d80c7ff07d3457e994ac50a0c07e /src/Storage/FileInfoParser.cpp | |
parent | 8ded9143fa9d07dcddd525683403980c42881f1a (diff) |
Conditional GCode fixes and exception specifiers
Loops are now working
Added noexcept specifiers to omst of the remaining C++ source files
Diffstat (limited to 'src/Storage/FileInfoParser.cpp')
-rw-r--r-- | src/Storage/FileInfoParser.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/Storage/FileInfoParser.cpp b/src/Storage/FileInfoParser.cpp index d7d89cc9..d232f360 100644 --- a/src/Storage/FileInfoParser.cpp +++ b/src/Storage/FileInfoParser.cpp @@ -30,14 +30,14 @@ void GCodeFileInfo::Init() #if HAS_MASS_STORAGE -FileInfoParser::FileInfoParser() +FileInfoParser::FileInfoParser() noexcept : parseState(notParsing), fileBeingParsed(nullptr), accumulatedParseTime(0), accumulatedReadTime(0), accumulatedSeekTime(0), fileOverlapLength(0) { parsedFileInfo.Init(); parserMutex.Create("FileInfoParser"); } -bool FileInfoParser::GetFileInfo(const char *filePath, GCodeFileInfo& info, bool quitEarly) +bool FileInfoParser::GetFileInfo(const char *filePath, GCodeFileInfo& info, bool quitEarly) noexcept { MutexLocker lock(parserMutex, MAX_FILEINFO_PROCESS_TIME); if (!lock) @@ -367,7 +367,7 @@ bool FileInfoParser::GetFileInfo(const char *filePath, GCodeFileInfo& info, bool } // Scan the buffer for a G1 Zxxx command. The buffer is null-terminated. -bool FileInfoParser::FindFirstLayerHeight(const char* buf, size_t len) +bool FileInfoParser::FindFirstLayerHeight(const char* buf, size_t len) noexcept { if (len < 4) { @@ -435,7 +435,7 @@ bool FileInfoParser::FindFirstLayerHeight(const char* buf, size_t len) // This parsing algorithm needs to be fast. The old one sometimes took 5 seconds or more to parse about 120K of data. // To speed up parsing, we now parse forwards from the start of the buffer. This means we can't stop when we have found a G1 Z command, // we have to look for a later G1 Z command in the buffer. But it is faster in the (common) case that we don't find a match in the buffer at all. -bool FileInfoParser::FindHeight(const char* buf, size_t len) +bool FileInfoParser::FindHeight(const char* buf, size_t len) noexcept { bool foundHeight = false; bool inRelativeMode = false; @@ -537,7 +537,7 @@ bool FileInfoParser::FindHeight(const char* buf, size_t len) } // Scan the buffer for the layer height. The buffer is null-terminated. -bool FileInfoParser::FindLayerHeight(const char *buf, size_t len) +bool FileInfoParser::FindLayerHeight(const char *buf, size_t len) noexcept { static const char* const layerHeightStrings[] = { @@ -585,7 +585,7 @@ bool FileInfoParser::FindLayerHeight(const char *buf, size_t len) return false; } -bool FileInfoParser::FindSlicerInfo(const char* buf, size_t len) +bool FileInfoParser::FindSlicerInfo(const char* buf, size_t len) noexcept { static const char * const GeneratedByStrings[] = { @@ -639,7 +639,7 @@ bool FileInfoParser::FindSlicerInfo(const char* buf, size_t len) // Scan the buffer for the filament used. The buffer is null-terminated. // Returns the number of filaments found. -unsigned int FileInfoParser::FindFilamentUsed(const char* buf, size_t len) +unsigned int FileInfoParser::FindFilamentUsed(const char* buf, size_t len) noexcept { unsigned int filamentsFound = 0; const size_t maxFilaments = reprap.GetGCodes().GetNumExtruders(); @@ -767,7 +767,7 @@ unsigned int FileInfoParser::FindFilamentUsed(const char* buf, size_t len) } // Scan the buffer for the estimated print time -bool FileInfoParser::FindPrintTime(const char* buf, size_t len) +bool FileInfoParser::FindPrintTime(const char* buf, size_t len) noexcept { static const char* const PrintTimeStrings[] = { @@ -838,7 +838,7 @@ bool FileInfoParser::FindPrintTime(const char* buf, size_t len) } // Scan the buffer for the simulated print time -bool FileInfoParser::FindSimulatedTime(const char* buf, size_t len) +bool FileInfoParser::FindSimulatedTime(const char* buf, size_t len) noexcept { const char* pos = strstr(buf, SimulatedTimeString); if (pos != nullptr) |