From 1f56e85f6d4fe9ebe3a705fc2595fd48144bdf05 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 6 May 2017 22:19:08 -0400 Subject: [PATCH] Centralised resetting of tape files within the static analyser, having implemented it patchily. --- StaticAnalyser/Acorn/StaticAnalyser.cpp | 2 -- StaticAnalyser/Oric/Tape.cpp | 2 -- StaticAnalyser/StaticAnalyser.cpp | 8 ++++++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/StaticAnalyser/Acorn/StaticAnalyser.cpp b/StaticAnalyser/Acorn/StaticAnalyser.cpp index 362ff74bc..98edd262d 100644 --- a/StaticAnalyser/Acorn/StaticAnalyser.cpp +++ b/StaticAnalyser/Acorn/StaticAnalyser.cpp @@ -74,9 +74,7 @@ void StaticAnalyser::Acorn::AddTargets( // if there are any tapes, attempt to get data from the first if(tapes.size() > 0) { std::shared_ptr tape = tapes.front(); - tape->reset(); std::list files = GetFiles(tape); - tape->reset(); // continue if there are any files if(files.size()) { diff --git a/StaticAnalyser/Oric/Tape.cpp b/StaticAnalyser/Oric/Tape.cpp index 0df23e064..8ba4e772c 100644 --- a/StaticAnalyser/Oric/Tape.cpp +++ b/StaticAnalyser/Oric/Tape.cpp @@ -15,7 +15,6 @@ std::list StaticAnalyser::Oric::GetFiles(const std::shared_ptr files; Storage::Tape::Oric::Parser parser; - tape->reset(); while(!tape->is_at_end()) { // sync to next lead-in, check that it's one of three 0x16s bool is_fast = parser.sync_and_get_encoding_speed(tape); @@ -81,7 +80,6 @@ std::list StaticAnalyser::Oric::GetFiles(const std::shared_ptrreset(); return files; } diff --git a/StaticAnalyser/StaticAnalyser.cpp b/StaticAnalyser/StaticAnalyser.cpp index 291187996..803890521 100644 --- a/StaticAnalyser/StaticAnalyser.cpp +++ b/StaticAnalyser/StaticAnalyser.cpp @@ -128,5 +128,13 @@ std::list StaticAnalyser::GetTargets(const char *file_name) free(lowercase_extension); } + + // Reset any tapes to their initial position + for(auto target : targets) { + for(auto tape : target.tapes) { + tape->reset(); + } + } + return targets; }