1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-19 19:16:34 +00:00

Correct typo; check CRC.

This commit is contained in:
Thomas Harte
2026-02-15 21:06:56 -05:00
parent 57121470c8
commit 3283e3313a
3 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -598,7 +598,7 @@
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>mood</string>
<string>moof</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>floppy35</string>
+10
View File
@@ -8,6 +8,8 @@
#include "MOOF.hpp"
#include "Numeric/CRC.hpp"
using namespace Storage::Disk;
MOOF::MOOF(const std::string &file_name) :
@@ -20,6 +22,14 @@ MOOF::MOOF(const std::string &file_name) :
if(!file_.check_signature<SignatureType::Binary>(signature)) {
throw Error::InvalidFormat;
}
// Test the file's CRC32.
const auto crc = file_.get_le<uint32_t>();
post_crc_contents_ = file_.read(size_t(file_.stats().st_size - 12));
const uint32_t computed_crc = CRC::CRC32::crc_of(post_crc_contents_);
if(crc != computed_crc) {
throw Error::InvalidFormat;
}
}
HeadPosition MOOF::maximum_head_position() const {
+1
View File
@@ -23,6 +23,7 @@ public:
private:
mutable Storage::FileHolder file_;
std::vector<uint8_t> post_crc_contents_;
};
}