1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-18 23:29:49 +00:00

Lock all tape classes down to read-only.

This commit is contained in:
Thomas Harte 2024-12-03 09:21:13 -05:00
parent 0371b0507a
commit 0b5cd4c665
7 changed files with 7 additions and 7 deletions

View File

@ -60,7 +60,7 @@ namespace {
}
CAS::CAS(const std::string &file_name) {
Storage::FileHolder file(file_name);
Storage::FileHolder file(file_name, FileHolder::FileMode::Read);
enum class Mode {
Seeking,

View File

@ -16,7 +16,7 @@ using namespace Storage::Tape;
CSW::CSW(const std::string &file_name) :
source_data_pointer_(0) {
Storage::FileHolder file(file_name);
Storage::FileHolder file(file_name, FileHolder::FileMode::Read);
if(file.stats().st_size < 0x20) throw ErrorNotCSW;
// Check signature.

View File

@ -13,7 +13,7 @@
using namespace Storage::Tape;
CommodoreTAP::CommodoreTAP(const std::string &file_name) :
file_(file_name)
file_(file_name, FileHolder::FileMode::Read)
{
if(!file_.check_signature("C64-TAPE-RAW"))
throw ErrorNotCommodoreTAP;

View File

@ -13,7 +13,7 @@
using namespace Storage::Tape;
OricTAP::OricTAP(const std::string &file_name) :
file_(file_name)
file_(file_name, FileHolder::FileMode::Read)
{
// Check for a sequence of at least three 0x16s followed by a 0x24.
while(true) {

View File

@ -22,7 +22,7 @@ Log::Logger<Log::Source::TZX> logger;
}
TZX::TZX(const std::string &file_name) :
file_(file_name),
file_(file_name, FileHolder::FileMode::Read),
current_level_(false) {
// Check for signature followed by a 0x1a

View File

@ -49,7 +49,7 @@
using namespace Storage::Tape;
PRG::PRG(const std::string &file_name) :
file_(file_name)
file_(file_name, FileHolder::FileMode::Read)
{
// There's really no way to validate other than that if this file is larger than 64kb,
// of if load address + length > 65536 then it's broken.

View File

@ -12,7 +12,7 @@
using namespace Storage::Tape;
ZX80O81P::ZX80O81P(const std::string &file_name) {
Storage::FileHolder file(file_name);
Storage::FileHolder file(file_name, FileHolder::FileMode::Read);
// Grab the actual file contents
data_.resize(size_t(file.stats().st_size));