X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=logicdatasnapshot.cpp;h=62d8a90bdc184ee5c9a50ada94d6674b6cfcca57;hp=d01916a763be20e63962928870a15cf142c9032c;hb=b3f22de060b73f15ad3eb2dabee04a0b4f5d947e;hpb=7d0d64f9c01c1c92413f51f0dee3fd2543c8e4cb diff --git a/logicdatasnapshot.cpp b/logicdatasnapshot.cpp index d01916a7..62d8a90b 100644 --- a/logicdatasnapshot.cpp +++ b/logicdatasnapshot.cpp @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -55,7 +56,6 @@ void LogicDataSnapshot::append_payload( { assert(_unit_size == logic.unitsize); - const uint64_t prev_length = _data_length; append_data(logic.data, logic.length); // Generate the first mip-map from the data @@ -84,7 +84,7 @@ void LogicDataSnapshot::append_payload_to_mipmap() // Expand the data buffer to fit the new samples prev_length = m0.length; - m0.length = _data_length / MipMapScaleFactor; + m0.length = _sample_count / MipMapScaleFactor; // Break off if there are no new samples to compute if(m0.length == prev_length) @@ -160,7 +160,7 @@ void LogicDataSnapshot::append_payload_to_mipmap() uint64_t LogicDataSnapshot::get_sample(uint64_t index) const { assert(_data); - assert(index >= 0 && index < _data_length); + assert(index >= 0 && index < _sample_count); return *(uint64_t*)((uint8_t*)_data + index * _unit_size); }