X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdata%2Fsegment.cpp;h=9afc8ea2d5b49a9f65ea31fb76f10c97069ac002;hp=831c0acaac49cf68fd428ce7ef57fabc6f8a4576;hb=efdec55aec1a137460fa362a381ed1904182bfed;hpb=60d9b99a32e551cffd2b537d3e157d578a761c9b diff --git a/pv/data/segment.cpp b/pv/data/segment.cpp index 831c0ac..9afc8ea 100644 --- a/pv/data/segment.cpp +++ b/pv/data/segment.cpp @@ -14,8 +14,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * along with this program; if not, see . */ #include "segment.hpp" @@ -98,9 +97,8 @@ void Segment::append_data(void *data, uint64_t samples) // Ensure there's enough capacity to copy. const uint64_t free_space = capacity_ - sample_count_; - if (free_space < samples) { + if (free_space < samples) set_capacity(sample_count_ + samples); - } memcpy((uint8_t*)data_.data() + sample_count_ * unit_size_, data, samples * unit_size_);