]> sigrok.org Git - pulseview.git/commitdiff
Fixed usage of sr_datafeed_logic::length
authorJoel Holdsworth <redacted>
Sun, 13 Jan 2013 11:55:51 +0000 (11:55 +0000)
committerJoel Holdsworth <redacted>
Sun, 13 Jan 2013 11:57:03 +0000 (11:57 +0000)
The length field is a measure of bytes not samples. The previous
usage would fail unless the unitsize was set to 1.

pv/data/logicsnapshot.cpp

index 9b3eedd107ad31f33eab0f0ef45950cb06a0cae0..5665d35f8c3d58916b3df6ed41c11227f13d39cf 100644 (file)
@@ -60,10 +60,11 @@ void LogicSnapshot::append_payload(
        const sr_datafeed_logic &logic)
 {
        assert(_unit_size == logic.unitsize);
+       assert((logic.length % _unit_size) == 0);
 
        lock_guard<recursive_mutex> lock(_mutex);
 
-       append_data(logic.data, logic.length);
+       append_data(logic.data, logic.length / _unit_size);
 
        // Generate the first mip-map from the data
        append_payload_to_mipmap();