diff --git a/src/Misc.cpp b/src/Misc.cpp index 1b1a00c..3d94e14 100644 --- a/src/Misc.cpp +++ b/src/Misc.cpp @@ -148,10 +148,7 @@ void Container::readTitleBlockSymbol() } } - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); spdlog::debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); } \ No newline at end of file diff --git a/src/Streams/StreamAdminData.cpp b/src/Streams/StreamAdminData.cpp index 2aff980..af4ddef 100644 --- a/src/Streams/StreamAdminData.cpp +++ b/src/Streams/StreamAdminData.cpp @@ -25,10 +25,7 @@ void StreamAdminData::read(FileFormatVersion /* aVersion */) ds.assumeData({0x00, 0x00, 0x00, 0x00, 0x00}, fmt::format("{}: Found actually useful data!", getMethodName(this, __func__))); - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.info(to_string()); diff --git a/src/Streams/StreamCache.cpp b/src/Streams/StreamCache.cpp index 0acb818..f6d48ae 100644 --- a/src/Streams/StreamCache.cpp +++ b/src/Streams/StreamCache.cpp @@ -108,10 +108,7 @@ void StreamCache::read(FileFormatVersion /* aVersion */) } } - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.info(to_string()); diff --git a/src/Streams/StreamCellsDirectory.cpp b/src/Streams/StreamCellsDirectory.cpp index ec09364..f51dd49 100644 --- a/src/Streams/StreamCellsDirectory.cpp +++ b/src/Streams/StreamCellsDirectory.cpp @@ -69,10 +69,7 @@ void StreamCellsDirectory::read(FileFormatVersion /* aVersion */) items.push_back(item); } - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.info(to_string()); diff --git a/src/Streams/StreamDsnStream.cpp b/src/Streams/StreamDsnStream.cpp index 3a593fa..3e3c3cb 100644 --- a/src/Streams/StreamDsnStream.cpp +++ b/src/Streams/StreamDsnStream.cpp @@ -37,10 +37,7 @@ void StreamDsnStream::read(FileFormatVersion /* aVersion */) // @todo Add checkpoint sanitization // localFutureLst.sanitizeCheckpoints(); - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.info(to_string()); diff --git a/src/Streams/StreamERC.cpp b/src/Streams/StreamERC.cpp index 1b247d5..287e0ad 100644 --- a/src/Streams/StreamERC.cpp +++ b/src/Streams/StreamERC.cpp @@ -18,10 +18,7 @@ void StreamERC::read(FileFormatVersion /* aVersion */) ercSymbol = dynamic_pointer_cast(parser.readStructure()); - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.info(to_string()); diff --git a/src/Streams/StreamExportBlocksDirectory.cpp b/src/Streams/StreamExportBlocksDirectory.cpp index e011613..175e23e 100644 --- a/src/Streams/StreamExportBlocksDirectory.cpp +++ b/src/Streams/StreamExportBlocksDirectory.cpp @@ -63,10 +63,7 @@ void StreamExportBlocksDirectory::read(FileFormatVersion /* aVersion */) items.push_back(item); } - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.info(to_string()); diff --git a/src/Streams/StreamGraphicsDirectory.cpp b/src/Streams/StreamGraphicsDirectory.cpp index 60b7aa5..8452c2f 100644 --- a/src/Streams/StreamGraphicsDirectory.cpp +++ b/src/Streams/StreamGraphicsDirectory.cpp @@ -68,10 +68,7 @@ void StreamGraphicsDirectory::read(FileFormatVersion /* aVersion */) items.push_back(item); } - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.info(to_string()); diff --git a/src/Streams/StreamHSObjects.cpp b/src/Streams/StreamHSObjects.cpp index 077a832..6cda02c 100644 --- a/src/Streams/StreamHSObjects.cpp +++ b/src/Streams/StreamHSObjects.cpp @@ -17,10 +17,7 @@ void StreamHSObjects::read(FileFormatVersion /* aVersion */) ds.assumeData({0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, fmt::format("{}: - 0", __func__)); ds.assumeData({0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, fmt::format("{}: - 1", __func__)); - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.info(to_string()); diff --git a/src/Streams/StreamHierarchy.cpp b/src/Streams/StreamHierarchy.cpp index ed75b5d..7c461b9 100644 --- a/src/Streams/StreamHierarchy.cpp +++ b/src/Streams/StreamHierarchy.cpp @@ -100,10 +100,7 @@ void StreamHierarchy::read(FileFormatVersion aVersion) ds.printUnknownData(10, getMethodName(this, __func__) + ": 5"); } - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.info(to_string()); diff --git a/src/Streams/StreamLibrary.cpp b/src/Streams/StreamLibrary.cpp index fae2e73..99a4958 100644 --- a/src/Streams/StreamLibrary.cpp +++ b/src/Streams/StreamLibrary.cpp @@ -146,10 +146,7 @@ void StreamLibrary::read(FileFormatVersion aVersion) mCtx.mLogger.trace("schematicName = {}", schematicName); } - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.info(to_string()); diff --git a/src/Streams/StreamNetBundleMapData.cpp b/src/Streams/StreamNetBundleMapData.cpp index e7675f6..2a47053 100644 --- a/src/Streams/StreamNetBundleMapData.cpp +++ b/src/Streams/StreamNetBundleMapData.cpp @@ -62,10 +62,7 @@ void StreamNetBundleMapData::read(FileFormatVersion /* aVersion */) } } - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.info(to_string()); diff --git a/src/Streams/StreamPackage.cpp b/src/Streams/StreamPackage.cpp index f253ef3..75c8048 100644 --- a/src/Streams/StreamPackage.cpp +++ b/src/Streams/StreamPackage.cpp @@ -36,10 +36,7 @@ void StreamPackage::read(FileFormatVersion /* aVersion */) t0x1f = dynamic_pointer_cast(parser.readStructure()); - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.info(to_string()); diff --git a/src/Streams/StreamPackagesDirectory.cpp b/src/Streams/StreamPackagesDirectory.cpp index 4a7849b..62e18de 100644 --- a/src/Streams/StreamPackagesDirectory.cpp +++ b/src/Streams/StreamPackagesDirectory.cpp @@ -62,10 +62,7 @@ void StreamPackagesDirectory::read(FileFormatVersion /* aVersion */) items.push_back(item); } - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.info(to_string()); diff --git a/src/Streams/StreamPage.cpp b/src/Streams/StreamPage.cpp index e38d20a..f2313e0 100644 --- a/src/Streams/StreamPage.cpp +++ b/src/Streams/StreamPage.cpp @@ -185,10 +185,7 @@ void StreamPage::read(FileFormatVersion /* aVersion */) localFutureLst.sanitizeCheckpoints(); - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.info(to_string()); diff --git a/src/Streams/StreamPartsDirectory.cpp b/src/Streams/StreamPartsDirectory.cpp index aa4002a..d59b9ee 100644 --- a/src/Streams/StreamPartsDirectory.cpp +++ b/src/Streams/StreamPartsDirectory.cpp @@ -63,10 +63,7 @@ void StreamPartsDirectory::read(FileFormatVersion /* aVersion */) items.push_back(item); } - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.info(to_string()); diff --git a/src/Streams/StreamSchematic.cpp b/src/Streams/StreamSchematic.cpp index dcb3d02..d2c8228 100644 --- a/src/Streams/StreamSchematic.cpp +++ b/src/Streams/StreamSchematic.cpp @@ -65,10 +65,7 @@ void StreamSchematic::read(FileFormatVersion /* aVersion */) ds.printUnknownData(4, getMethodName(this, __func__) + ": 3"); - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.info(to_string()); diff --git a/src/Streams/StreamSymbol.cpp b/src/Streams/StreamSymbol.cpp index 30ed41e..1029a58 100644 --- a/src/Streams/StreamSymbol.cpp +++ b/src/Streams/StreamSymbol.cpp @@ -18,10 +18,7 @@ void StreamSymbol::read(FileFormatVersion /* aVersion */) symbol = dynamic_pointer_cast(parser.readStructure()); - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.info(to_string()); diff --git a/src/Streams/StreamSymbolsDirectory.cpp b/src/Streams/StreamSymbolsDirectory.cpp index 525cd34..3af36ae 100644 --- a/src/Streams/StreamSymbolsDirectory.cpp +++ b/src/Streams/StreamSymbolsDirectory.cpp @@ -74,10 +74,7 @@ void StreamSymbolsDirectory::read(FileFormatVersion /* aVersion */) items.push_back(item); } - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.info(to_string()); diff --git a/src/Streams/StreamType.cpp b/src/Streams/StreamType.cpp index 690777e..b1263a6 100644 --- a/src/Streams/StreamType.cpp +++ b/src/Streams/StreamType.cpp @@ -25,10 +25,7 @@ void StreamType::read(FileFormatVersion /* aVersion */) types.push_back(type); } - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.info(to_string()); diff --git a/src/Streams/StreamViewsDirectory.cpp b/src/Streams/StreamViewsDirectory.cpp index 06c27b2..a7fac40 100644 --- a/src/Streams/StreamViewsDirectory.cpp +++ b/src/Streams/StreamViewsDirectory.cpp @@ -63,10 +63,7 @@ void StreamViewsDirectory::read(FileFormatVersion /* aVersion */) items.push_back(item); } - if(!ds.isEoF()) - { - throw std::runtime_error("Expected EoF but did not reach it!"); - } + ds.sanitizeEoF(); mCtx.mLogger.debug(getClosingMsg(getMethodName(this, __func__), ds.getCurrentOffset())); mCtx.mLogger.info(to_string());