1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-20 10:17:05 +00:00

Remove get_.

This commit is contained in:
Thomas Harte
2025-02-26 17:09:47 -05:00
parent 1db756063b
commit d4f08f0006
12 changed files with 27 additions and 27 deletions
+3 -3
View File
@@ -47,7 +47,7 @@ HeadPosition AppleDSK::get_maximum_head_position() const {
}
bool AppleDSK::get_is_read_only() const {
return file_.get_is_known_read_only();
return file_.is_known_read_only();
}
long AppleDSK::file_offset(Track::Address address) const {
@@ -64,7 +64,7 @@ size_t AppleDSK::logical_sector_for_physical_sector(size_t physical) const {
std::unique_ptr<Track> AppleDSK::track_at_position(Track::Address address) const {
std::vector<uint8_t> track_data;
{
std::lock_guard lock_guard(file_.get_file_access_mutex());
std::lock_guard lock_guard(file_.file_access_mutex());
file_.seek(file_offset(address), SEEK_SET);
track_data = file_.read(size_t(bytes_per_sector * sectors_per_track_));
}
@@ -115,7 +115,7 @@ void AppleDSK::set_tracks(const std::map<Track::Address, std::unique_ptr<Track>>
}
// Grab the file lock and write out the new tracks.
std::lock_guard lock_guard(file_.get_file_access_mutex());
std::lock_guard lock_guard(file_.file_access_mutex());
for(const auto &pair: tracks_by_address) {
file_.seek(file_offset(pair.first), SEEK_SET);
file_.write(pair.second);
+1 -1
View File
@@ -21,7 +21,7 @@ CPCDSK::CPCDSK(const std::string &file_name) :
file_name_(file_name),
is_extended_(false) {
FileHolder file(file_name);
is_read_only_ = file.get_is_known_read_only();
is_read_only_ = file.is_known_read_only();
if(!file.check_signature("MV - CPC")) {
is_extended_ = true;
+1 -1
View File
@@ -38,7 +38,7 @@ DMK::DMK(const std::string &file_name) :
// or by virtue of filesystem placement).
uint8_t read_only_byte = file_.get();
if(read_only_byte != 0x00 && read_only_byte != 0xff) throw Error::InvalidFormat;
is_read_only_ = (read_only_byte == 0xff) || file_.get_is_known_read_only();
is_read_only_ = (read_only_byte == 0xff) || file_.is_known_read_only();
// Read track count and size.
head_position_count_ = int(file_.get());
+3 -3
View File
@@ -57,7 +57,7 @@ uint16_t HFE::seek_track(const Track::Address address) const {
std::unique_ptr<Track> HFE::track_at_position(const Track::Address address) const {
PCMSegment segment;
{
std::lock_guard lock_guard(file_.get_file_access_mutex());
std::lock_guard lock_guard(file_.file_access_mutex());
uint16_t track_length = seek_track(address);
segment.data.resize(track_length * 8);
@@ -101,7 +101,7 @@ std::unique_ptr<Track> HFE::track_at_position(const Track::Address address) cons
void HFE::set_tracks(const std::map<Track::Address, std::unique_ptr<Track>> &tracks) {
for(auto &track : tracks) {
std::unique_lock lock_guard(file_.get_file_access_mutex());
std::unique_lock lock_guard(file_.file_access_mutex());
uint16_t track_length = seek_track(track.first);
lock_guard.unlock();
@@ -126,7 +126,7 @@ void HFE::set_tracks(const std::map<Track::Address, std::unique_ptr<Track>> &tra
}
bool HFE::get_is_read_only() const {
return file_.get_is_known_read_only();
return file_.is_known_read_only();
}
bool HFE::represents(const std::string &name) const {
@@ -29,7 +29,7 @@ std::unique_ptr<Track> MFMSectorDump::track_at_position(Track::Address address)
const long file_offset = get_file_offset_for_position(address);
{
std::lock_guard lock_guard(file_.get_file_access_mutex());
std::lock_guard lock_guard(file_.file_access_mutex());
file_.seek(file_offset, SEEK_SET);
file_.read(sectors, sizeof(sectors));
}
@@ -60,7 +60,7 @@ void MFMSectorDump::set_tracks(const std::map<Track::Address, std::unique_ptr<Tr
density_);
const long file_offset = get_file_offset_for_position(track.first);
std::lock_guard lock_guard(file_.get_file_access_mutex());
std::lock_guard lock_guard(file_.file_access_mutex());
file_.ensure_is_at_least_length(file_offset);
file_.seek(file_offset, SEEK_SET);
file_.write(parsed_track, sizeof(parsed_track));
@@ -69,7 +69,7 @@ void MFMSectorDump::set_tracks(const std::map<Track::Address, std::unique_ptr<Tr
}
bool MFMSectorDump::get_is_read_only() const {
return file_.get_is_known_read_only();
return file_.is_known_read_only();
}
bool MFMSectorDump::represents(const std::string &name) const {
@@ -168,7 +168,7 @@ int MacintoshIMG::get_head_count() const {
}
bool MacintoshIMG::get_is_read_only() const {
return file_.get_is_known_read_only();
return file_.is_known_read_only();
}
bool MacintoshIMG::represents(const std::string &name) const {
@@ -308,7 +308,7 @@ void MacintoshIMG::set_tracks(const std::map<Track::Address, std::unique_ptr<Tra
// Grab the file lock and write out the new tracks.
{
std::lock_guard lock_guard(file_.get_file_access_mutex());
std::lock_guard lock_guard(file_.file_access_mutex());
if(!is_diskCopy_file_) {
// Just dump out the entire disk. Grossly lazy, possibly worth improving.
+4 -4
View File
@@ -47,7 +47,7 @@ HeadPosition NIB::get_maximum_head_position() const {
}
bool NIB::get_is_read_only() const {
return file_.get_is_known_read_only();
return file_.is_known_read_only();
}
bool NIB::represents(const std::string &name) const {
@@ -81,7 +81,7 @@ std::unique_ptr<Track> NIB::track_at_position(const Track::Address address) cons
const long offset = file_offset(address);
std::vector<uint8_t> track_data;
{
std::lock_guard lock_guard(file_.get_file_access_mutex());
std::lock_guard lock_guard(file_.file_access_mutex());
file_.seek(offset, SEEK_SET);
track_data = file_.read(track_length);
}
@@ -140,7 +140,7 @@ std::unique_ptr<Track> NIB::track_at_position(const Track::Address address) cons
}
}
std::lock_guard lock_guard(file_.get_file_access_mutex());
std::lock_guard lock_guard(file_.file_access_mutex());
return std::make_unique<PCMTrack>(segment);
}
@@ -187,7 +187,7 @@ void NIB::set_tracks(const std::map<Track::Address, std::unique_ptr<Track>> &tra
}
// Lock the file and spool out.
std::lock_guard lock_guard(file_.get_file_access_mutex());
std::lock_guard lock_guard(file_.file_access_mutex());
for(const auto &track: tracks_by_address) {
file_.seek(file_offset(track.first), SEEK_SET);
file_.write(track.second);
@@ -53,7 +53,7 @@ long OricMFMDSK::get_file_offset_for_position(Track::Address address) const {
std::unique_ptr<Track> OricMFMDSK::track_at_position(const Track::Address address) const {
PCMSegment segment;
{
std::lock_guard lock_guard(file_.get_file_access_mutex());
std::lock_guard lock_guard(file_.file_access_mutex());
file_.seek(get_file_offset_for_position(address), SEEK_SET);
// The file format omits clock bits. So it's not a genuine MFM capture.
@@ -157,7 +157,7 @@ void OricMFMDSK::set_tracks(const std::map<Track::Address, std::unique_ptr<Track
long file_offset = get_file_offset_for_position(track.first);
std::lock_guard lock_guard(file_.get_file_access_mutex());
std::lock_guard lock_guard(file_.file_access_mutex());
file_.seek(file_offset, SEEK_SET);
std::size_t track_size = std::min(size_t(6400), parsed_track.size());
file_.write(parsed_track.data(), track_size);
@@ -165,7 +165,7 @@ void OricMFMDSK::set_tracks(const std::map<Track::Address, std::unique_ptr<Track
}
bool OricMFMDSK::get_is_read_only() const {
return file_.get_is_known_read_only();
return file_.is_known_read_only();
}
bool OricMFMDSK::represents(const std::string &name) const {
+2 -2
View File
@@ -157,7 +157,7 @@ std::unique_ptr<Track> WOZ::track_at_position(Track::Address address) const {
std::vector<uint8_t> track_contents;
size_t number_of_bits;
{
std::lock_guard lock_guard(file_.get_file_access_mutex());
std::lock_guard lock_guard(file_.file_access_mutex());
file_.seek(offset, SEEK_SET);
switch(type_) {
@@ -212,7 +212,7 @@ void WOZ::set_tracks(const std::map<Track::Address, std::unique_ptr<Track>> &tra
const uint32_t crc = CRC::CRC32::crc_of(post_crc_contents_);
// Grab the file lock, then write the CRC, then just dump the entire file buffer.
std::lock_guard lock_guard(file_.get_file_access_mutex());
std::lock_guard lock_guard(file_.file_access_mutex());
file_.seek(8, SEEK_SET);
file_.put_le(crc);
file_.write(post_crc_contents_);
+2 -2
View File
@@ -120,7 +120,7 @@ void FileHolder::ensure_is_at_least_length(long length) {
}
}
bool FileHolder::get_is_known_read_only() const {
bool FileHolder::is_known_read_only() const {
return is_read_only_;
}
@@ -128,6 +128,6 @@ const struct stat &FileHolder::stats() const {
return file_stats_;
}
std::mutex &FileHolder::get_file_access_mutex() {
std::mutex &FileHolder::file_access_mutex() {
return file_access_mutex_;
}
+2 -2
View File
@@ -177,7 +177,7 @@ public:
/*!
@returns @c true if an attempt was made to read this file in ReadWrite mode but it could be opened only for reading; @c false otherwise.
*/
bool get_is_known_read_only() const;
bool is_known_read_only() const;
/*!
@returns the stat struct describing this file.
@@ -187,7 +187,7 @@ public:
/*!
@returns a mutex owned by the file that can be used to serialise file access.
*/
std::mutex &get_file_access_mutex();
std::mutex &file_access_mutex();
private:
FILE *file_ = nullptr;
+1 -1
View File
@@ -19,7 +19,7 @@ ZX80O81P::ZX80O81P(const std::string &file_name) {
file.read(data_.data(), size_t(file.stats().st_size));
// If it's a ZX81 file, prepend a file name.
std::string type = file.extension();
const auto type = file.extension();
target_platforms_ = TargetPlatform::ZX80;
if(type == "p" || type == "81") {
// TODO, maybe: prefix a proper file name; this is leaving the file nameless.