X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fdata%2Fsegment.cpp;h=831c0acaac49cf68fd428ce7ef57fabc6f8a4576;hb=60d9b99a32e551cffd2b537d3e157d578a761c9b;hp=111b62b71aadf0c43189540050c55e92de29dc43;hpb=f3d66e52ed6b454ea7a0662d5e6367e230116a2b;p=pulseview.git diff --git a/pv/data/segment.cpp b/pv/data/segment.cpp index 111b62b..831c0ac 100644 --- a/pv/data/segment.cpp +++ b/pv/data/segment.cpp @@ -52,7 +52,7 @@ uint64_t Segment::get_sample_count() const return sample_count_; } -double Segment::start_time() const +const pv::util::Timestamp& Segment::start_time() const { return start_time_; } @@ -78,8 +78,9 @@ void Segment::set_capacity(const uint64_t new_capacity) assert(capacity_ >= sample_count_); if (new_capacity > capacity_) { - capacity_ = new_capacity; + // If we're out of memory, this will throw std::bad_alloc data_.resize((new_capacity * unit_size_) + sizeof(uint64_t)); + capacity_ = new_capacity; } }