diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiProducer.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiProducer.cpp index 58b35e753..e9c614a83 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiProducer.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiProducer.cpp @@ -23,8 +23,8 @@ void MultiInterface::perform_parallel(const std::function machines_lock(machines_mutex_); - std::lock_guard lock(mutex); + std::lock_guard machines_lock(machines_mutex_); + std::lock_guard lock(mutex); outstanding_machines = machines_.size(); for(std::size_t index = 0; index < machines_.size(); ++index) { @@ -32,20 +32,20 @@ void MultiInterface::perform_parallel(const std::function lock(mutex); + std::lock_guard lock(mutex); outstanding_machines--; condition.notify_all(); }); } } - std::unique_lock lock(mutex); + std::unique_lock lock(mutex); condition.wait(lock, [&outstanding_machines] { return !outstanding_machines; }); } template void MultiInterface::perform_serial(const std::function &function) { - std::lock_guard machines_lock(machines_mutex_); + std::lock_guard machines_lock(machines_mutex_); for(const auto &machine: machines_) { const auto typed_machine = ::Machine::get(*machine.get()); if(typed_machine) function(typed_machine); @@ -56,13 +56,13 @@ void MultiInterface::perform_serial(const std::function machines_lock(machines_mutex_); + std::lock_guard machines_lock(machines_mutex_); const auto machine = machines_.front()->scan_producer(); if(machine) machine->set_scan_target(scan_target); } Outputs::Display::ScanStatus MultiScanProducer::get_scan_status() const { - std::lock_guard machines_lock(machines_mutex_); + std::lock_guard machines_lock(machines_mutex_); const auto machine = machines_.front()->scan_producer(); if(machine) return machine->get_scan_status(); return Outputs::Display::ScanStatus(); @@ -74,7 +74,7 @@ void MultiScanProducer::did_change_machine_order() { perform_serial([](MachineTypes::ScanProducer *machine) { machine->set_scan_target(nullptr); }); - std::lock_guard machines_lock(machines_mutex_); + std::lock_guard machines_lock(machines_mutex_); const auto machine = machines_.front()->scan_producer(); if(machine) machine->set_scan_target(scan_target_); } diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.cpp index d31ee215c..445036baa 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.cpp @@ -67,7 +67,7 @@ void MultiSpeaker::set_delegate(Outputs::Speaker::Speaker::Delegate *delegate) { void MultiSpeaker::speaker_did_complete_samples(Speaker *speaker, const std::vector &buffer) { if(!delegate_) return; { - std::lock_guard lock_guard(front_speaker_mutex_); + std::lock_guard lock_guard(front_speaker_mutex_); if(speaker != front_speaker_) return; } did_complete_samples(this, buffer, stereo_output_); @@ -76,7 +76,7 @@ void MultiSpeaker::speaker_did_complete_samples(Speaker *speaker, const std::vec void MultiSpeaker::speaker_did_change_input_clock(Speaker *speaker) { if(!delegate_) return; { - std::lock_guard lock_guard(front_speaker_mutex_); + std::lock_guard lock_guard(front_speaker_mutex_); if(speaker != front_speaker_) return; } delegate_->speaker_did_change_input_clock(this); @@ -84,7 +84,7 @@ void MultiSpeaker::speaker_did_change_input_clock(Speaker *speaker) { void MultiSpeaker::set_new_front_machine(::Machine::DynamicMachine *machine) { { - std::lock_guard lock_guard(front_speaker_mutex_); + std::lock_guard lock_guard(front_speaker_mutex_); front_speaker_ = machine->audio_producer()->get_speaker(); } if(delegate_) { diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp index f4b25b876..b18b31369 100644 --- a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp @@ -60,7 +60,7 @@ bool MultiMachine::would_collapse(const std::vector machines_lock(machines_mutex_); + std::lock_guard machines_lock(machines_mutex_); #ifndef NDEBUG for(const auto &machine: machines_) { auto timed_machine = machine->timed_machine(); diff --git a/Concurrency/AsyncTaskQueue.cpp b/Concurrency/AsyncTaskQueue.cpp index b8d69c448..a88fbf4ac 100644 --- a/Concurrency/AsyncTaskQueue.cpp +++ b/Concurrency/AsyncTaskQueue.cpp @@ -23,7 +23,7 @@ AsyncTaskQueue::AsyncTaskQueue() std::function next_function; // Take lock, check for a new task - std::unique_lock lock(queue_mutex_); + std::unique_lock lock(queue_mutex_); if(!pending_tasks_.empty()) { next_function = pending_tasks_.front(); pending_tasks_.pop_front(); @@ -60,7 +60,7 @@ void AsyncTaskQueue::enqueue(std::function function) { #ifdef __APPLE__ dispatch_async(serial_dispatch_queue_, ^{function();}); #else - std::lock_guard lock(queue_mutex_); + std::lock_guard lock(queue_mutex_); pending_tasks_.push_back(function); processing_condition_.notify_all(); #endif @@ -72,9 +72,9 @@ void AsyncTaskQueue::flush() { #else auto flush_mutex = std::make_shared(); auto flush_condition = std::make_shared(); - std::unique_lock lock(*flush_mutex); + std::unique_lock lock(*flush_mutex); enqueue([=] () { - std::unique_lock inner_lock(*flush_mutex); + std::unique_lock inner_lock(*flush_mutex); flush_condition->notify_all(); }); flush_condition->wait(lock); diff --git a/Machines/Apple/Macintosh/Keyboard.hpp b/Machines/Apple/Macintosh/Keyboard.hpp index 0ff1d6036..e89840bdc 100644 --- a/Machines/Apple/Macintosh/Keyboard.hpp +++ b/Machines/Apple/Macintosh/Keyboard.hpp @@ -210,7 +210,7 @@ class Keyboard { void enqueue_key_state(uint16_t key, bool is_pressed) { // Front insert; messages will be pop_back'd. - std::lock_guard lock(key_queue_mutex_); + std::lock_guard lock(key_queue_mutex_); // Keys on the keypad are preceded by a $79 keycode; in the internal naming scheme // they are indicated by having bit 8 set. So add the $79 prefix if required. @@ -228,7 +228,7 @@ class Keyboard { switch(command) { case 0x10: // Inquiry. case 0x14: { // Instant. - std::lock_guard lock(key_queue_mutex_); + std::lock_guard lock(key_queue_mutex_); if(!key_queue_.empty()) { const auto new_message = key_queue_.back(); key_queue_.pop_back(); diff --git a/Machines/Atari/ST/IntelligentKeyboard.cpp b/Machines/Atari/ST/IntelligentKeyboard.cpp index 56ad67a24..e2b84ca6d 100644 --- a/Machines/Atari/ST/IntelligentKeyboard.cpp +++ b/Machines/Atari/ST/IntelligentKeyboard.cpp @@ -84,7 +84,7 @@ void IntelligentKeyboard::run_for(HalfCycles duration) { // Forward key changes; implicit assumption here: mutexs are cheap while there's // negligible contention. { - std::lock_guard guard(key_queue_mutex_); + std::lock_guard guard(key_queue_mutex_); for(uint8_t key: key_queue_) { output_bytes({key}); } @@ -348,7 +348,7 @@ void IntelligentKeyboard::post_relative_mouse_event(int x, int y) { // MARK: - Keyboard Input void IntelligentKeyboard::set_key_state(Key key, bool is_pressed) { - std::lock_guard guard(key_queue_mutex_); + std::lock_guard guard(key_queue_mutex_); if(is_pressed) { key_queue_.push_back(uint8_t(key)); } else { diff --git a/OSBindings/Qt/functionthread.h b/OSBindings/Qt/functionthread.h index 9510b9063..75237a882 100644 --- a/OSBindings/Qt/functionthread.h +++ b/OSBindings/Qt/functionthread.h @@ -25,7 +25,6 @@ class FunctionThread: public QThread { } void stop() { -// QMetaObject::invokeMethod(this, "quit", Qt::QueuedConnection); quit(); wait(); } diff --git a/OSBindings/SDL/main.cpp b/OSBindings/SDL/main.cpp index ccf36a6c4..d95ba699a 100644 --- a/OSBindings/SDL/main.cpp +++ b/OSBindings/SDL/main.cpp @@ -118,7 +118,7 @@ struct MachineRunner { std::atomic _frame_period; static constexpr Uint32 timer_period = 4; - static Uint32 sdl_callback(Uint32 interval, void *param) { + static Uint32 sdl_callback(Uint32, void *param) { reinterpret_cast(param)->update(); return timer_period; } @@ -140,7 +140,7 @@ struct MachineRunner { const auto vsync_time = vsync_time_.load(); - std::unique_lock lock_guard(*machine_mutex); + std::unique_lock lock_guard(*machine_mutex); const auto scan_producer = machine->scan_producer(); const auto timed_machine = machine->timed_machine(); @@ -176,8 +176,8 @@ struct SpeakerDelegate: public Outputs::Speaker::Speaker::Delegate { static constexpr size_t buffered_samples = 1024; bool is_stereo = false; - void speaker_did_complete_samples(Outputs::Speaker::Speaker *speaker, const std::vector &buffer) final { - std::lock_guard lock_guard(audio_buffer_mutex_); + void speaker_did_complete_samples(Outputs::Speaker::Speaker *, const std::vector &buffer) final { + std::lock_guard lock_guard(audio_buffer_mutex_); const size_t buffer_size = buffered_samples * (is_stereo ? 2 : 1); if(audio_buffer_.size() > buffer_size) { audio_buffer_.erase(audio_buffer_.begin(), audio_buffer_.end() - buffer_size); @@ -186,7 +186,7 @@ struct SpeakerDelegate: public Outputs::Speaker::Speaker::Delegate { } void audio_callback(Uint8 *stream, int len) { - std::lock_guard lock_guard(audio_buffer_mutex_); + std::lock_guard lock_guard(audio_buffer_mutex_); // SDL buffer length is in bytes, so there's no need to adjust for stereo/mono in here. const std::size_t sample_length = size_t(len) / sizeof(int16_t); @@ -234,7 +234,7 @@ class ActivityObserver: public Activity::Observer { } void set_aspect_ratio(float aspect_ratio) { - std::lock_guard lock_guard(mutex); + std::lock_guard lock_guard(mutex); lights_.clear(); // Generate a bunch of LEDs for connected drives. @@ -261,7 +261,7 @@ class ActivityObserver: public Activity::Observer { } void draw() { - std::lock_guard lock_guard(mutex); + std::lock_guard lock_guard(mutex); for(const auto &lit_led: lit_leds_) { if(blinking_leds_.find(lit_led) == blinking_leds_.end() && lights_.find(lit_led) != lights_.end()) lights_[lit_led]->draw(0.0, 0.8, 0.0); @@ -272,24 +272,24 @@ class ActivityObserver: public Activity::Observer { private: std::vector leds_; void register_led(const std::string &name) final { - std::lock_guard lock_guard(mutex); + std::lock_guard lock_guard(mutex); leds_.push_back(name); } std::vector drives_; void register_drive(const std::string &name) final { - std::lock_guard lock_guard(mutex); + std::lock_guard lock_guard(mutex); drives_.push_back(name); } void set_led_status(const std::string &name, bool lit) final { - std::lock_guard lock_guard(mutex); + std::lock_guard lock_guard(mutex); if(lit) lit_leds_.insert(name); else lit_leds_.erase(name); } - void announce_drive_event(const std::string &name, DriveEvent event) final { - std::lock_guard lock_guard(mutex); + void announce_drive_event(const std::string &name, DriveEvent) final { + std::lock_guard lock_guard(mutex); blinking_leds_.insert(name); } @@ -963,7 +963,7 @@ int main(int argc, char *argv[]) { // on vsync, anyway. // Grab the machine lock and process all pending events. - std::lock_guard lock_guard(machine_mutex); + std::lock_guard lock_guard(machine_mutex); const auto keyboard_machine = machine->keyboard_machine(); SDL_Event event; while(SDL_PollEvent(&event)) { diff --git a/Outputs/OpenGL/Primitives/Shader.cpp b/Outputs/OpenGL/Primitives/Shader.cpp index 3d2397160..87187f967 100644 --- a/Outputs/OpenGL/Primitives/Shader.cpp +++ b/Outputs/OpenGL/Primitives/Shader.cpp @@ -288,12 +288,12 @@ void Shader::set_uniform_matrix(const std::string &name, GLint size, GLsizei cou } void Shader::enqueue_function(std::function function) { - std::lock_guard function_guard(function_mutex_); + std::lock_guard function_guard(function_mutex_); enqueued_functions_.push_back(function); } void Shader::flush_functions() const { - std::lock_guard function_guard(function_mutex_); + std::lock_guard function_guard(function_mutex_); for(std::function function : enqueued_functions_) { function(); } diff --git a/Outputs/OpenGL/ScanTarget.cpp b/Outputs/OpenGL/ScanTarget.cpp index 0ad44193d..9b2f7aa6d 100644 --- a/Outputs/OpenGL/ScanTarget.cpp +++ b/Outputs/OpenGL/ScanTarget.cpp @@ -131,7 +131,7 @@ void ScanTarget::set_modals(Modals modals) { Outputs::Display::ScanTarget::Scan *ScanTarget::begin_scan() { if(allocation_has_failed_) return nullptr; - std::lock_guard lock_guard(write_pointers_mutex_); + std::lock_guard lock_guard(write_pointers_mutex_); const auto result = &scan_buffer_[write_pointers_.scan_buffer]; const auto read_pointers = read_pointers_.load(); @@ -156,7 +156,7 @@ Outputs::Display::ScanTarget::Scan *ScanTarget::begin_scan() { void ScanTarget::end_scan() { if(vended_scan_) { - std::lock_guard lock_guard(write_pointers_mutex_); + std::lock_guard lock_guard(write_pointers_mutex_); vended_scan_->data_y = TextureAddressGetY(vended_write_area_pointer_); vended_scan_->line = write_pointers_.line; vended_scan_->scan.end_points[0].data_offset += TextureAddressGetX(vended_write_area_pointer_); @@ -181,7 +181,7 @@ uint8_t *ScanTarget::begin_data(size_t required_length, size_t required_alignmen if(allocation_has_failed_) return nullptr; - std::lock_guard lock_guard(write_pointers_mutex_); + std::lock_guard lock_guard(write_pointers_mutex_); if(write_area_texture_.empty()) { allocation_has_failed_ = true; return nullptr; @@ -229,7 +229,7 @@ uint8_t *ScanTarget::begin_data(size_t required_length, size_t required_alignmen void ScanTarget::end_data(size_t actual_length) { if(allocation_has_failed_ || !data_is_allocated_) return; - std::lock_guard lock_guard(write_pointers_mutex_); + std::lock_guard lock_guard(write_pointers_mutex_); // Bookend the start of the new data, to safeguard for precision errors in sampling. memcpy( @@ -277,7 +277,7 @@ void ScanTarget::announce(Event event, bool is_visible, const Outputs::Display:: if(output_is_visible_ == is_visible) return; if(is_visible) { const auto read_pointers = read_pointers_.load(); - std::lock_guard lock_guard(write_pointers_mutex_); + std::lock_guard lock_guard(write_pointers_mutex_); // Commit the most recent line only if any scans fell on it. // Otherwise there's no point outputting it, it'll contribute nothing. @@ -350,7 +350,7 @@ void ScanTarget::setup_pipeline() { // Ensure the lock guard here has a restricted scope; this is the only time that a thread // other than the main owner of write_pointers_ may adjust it. { - std::lock_guard lock_guard(write_pointers_mutex_); + std::lock_guard lock_guard(write_pointers_mutex_); if(data_type_size != data_type_size_) { // TODO: flush output. diff --git a/Outputs/Speaker/Implementation/LowpassSpeaker.hpp b/Outputs/Speaker/Implementation/LowpassSpeaker.hpp index 595ae04cc..8d67c6f13 100644 --- a/Outputs/Speaker/Implementation/LowpassSpeaker.hpp +++ b/Outputs/Speaker/Implementation/LowpassSpeaker.hpp @@ -43,7 +43,7 @@ template class LowpassSpeaker: public Speaker { // Implemented as per Speaker. float get_ideal_clock_rate_in_range(float minimum, float maximum) final { - std::lock_guard lock_guard(filter_parameters_mutex_); + std::lock_guard lock_guard(filter_parameters_mutex_); // return twice the cut off, if applicable if( filter_parameters_.high_frequency_cutoff > 0.0f && @@ -66,7 +66,7 @@ template class LowpassSpeaker: public Speaker { // Implemented as per Speaker. void set_computed_output_rate(float cycles_per_second, int buffer_size, bool) final { - std::lock_guard lock_guard(filter_parameters_mutex_); + std::lock_guard lock_guard(filter_parameters_mutex_); if(filter_parameters_.output_cycles_per_second == cycles_per_second && size_t(buffer_size) == output_buffer_.size()) { return; } @@ -84,7 +84,7 @@ template class LowpassSpeaker: public Speaker { Sets the clock rate of the input audio. */ void set_input_rate(float cycles_per_second) { - std::lock_guard lock_guard(filter_parameters_mutex_); + std::lock_guard lock_guard(filter_parameters_mutex_); if(filter_parameters_.input_cycles_per_second == cycles_per_second) { return; } @@ -100,7 +100,7 @@ template class LowpassSpeaker: public Speaker { path to be explicit about its effect, and get that simulation for free. */ void set_high_frequency_cutoff(float high_frequency) { - std::lock_guard lock_guard(filter_parameters_mutex_); + std::lock_guard lock_guard(filter_parameters_mutex_); if(filter_parameters_.high_frequency_cutoff == high_frequency) { return; } @@ -141,7 +141,7 @@ template class LowpassSpeaker: public Speaker { FilterParameters filter_parameters; { - std::lock_guard lock_guard(filter_parameters_mutex_); + std::lock_guard lock_guard(filter_parameters_mutex_); filter_parameters = filter_parameters_; filter_parameters_.parameters_are_dirty = false; filter_parameters_.input_rate_changed = false; diff --git a/Storage/Disk/DiskImage/Formats/AppleDSK.cpp b/Storage/Disk/DiskImage/Formats/AppleDSK.cpp index c6475021c..ad9044776 100644 --- a/Storage/Disk/DiskImage/Formats/AppleDSK.cpp +++ b/Storage/Disk/DiskImage/Formats/AppleDSK.cpp @@ -64,7 +64,7 @@ size_t AppleDSK::logical_sector_for_physical_sector(size_t physical) { std::shared_ptr AppleDSK::get_track_at_position(Track::Address address) { std::vector track_data; { - std::lock_guard lock_guard(file_.get_file_access_mutex()); + std::lock_guard lock_guard(file_.get_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> } // 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_.get_file_access_mutex()); for(const auto &pair: tracks_by_address) { file_.seek(file_offset(pair.first), SEEK_SET); file_.write(pair.second); diff --git a/Storage/Disk/DiskImage/Formats/HFE.cpp b/Storage/Disk/DiskImage/Formats/HFE.cpp index 2ed86ee05..e11c4bb24 100644 --- a/Storage/Disk/DiskImage/Formats/HFE.cpp +++ b/Storage/Disk/DiskImage/Formats/HFE.cpp @@ -58,7 +58,7 @@ uint16_t HFE::seek_track(Track::Address address) { std::shared_ptr HFE::get_track_at_position(Track::Address address) { PCMSegment segment; { - std::lock_guard lock_guard(file_.get_file_access_mutex()); + std::lock_guard lock_guard(file_.get_file_access_mutex()); uint16_t track_length = seek_track(address); segment.data.resize(track_length * 8); @@ -102,7 +102,7 @@ std::shared_ptr HFE::get_track_at_position(Track::Address address) { void HFE::set_tracks(const std::map> &tracks) { for(auto &track : tracks) { - std::unique_lock lock_guard(file_.get_file_access_mutex()); + std::unique_lock lock_guard(file_.get_file_access_mutex()); uint16_t track_length = seek_track(track.first); lock_guard.unlock(); diff --git a/Storage/Disk/DiskImage/Formats/MFMSectorDump.cpp b/Storage/Disk/DiskImage/Formats/MFMSectorDump.cpp index e73222099..b00546296 100644 --- a/Storage/Disk/DiskImage/Formats/MFMSectorDump.cpp +++ b/Storage/Disk/DiskImage/Formats/MFMSectorDump.cpp @@ -29,7 +29,7 @@ std::shared_ptr MFMSectorDump::get_track_at_position(Track::Address addre 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_.get_file_access_mutex()); file_.seek(file_offset, SEEK_SET); file_.read(sectors, sizeof(sectors)); } @@ -48,7 +48,7 @@ void MFMSectorDump::set_tracks(const std::map lock_guard(file_.get_file_access_mutex()); + std::lock_guard lock_guard(file_.get_file_access_mutex()); file_.ensure_is_at_least_length(file_offset); file_.seek(file_offset, SEEK_SET); file_.write(parsed_track, sizeof(parsed_track)); diff --git a/Storage/Disk/DiskImage/Formats/MacintoshIMG.cpp b/Storage/Disk/DiskImage/Formats/MacintoshIMG.cpp index 6843a97cb..f0f95807e 100644 --- a/Storage/Disk/DiskImage/Formats/MacintoshIMG.cpp +++ b/Storage/Disk/DiskImage/Formats/MacintoshIMG.cpp @@ -169,7 +169,7 @@ std::shared_ptr<::Storage::Disk::Track> MacintoshIMG::get_track_at_position(::St Bit 5 indicates double sided or not. */ - std::lock_guard buffer_lock(buffer_mutex_); + std::lock_guard buffer_lock(buffer_mutex_); if(encoding_ == Encoding::GCR400 || encoding_ == Encoding::GCR800) { // Perform a GCR encoding. const auto included_sectors = Storage::Encodings::AppleGCR::Macintosh::sectors_in_track(address.position.as_int()); @@ -259,7 +259,7 @@ void MacintoshIMG::set_tracks(const std::map buffer_lock(buffer_mutex_); + std::lock_guard buffer_lock(buffer_mutex_); for(const auto &pair: tracks_by_address) { const auto included_sectors = Storage::Encodings::AppleGCR::Macintosh::sectors_in_track(pair.first.position.as_int()); size_t start_sector = size_t(included_sectors.start * get_head_count() + included_sectors.length * pair.first.head); @@ -283,7 +283,7 @@ void MacintoshIMG::set_tracks(const std::map lock_guard(file_.get_file_access_mutex()); + std::lock_guard lock_guard(file_.get_file_access_mutex()); if(!is_diskCopy_file_) { // Just dump out the new sectors. Grossly lazy, possibly worth improving. diff --git a/Storage/Disk/DiskImage/Formats/NIB.cpp b/Storage/Disk/DiskImage/Formats/NIB.cpp index 4b9eb4d35..bf49d0d45 100644 --- a/Storage/Disk/DiskImage/Formats/NIB.cpp +++ b/Storage/Disk/DiskImage/Formats/NIB.cpp @@ -61,7 +61,7 @@ std::shared_ptr<::Storage::Disk::Track> NIB::get_track_at_position(::Storage::Di long offset = file_offset(address); std::vector track_data; { - std::lock_guard lock_guard(file_.get_file_access_mutex()); + std::lock_guard lock_guard(file_.get_file_access_mutex()); file_.seek(offset, SEEK_SET); track_data = file_.read(track_length); } @@ -189,7 +189,7 @@ void NIB::set_tracks(const std::map> &tra } // Lock the file and spool out. - std::lock_guard lock_guard(file_.get_file_access_mutex()); + std::lock_guard lock_guard(file_.get_file_access_mutex()); for(const auto &track: tracks_by_address) { file_.seek(file_offset(track.first), SEEK_SET); file_.write(track.second); diff --git a/Storage/Disk/DiskImage/Formats/OricMFMDSK.cpp b/Storage/Disk/DiskImage/Formats/OricMFMDSK.cpp index 34f202a07..f7bd33744 100644 --- a/Storage/Disk/DiskImage/Formats/OricMFMDSK.cpp +++ b/Storage/Disk/DiskImage/Formats/OricMFMDSK.cpp @@ -53,7 +53,7 @@ long OricMFMDSK::get_file_offset_for_position(Track::Address address) { std::shared_ptr OricMFMDSK::get_track_at_position(Track::Address address) { PCMSegment segment; { - std::lock_guard lock_guard(file_.get_file_access_mutex()); + std::lock_guard lock_guard(file_.get_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 lock_guard(file_.get_file_access_mutex()); + std::lock_guard lock_guard(file_.get_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); diff --git a/Storage/Disk/DiskImage/Formats/WOZ.cpp b/Storage/Disk/DiskImage/Formats/WOZ.cpp index 090d427e6..78c50f1f2 100644 --- a/Storage/Disk/DiskImage/Formats/WOZ.cpp +++ b/Storage/Disk/DiskImage/Formats/WOZ.cpp @@ -110,7 +110,7 @@ std::shared_ptr WOZ::get_track_at_position(Track::Address address) { std::vector track_contents; size_t number_of_bits; { - std::lock_guard lock_guard(file_.get_file_access_mutex()); + std::lock_guard lock_guard(file_.get_file_access_mutex()); file_.seek(offset, SEEK_SET); // In WOZ a track is up to 6646 bytes of data, followed by a two-byte record of the @@ -148,7 +148,7 @@ void WOZ::set_tracks(const std::map> &tra const uint32_t crc = crc_generator.compute_crc(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_.get_file_access_mutex()); file_.seek(8, SEEK_SET); file_.put_le(crc); file_.write(post_crc_contents_);