From 7eca910cc571791edf234c79632a0fae1a8c0dbc Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 20 Dec 2016 21:14:05 -0500 Subject: [PATCH] Fixed insertion location finding logic, working on the relevant test. --- OSBindings/Mac/Clock SignalTests/PCMPatchedTrackTests.mm | 3 +-- Storage/Disk/PCMPatchedTrack.cpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/OSBindings/Mac/Clock SignalTests/PCMPatchedTrackTests.mm b/OSBindings/Mac/Clock SignalTests/PCMPatchedTrackTests.mm index 467c65d7d..bafdf4ec8 100644 --- a/OSBindings/Mac/Clock SignalTests/PCMPatchedTrackTests.mm +++ b/OSBindings/Mac/Clock SignalTests/PCMPatchedTrackTests.mm @@ -158,8 +158,7 @@ if(events.back().type == Storage::Disk::Track::Event::IndexHole) break; } - XCTAssert(events.size() == 17, @"Should still be 17 total events"); - XCTAssert(events[16].length == Storage::Time(33, 64), @"Final event should take 33/64"); + XCTAssert(events.size() == 33, @"Should still be 33 total events"); XCTAssert(total_length == Storage::Time(1), @"Total track length should still be 1"); } diff --git a/Storage/Disk/PCMPatchedTrack.cpp b/Storage/Disk/PCMPatchedTrack.cpp index bed3f4b13..b67ccf414 100644 --- a/Storage/Disk/PCMPatchedTrack.cpp +++ b/Storage/Disk/PCMPatchedTrack.cpp @@ -51,7 +51,7 @@ void PCMPatchedTrack::insert_period(const Period &period) { // find the existing period that the new period starts in std::vector::iterator start_period = periods_.begin(); - while(start_period->start_time >= period.end_time) start_period++; + while(start_period->end_time <= period.start_time) start_period++; // find the existing period that the new period end in std::vector::iterator end_period = start_period;