diff --git a/Analyser/Static/Acorn/Disk.cpp b/Analyser/Static/Acorn/Disk.cpp index ac359ec3c..ff4327b91 100644 --- a/Analyser/Static/Acorn/Disk.cpp +++ b/Analyser/Static/Acorn/Disk.cpp @@ -18,7 +18,7 @@ using namespace Analyser::Static::Acorn; std::unique_ptr Analyser::Static::Acorn::GetDFSCatalogue(const std::shared_ptr &disk) { // c.f. http://beebwiki.mdfs.net/Acorn_DFS_disc_format - std::unique_ptr catalogue(new Catalogue); + auto catalogue = std::make_unique(); Storage::Encodings::MFM::Parser parser(false, disk); Storage::Encodings::MFM::Sector *names = parser.get_sector(0, 0, 0); @@ -75,7 +75,7 @@ std::unique_ptr Analyser::Static::Acorn::GetDFSCatalogue(const std::s return catalogue; } std::unique_ptr Analyser::Static::Acorn::GetADFSCatalogue(const std::shared_ptr &disk) { - std::unique_ptr catalogue(new Catalogue); + auto catalogue = std::make_unique(); Storage::Encodings::MFM::Parser parser(true, disk); Storage::Encodings::MFM::Sector *free_space_map_second_half = parser.get_sector(0, 0, 1); diff --git a/Analyser/Static/Acorn/StaticAnalyser.cpp b/Analyser/Static/Acorn/StaticAnalyser.cpp index 9d74a094a..252176f56 100644 --- a/Analyser/Static/Acorn/StaticAnalyser.cpp +++ b/Analyser/Static/Acorn/StaticAnalyser.cpp @@ -58,7 +58,7 @@ static std::vector> } Analyser::Static::TargetList Analyser::Static::Acorn::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) { - std::unique_ptr target(new Target); + auto target = std::make_unique(); target->machine = Machine::Electron; target->confidence = 0.5; // TODO: a proper estimation target->has_dfs = false; diff --git a/Analyser/Static/Acorn/Tape.cpp b/Analyser/Static/Acorn/Tape.cpp index ca8eba1b0..43f71e69e 100644 --- a/Analyser/Static/Acorn/Tape.cpp +++ b/Analyser/Static/Acorn/Tape.cpp @@ -16,7 +16,7 @@ using namespace Analyser::Static::Acorn; static std::unique_ptr GetNextChunk(const std::shared_ptr &tape, Storage::Tape::Acorn::Parser &parser) { - std::unique_ptr new_chunk(new File::Chunk); + auto new_chunk = std::make_unique(); int shift_register = 0; // TODO: move this into the parser @@ -90,7 +90,7 @@ static std::unique_ptr GetNextFile(std::deque &chunks) { if(!chunks.size()) return nullptr; // accumulate chunks for as long as block number is sequential and the end-of-file bit isn't set - std::unique_ptr file(new File); + auto file = std::make_unique(); uint16_t block_number = 0; diff --git a/Analyser/Static/AmstradCPC/StaticAnalyser.cpp b/Analyser/Static/AmstradCPC/StaticAnalyser.cpp index ee95fd072..7efadf16d 100644 --- a/Analyser/Static/AmstradCPC/StaticAnalyser.cpp +++ b/Analyser/Static/AmstradCPC/StaticAnalyser.cpp @@ -181,7 +181,7 @@ static bool CheckBootSector(const std::shared_ptr &disk, co Analyser::Static::TargetList Analyser::Static::AmstradCPC::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) { TargetList destination; - std::unique_ptr target(new Target); + auto target = std::make_unique(); target->machine = Machine::AmstradCPC; target->confidence = 0.5; diff --git a/Analyser/Static/Atari2600/StaticAnalyser.cpp b/Analyser/Static/Atari2600/StaticAnalyser.cpp index 74d048cd5..cd756e59e 100644 --- a/Analyser/Static/Atari2600/StaticAnalyser.cpp +++ b/Analyser/Static/Atari2600/StaticAnalyser.cpp @@ -183,7 +183,7 @@ static void DeterminePagingForCartridge(Target &target, const Storage::Cartridge Analyser::Static::TargetList Analyser::Static::Atari2600::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) { // TODO: sanity checking; is this image really for an Atari 2600? - std::unique_ptr target(new Target); + auto target = std::make_unique(); target->machine = Machine::Atari2600; target->confidence = 0.5; target->media.cartridges = media.cartridges; diff --git a/Analyser/Static/Coleco/StaticAnalyser.cpp b/Analyser/Static/Coleco/StaticAnalyser.cpp index 157e51f96..25f69e926 100644 --- a/Analyser/Static/Coleco/StaticAnalyser.cpp +++ b/Analyser/Static/Coleco/StaticAnalyser.cpp @@ -54,7 +54,7 @@ static std::vector> Analyser::Static::TargetList Analyser::Static::Coleco::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) { TargetList targets; - std::unique_ptr target(new Target); + auto target = std::make_unique(); target->machine = Machine::ColecoVision; target->confidence = 1.0f - 1.0f / 32768.0f; target->media.cartridges = ColecoCartridgesFrom(media.cartridges); diff --git a/Analyser/Static/Commodore/Disk.cpp b/Analyser/Static/Commodore/Disk.cpp index 0a47a8d8c..07b3cfe74 100644 --- a/Analyser/Static/Commodore/Disk.cpp +++ b/Analyser/Static/Commodore/Disk.cpp @@ -125,7 +125,7 @@ class CommodoreGCRParser: public Storage::Disk::Controller { } std::shared_ptr get_next_sector() { - std::shared_ptr sector(new Sector); + auto sector = std::make_shared(); const int max_index_count = index_count_ + 2; while(index_count_ < max_index_count) { diff --git a/Analyser/Static/Commodore/StaticAnalyser.cpp b/Analyser/Static/Commodore/StaticAnalyser.cpp index 789db5c0f..b7e63f160 100644 --- a/Analyser/Static/Commodore/StaticAnalyser.cpp +++ b/Analyser/Static/Commodore/StaticAnalyser.cpp @@ -44,7 +44,7 @@ static std::vector> Analyser::Static::TargetList Analyser::Static::Commodore::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) { TargetList destination; - std::unique_ptr target(new Target); + auto target = std::make_unique(); target->machine = Machine::Vic20; // TODO: machine estimation target->confidence = 0.5; // TODO: a proper estimation diff --git a/Analyser/Static/MSX/StaticAnalyser.cpp b/Analyser/Static/MSX/StaticAnalyser.cpp index 79a869ccd..a20350ca9 100644 --- a/Analyser/Static/MSX/StaticAnalyser.cpp +++ b/Analyser/Static/MSX/StaticAnalyser.cpp @@ -34,7 +34,7 @@ static std::unique_ptr CartridgeTarget( output_segments.emplace_back(start_address, segment.data); } - std::unique_ptr target(new Analyser::Static::MSX::Target); + auto target = std::make_unique(); target->machine = Analyser::Machine::MSX; target->confidence = confidence; @@ -269,7 +269,7 @@ Analyser::Static::TargetList Analyser::Static::MSX::GetTargets(const Media &medi std::move(cartridge_targets.begin(), cartridge_targets.end(), std::back_inserter(destination)); // Consider building a target for disks and/or tapes. - std::unique_ptr target(new Target); + auto target = std::make_unique(); // Check tapes for loadable files. for(auto &tape : media.tapes) { diff --git a/Analyser/Static/Oric/StaticAnalyser.cpp b/Analyser/Static/Oric/StaticAnalyser.cpp index 2ec0457c0..854c2cabb 100644 --- a/Analyser/Static/Oric/StaticAnalyser.cpp +++ b/Analyser/Static/Oric/StaticAnalyser.cpp @@ -101,7 +101,7 @@ static bool IsMicrodisc(Storage::Encodings::MFM::Parser &parser) { } Analyser::Static::TargetList Analyser::Static::Oric::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) { - std::unique_ptr target(new Target); + auto target = std::make_unique(); target->machine = Machine::Oric; target->confidence = 0.5; diff --git a/Analyser/Static/Sega/StaticAnalyser.cpp b/Analyser/Static/Sega/StaticAnalyser.cpp index 038be85be..37b9d54d4 100644 --- a/Analyser/Static/Sega/StaticAnalyser.cpp +++ b/Analyser/Static/Sega/StaticAnalyser.cpp @@ -18,7 +18,7 @@ Analyser::Static::TargetList Analyser::Static::Sega::GetTargets(const Media &med return {}; TargetList targets; - std::unique_ptr target(new Target); + auto target = std::make_unique(); target->machine = Machine::MasterSystem; diff --git a/Concurrency/AsyncTaskQueue.cpp b/Concurrency/AsyncTaskQueue.cpp index 838e1fbf1..fc3b885c3 100644 --- a/Concurrency/AsyncTaskQueue.cpp +++ b/Concurrency/AsyncTaskQueue.cpp @@ -70,8 +70,8 @@ void AsyncTaskQueue::flush() { #ifdef __APPLE__ dispatch_sync(serial_dispatch_queue_, ^{}); #else - std::shared_ptr flush_mutex(new std::mutex); - std::shared_ptr flush_condition(new std::condition_variable); + auto flush_mutex = std::make_shared(); + auto flush_condition = std::make_shared(); std::unique_lock lock(*flush_mutex); enqueue([=] () { std::unique_lock inner_lock(*flush_mutex); diff --git a/Machines/Commodore/Vic-20/Vic20.cpp b/Machines/Commodore/Vic-20/Vic20.cpp index cb7682c80..3faf30930 100644 --- a/Machines/Commodore/Vic-20/Vic20.cpp +++ b/Machines/Commodore/Vic-20/Vic20.cpp @@ -646,8 +646,7 @@ class ConcreteMachine: } void type_string(const std::string &string) override final { - std::unique_ptr mapper(new CharacterMapper()); - Utility::TypeRecipient::add_typer(string, std::move(mapper)); + Utility::TypeRecipient::add_typer(string, std::make_unique()); } void tape_did_change_input(Storage::Tape::BinaryTapePlayer *tape) override final { diff --git a/Machines/Electron/Electron.cpp b/Machines/Electron/Electron.cpp index 1370cf3c0..98b3eb2e4 100644 --- a/Machines/Electron/Electron.cpp +++ b/Machines/Electron/Electron.cpp @@ -409,8 +409,7 @@ class ConcreteMachine: } void type_string(const std::string &string) override final { - std::unique_ptr mapper(new CharacterMapper()); - Utility::TypeRecipient::add_typer(string, std::move(mapper)); + Utility::TypeRecipient::add_typer(string, std::make_unique()); } KeyboardMapper *get_keyboard_mapper() override { diff --git a/Machines/ZX8081/ZX8081.cpp b/Machines/ZX8081/ZX8081.cpp index c06bd8d10..f0de30e17 100644 --- a/Machines/ZX8081/ZX8081.cpp +++ b/Machines/ZX8081/ZX8081.cpp @@ -336,8 +336,7 @@ template class ConcreteMachine: } void type_string(const std::string &string) override final { - std::unique_ptr mapper(new CharacterMapper(is_zx81)); - Utility::TypeRecipient::add_typer(string, std::move(mapper)); + Utility::TypeRecipient::add_typer(string, std::make_unique(is_zx81)); } // MARK: - Keyboard diff --git a/OSBindings/Mac/Clock Signal/Machine/CSROMFetcher.mm b/OSBindings/Mac/Clock Signal/Machine/CSROMFetcher.mm index 474a36b41..b1f36c455 100644 --- a/OSBindings/Mac/Clock Signal/Machine/CSROMFetcher.mm +++ b/OSBindings/Mac/Clock Signal/Machine/CSROMFetcher.mm @@ -48,7 +48,7 @@ ROMMachine::ROMFetcher CSROMFetcher(std::vector *missing_roms) } } else { - std::unique_ptr> data(new std::vector); + auto data = std::make_unique>(); *data = fileData.stdVector8; results.emplace_back(std::move(data)); } diff --git a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm index a73c3e4ea..2caaea298 100644 --- a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm +++ b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm @@ -45,7 +45,7 @@ self = [super init]; if(self) { using Target = Analyser::Static::Acorn::Target; - std::unique_ptr target(new Target); + auto target = std::make_unique(); target->machine = Analyser::Machine::Electron; target->has_dfs = !!dfs; target->has_adfs = !!adfs; @@ -58,7 +58,7 @@ self = [super init]; if(self) { using Target = Analyser::Static::AmstradCPC::Target; - std::unique_ptr target(new Target); + auto target = std::make_unique(); target->machine = Analyser::Machine::AmstradCPC; switch(model) { case CSMachineCPCModel464: target->model = Analyser::Static::AmstradCPC::Target::Model::CPC464; break; @@ -74,7 +74,7 @@ self = [super init]; if(self) { using Target = Analyser::Static::MSX::Target; - std::unique_ptr target(new Target); + auto target = std::make_unique(); target->machine = Analyser::Machine::MSX; target->has_disk_drive = !!hasDiskDrive; switch(region) { @@ -91,7 +91,7 @@ self = [super init]; if(self) { using Target = Analyser::Static::Oric::Target; - std::unique_ptr target(new Target); + auto target = std::make_unique(); target->machine = Analyser::Machine::Oric; switch(model) { case CSMachineOricModelOric1: target->rom = Target::ROM::BASIC10; break; @@ -112,7 +112,7 @@ self = [super init]; if(self) { using Target = Analyser::Static::Commodore::Target; - std::unique_ptr target(new Target); + auto target = std::make_unique(); target->machine = Analyser::Machine::Vic20; switch(region) { case CSMachineVic20RegionDanish: target->region = Target::Region::Danish; break; @@ -145,7 +145,7 @@ static Analyser::Static::ZX8081::Target::MemoryModel ZX8081MemoryModelFromSize(K self = [super init]; if(self) { using Target = Analyser::Static::ZX8081::Target; - std::unique_ptr target(new Target); + auto target = std::make_unique(); target->machine = Analyser::Machine::ZX8081; target->is_ZX81 = false; target->ZX80_uses_ZX81_ROM = !!useZX81ROM; @@ -159,7 +159,7 @@ static Analyser::Static::ZX8081::Target::MemoryModel ZX8081MemoryModelFromSize(K self = [super init]; if(self) { using Target = Analyser::Static::ZX8081::Target; - std::unique_ptr target(new Target); + auto target = std::make_unique(); target->machine = Analyser::Machine::ZX8081; target->is_ZX81 = true; target->memory_model = ZX8081MemoryModelFromSize(memorySize); @@ -172,7 +172,7 @@ static Analyser::Static::ZX8081::Target::MemoryModel ZX8081MemoryModelFromSize(K self = [super init]; if(self) { using Target = Analyser::Static::AppleII::Target; - std::unique_ptr target(new Target); + auto target = std::make_unique(); target->machine = Analyser::Machine::AppleII; switch(model) { default: target->model = Target::Model::II; break; @@ -195,7 +195,7 @@ static Analyser::Static::ZX8081::Target::MemoryModel ZX8081MemoryModelFromSize(K self = [super init]; if(self) { using Target = Analyser::Static::Macintosh::Target; - std::unique_ptr target(new Target); + auto target = std::make_unique(); target->machine = Analyser::Machine::Macintosh; using Model = Target::Model; @@ -216,7 +216,7 @@ static Analyser::Static::ZX8081::Target::MemoryModel ZX8081MemoryModelFromSize(K self = [super init]; if(self) { using Target = Analyser::Static::Macintosh::Target; - std::unique_ptr target(new Target); + auto target = std::make_unique(); target->machine = Analyser::Machine::AtariST; _targets.push_back(std::move(target)); } diff --git a/OSBindings/SDL/main.cpp b/OSBindings/SDL/main.cpp index 6ec21135e..2a45c8a09 100644 --- a/OSBindings/SDL/main.cpp +++ b/OSBindings/SDL/main.cpp @@ -423,7 +423,7 @@ int main(int argc, char *argv[]) { continue; } - std::unique_ptr> data(new std::vector); + auto data = std::make_unique>(); std::fseek(file, 0, SEEK_END); data->resize(std::ftell(file)); diff --git a/Storage/Data/ZX8081.cpp b/Storage/Data/ZX8081.cpp index 8ac0be5ce..ffdf6ba24 100644 --- a/Storage/Data/ZX8081.cpp +++ b/Storage/Data/ZX8081.cpp @@ -39,7 +39,7 @@ static std::shared_ptr ZX80FileFromData(const std::vector &data) // TODO: check that the line numbers declared above exist (?) - std::shared_ptr file(new File); + auto file = std::make_shared(); file->data = data; file->isZX81 = false; return file; @@ -81,7 +81,7 @@ static std::shared_ptr ZX81FileFromData(const std::vector &data) // TODO: check that the line numbers declared above exist (?) - std::shared_ptr file(new File); + auto file = std::make_shared(); file->name = StringFromData(name_data, true); file->data = data; file->isZX81 = true; diff --git a/Storage/Tape/Parsers/Commodore.cpp b/Storage/Tape/Parsers/Commodore.cpp index b7d3695f4..c646c0fe6 100644 --- a/Storage/Tape/Parsers/Commodore.cpp +++ b/Storage/Tape/Parsers/Commodore.cpp @@ -20,8 +20,7 @@ Parser::Parser() : Advances to the next block on the tape, treating it as a header, then consumes, parses, and returns it. Returns @c nullptr if any wave-encoding level errors are encountered. */ -std::unique_ptr
Parser::get_next_header(const std::shared_ptr &tape) -{ +std::unique_ptr
Parser::get_next_header(const std::shared_ptr &tape) { return duplicate_match
( get_next_header_body(tape, true), get_next_header_body(tape, false) @@ -32,8 +31,7 @@ std::unique_ptr
Parser::get_next_header(const std::shared_ptr Parser::get_next_data(const std::shared_ptr &tape) -{ +std::unique_ptr Parser::get_next_data(const std::shared_ptr &tape) { return duplicate_match( get_next_data_body(tape, true), get_next_data_body(tape, false) @@ -45,8 +43,7 @@ std::unique_ptr Parser::get_next_data(const std::shared_ptr - std::unique_ptr Parser::duplicate_match(std::unique_ptr first_copy, std::unique_ptr second_copy) -{ + std::unique_ptr Parser::duplicate_match(std::unique_ptr first_copy, std::unique_ptr second_copy) { // if only one copy was parsed successfully, return it if(!first_copy) return second_copy; if(!second_copy) return first_copy; @@ -67,9 +64,8 @@ template return std::move(*copy_to_return); } -std::unique_ptr
Parser::get_next_header_body(const std::shared_ptr &tape, bool is_original) -{ - std::unique_ptr
header(new Header); +std::unique_ptr
Parser::get_next_header_body(const std::shared_ptr &tape, bool is_original) { + auto header = std::make_unique
(); reset_error_flag(); // find and proceed beyond lead-in tone @@ -119,8 +115,7 @@ std::unique_ptr
Parser::get_next_header_body(const std::shared_ptr Parser::get_next_data_body(const std::shared_ptr &tape, bool is_original) -{ - std::unique_ptr data(new Data); +std::unique_ptr Parser::get_next_data_body(const std::shared_ptr &tape, bool is_original) { + auto data = std::make_unique(); reset_error_flag(); // find and proceed beyond lead-in tone to the next landing zone @@ -143,8 +137,7 @@ std::unique_ptr Parser::get_next_data_body(const std::shared_ptris_at_end()) - { + while(!tape->is_at_end()) { SymbolType start_symbol = get_next_symbol(tape); if(start_symbol != SymbolType::Word) break; data->data.push_back(get_next_byte_contents(tape)); @@ -163,19 +156,15 @@ std::unique_ptr Parser::get_next_data_body(const std::shared_ptr &tape, bool is_original) -{ +void Parser::proceed_to_landing_zone(const std::shared_ptr &tape, bool is_original) { uint8_t landing_zone[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; - while(!tape->is_at_end()) - { + while(!tape->is_at_end()) { memmove(landing_zone, &landing_zone[1], sizeof(uint8_t) * 8); landing_zone[8] = get_next_byte(tape); bool is_landing_zone = true; - for(int c = 0; c < 9; c++) - { - if(landing_zone[c] != ((is_original ? 0x80 : 0x00) | 0x9) - c) - { + for(int c = 0; c < 9; c++) { + if(landing_zone[c] != ((is_original ? 0x80 : 0x00) | 0x9) - c) { is_landing_zone = false; break; } @@ -188,10 +177,8 @@ void Parser::proceed_to_landing_zone(const std::shared_ptr Swallows symbols until it reaches the first instance of the required symbol, swallows that and returns. */ -void Parser::proceed_to_symbol(const std::shared_ptr &tape, SymbolType required_symbol) -{ - while(!tape->is_at_end()) - { +void Parser::proceed_to_symbol(const std::shared_ptr &tape, SymbolType required_symbol) { + while(!tape->is_at_end()) { SymbolType symbol = get_next_symbol(tape); if(symbol == required_symbol) return; } @@ -200,8 +187,7 @@ void Parser::proceed_to_symbol(const std::shared_ptr &tape, /*! Swallows the next byte; sets the error flag if it is not equal to @c value. */ -void Parser::expect_byte(const std::shared_ptr &tape, uint8_t value) -{ +void Parser::expect_byte(const std::shared_ptr &tape, uint8_t value) { uint8_t next_byte = get_next_byte(tape); if(next_byte != value) set_error_flag(); } @@ -213,8 +199,7 @@ void Parser::add_parity_byte(uint8_t byte) { parity_byte_ ^= byte; } /*! Proceeds to the next word marker then returns the result of @c get_next_byte_contents. */ -uint8_t Parser::get_next_byte(const std::shared_ptr &tape) -{ +uint8_t Parser::get_next_byte(const std::shared_ptr &tape) { proceed_to_symbol(tape, SymbolType::Word); return get_next_byte_contents(tape); } @@ -224,12 +209,10 @@ uint8_t Parser::get_next_byte(const std::shared_ptr &tape) Returns a byte composed of the first eight of those as bits; sets the error flag if any symbol is not ::One and not ::Zero, or if the ninth bit is not equal to the odd parity of the other eight. */ -uint8_t Parser::get_next_byte_contents(const std::shared_ptr &tape) -{ +uint8_t Parser::get_next_byte_contents(const std::shared_ptr &tape) { int byte_plus_parity = 0; int c = 9; - while(c--) - { + while(c--) { SymbolType next_symbol = get_next_symbol(tape); if((next_symbol != SymbolType::One) && (next_symbol != SymbolType::Zero)) set_error_flag(); byte_plus_parity = (byte_plus_parity >> 1) | (((next_symbol == SymbolType::One) ? 1 : 0) << 8); @@ -249,8 +232,7 @@ uint8_t Parser::get_next_byte_contents(const std::shared_ptr &tape) -{ +uint16_t Parser::get_next_short(const std::shared_ptr &tape) { uint16_t value = get_next_byte(tape); value |= get_next_byte(tape) << 8; return value; @@ -261,15 +243,13 @@ uint16_t Parser::get_next_short(const std::shared_ptr &tape indicates a high to low transition, inspects the time since the last transition, to produce a long, medium, short or unrecognised wave period. */ -void Parser::process_pulse(const Storage::Tape::Tape::Pulse &pulse) -{ +void Parser::process_pulse(const Storage::Tape::Tape::Pulse &pulse) { // The Complete Commodore Inner Space Anthology, P 97, gives half-cycle lengths of: // short: 182us => 0.000364s cycle // medium: 262us => 0.000524s cycle // long: 342us => 0.000684s cycle bool is_high = pulse.type == Storage::Tape::Tape::Pulse::High; - if(!is_high && previous_was_high_) - { + if(!is_high && previous_was_high_) { if(wave_period_ >= 0.000764) push_wave(WaveType::Unrecognised); else if(wave_period_ >= 0.000604) push_wave(WaveType::Long); else if(wave_period_ >= 0.000444) push_wave(WaveType::Medium); @@ -287,36 +267,30 @@ void Parser::process_pulse(const Storage::Tape::Tape::Pulse &pulse) Per the contract with Analyser::Static::TapeParser; produces any of a word marker, an end-of-block marker, a zero, a one or a lead-in symbol based on the currently captured waves. */ -void Parser::inspect_waves(const std::vector &waves) -{ +void Parser::inspect_waves(const std::vector &waves) { if(waves.size() < 2) return; - if(waves[0] == WaveType::Long && waves[1] == WaveType::Medium) - { + if(waves[0] == WaveType::Long && waves[1] == WaveType::Medium) { push_symbol(SymbolType::Word, 2); return; } - if(waves[0] == WaveType::Long && waves[1] == WaveType::Short) - { + if(waves[0] == WaveType::Long && waves[1] == WaveType::Short) { push_symbol(SymbolType::EndOfBlock, 2); return; } - if(waves[0] == WaveType::Short && waves[1] == WaveType::Medium) - { + if(waves[0] == WaveType::Short && waves[1] == WaveType::Medium) { push_symbol(SymbolType::Zero, 2); return; } - if(waves[0] == WaveType::Medium && waves[1] == WaveType::Short) - { + if(waves[0] == WaveType::Medium && waves[1] == WaveType::Short) { push_symbol(SymbolType::One, 2); return; } - if(waves[0] == WaveType::Short) - { + if(waves[0] == WaveType::Short) { push_symbol(SymbolType::LeadIn, 1); return; } diff --git a/Storage/Tape/Parsers/MSX.cpp b/Storage/Tape/Parsers/MSX.cpp index 3af952cd3..723f44fbe 100644 --- a/Storage/Tape/Parsers/MSX.cpp +++ b/Storage/Tape/Parsers/MSX.cpp @@ -71,7 +71,7 @@ std::unique_ptr Parser::find_header(Storage::Tape::BinaryTape // To convert to the loop count format used by the MSX BIOS. uint8_t int_result = static_cast(total_length / (0.00001145f * 0.75f)); - std::unique_ptr result(new FileSpeed); + auto result = std::make_unique(); result->minimum_start_bit_duration = int_result; result->low_high_disrimination_duration = (int_result * 3) >> 2; diff --git a/Storage/Tape/Parsers/ZX8081.cpp b/Storage/Tape/Parsers/ZX8081.cpp index 61148c9b5..10754909f 100644 --- a/Storage/Tape/Parsers/ZX8081.cpp +++ b/Storage/Tape/Parsers/ZX8081.cpp @@ -120,7 +120,7 @@ std::shared_ptr> Parser::get_next_file_data(const std::shar if(is_at_end(tape)) return nullptr; return_symbol(symbol); - std::shared_ptr> result(new std::vector); + auto result = std::make_shared>(); int byte; while(!is_at_end(tape)) { byte = get_next_byte(tape);