From: Uwe Hermann Date: Wed, 12 Dec 2012 21:19:22 +0000 (+0100) Subject: Some smaller whitespace fixes. X-Git-Tag: pulseview-0.1.0~199 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=333d5bbc0a326e6fa82db44f3e6ba8dd79cafdd8 Some smaller whitespace fixes. --- diff --git a/main.cpp b/main.cpp index 98fc9ad5..f4506787 100644 --- a/main.cpp +++ b/main.cpp @@ -60,8 +60,8 @@ int main(int argc, char *argv[]) // Parse arguments while (1) { static const struct option long_options[] = { - {"version", no_argument, 0, 'V'}, - {"help", no_argument, 0, 'h'}, + {"version", no_argument, 0, 'V'}, + {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; @@ -106,7 +106,7 @@ int main(int argc, char *argv[]) } } - if(ret == 0) { + if (ret == 0) { // Initialise the main window pv::MainWindow w; w.show(); diff --git a/pv/logicdatasnapshot.cpp b/pv/logicdatasnapshot.cpp index b264980b..bd2404a6 100644 --- a/pv/logicdatasnapshot.cpp +++ b/pv/logicdatasnapshot.cpp @@ -73,7 +73,7 @@ void LogicDataSnapshot::reallocate_mip_map(MipMapLevel &m) { const uint64_t new_data_length = ((m.length + MipMapDataUnit - 1) / MipMapDataUnit) * MipMapDataUnit; - if(new_data_length > m.data_length) + if (new_data_length > m.data_length) { m.data_length = new_data_length; m.data = realloc(m.data, new_data_length * _unit_size); @@ -94,7 +94,7 @@ void LogicDataSnapshot::append_payload_to_mipmap() m0.length = _sample_count / MipMapScaleFactor; // Break off if there are no new samples to compute - if(m0.length == prev_length) + if (m0.length == prev_length) return; reallocate_mip_map(m0); @@ -106,14 +106,14 @@ void LogicDataSnapshot::append_payload_to_mipmap() diff_counter = MipMapScaleFactor; const uint8_t *end_src_ptr = (uint8_t*)_data + m0.length * _unit_size * MipMapScaleFactor; - for(src_ptr = (uint8_t*)_data + + for (src_ptr = (uint8_t*)_data + prev_length * _unit_size * MipMapScaleFactor; src_ptr < end_src_ptr;) { // Accumulate transitions which have occurred in this sample accumulator = 0; diff_counter = MipMapScaleFactor; - while(diff_counter-- > 0) + while (diff_counter-- > 0) { const uint64_t sample = *(uint64_t*)src_ptr; accumulator |= _last_append_sample ^ sample; @@ -126,7 +126,7 @@ void LogicDataSnapshot::append_payload_to_mipmap() } // Compute higher level mipmaps - for(unsigned int level = 1; level < ScaleStepCount; level++) + for (unsigned int level = 1; level < ScaleStepCount; level++) { MipMapLevel &m = _mip_map[level]; const MipMapLevel &ml = _mip_map[level-1]; @@ -136,7 +136,7 @@ void LogicDataSnapshot::append_payload_to_mipmap() m.length = ml.length / MipMapScaleFactor; // Break off if there are no more samples to computed - if(m.length == prev_length) + if (m.length == prev_length) break; reallocate_mip_map(m); @@ -146,14 +146,14 @@ void LogicDataSnapshot::append_payload_to_mipmap() _unit_size * prev_length * MipMapScaleFactor; const uint8_t *end_dest_ptr = (uint8_t*)m.data + _unit_size * m.length; - for(dest_ptr = (uint8_t*)m.data + + for (dest_ptr = (uint8_t*)m.data + _unit_size * prev_length; dest_ptr < end_dest_ptr; dest_ptr += _unit_size) { accumulator = 0; diff_counter = MipMapScaleFactor; - while(diff_counter-- > 0) + while (diff_counter-- > 0) { accumulator |= *(uint64_t*)src_ptr; src_ptr += _unit_size; @@ -200,20 +200,20 @@ void LogicDataSnapshot::get_subsampled_edges( last_sample = (get_sample(start) & sig_mask) != 0; edges.push_back(pair(index++, last_sample)); - while(index + block_length <= end) + while (index + block_length <= end) { //----- Continue to search -----// level = min_level; fast_forward = true; - if(min_length < MipMapScaleFactor) + if (min_length < MipMapScaleFactor) { // Search individual samples up to the beginning of // the next first level mip map block const uint64_t final_index = min(end, pow2_ceil(index, MipMapScalePower)); - for(; index < final_index && + for (; index < final_index && (index & ~(~0 << MipMapScalePower)) != 0; index++) { @@ -221,7 +221,7 @@ void LogicDataSnapshot::get_subsampled_edges( (get_sample(index) & sig_mask) != 0; // If there was a change we cannot fast forward - if(sample != last_sample) { + if (sample != last_sample) { fast_forward = false; break; } @@ -235,7 +235,7 @@ void LogicDataSnapshot::get_subsampled_edges( const int min_level_scale_power = (level + 1) * MipMapScalePower; index = pow2_ceil(index, min_level_scale_power); - if(index >= end) + if (index >= end) break; // We can fast forward only if there was no change @@ -244,7 +244,7 @@ void LogicDataSnapshot::get_subsampled_edges( fast_forward = last_sample == sample; } - if(fast_forward) { + if (fast_forward) { // Fast forward: This involves zooming out to higher // levels of the mip map searching for changes, then @@ -253,7 +253,7 @@ void LogicDataSnapshot::get_subsampled_edges( // Slide right and zoom out at the beginnings of mip-map // blocks until we encounter a change - while(1) { + while (1) { const int level_scale_power = (level + 1) * MipMapScalePower; const uint64_t offset = @@ -262,16 +262,16 @@ void LogicDataSnapshot::get_subsampled_edges( // Check if we reached the last block at this // level, or if there was a change in this block - if(offset >= _mip_map[level].length || + if (offset >= _mip_map[level].length || (get_subsample(level, offset) & sig_mask)) break; - if((offset & ~(~0 << MipMapScalePower)) == 0) { + if ((offset & ~(~0 << MipMapScalePower)) == 0) { // If we are now at the beginning of a // higher level mip-map block ascend one // level - if(level + 1 >= ScaleStepCount || + if (level + 1 >= ScaleStepCount || !_mip_map[level + 1].data) break; @@ -286,7 +286,7 @@ void LogicDataSnapshot::get_subsampled_edges( // Zoom in, and slide right until we encounter a change, // and repeat until we reach min_level - while(1) { + while (1) { assert(_mip_map[level].data); const int level_scale_power = @@ -297,12 +297,12 @@ void LogicDataSnapshot::get_subsampled_edges( // Check if we reached the last block at this // level, or if there was a change in this block - if(offset >= _mip_map[level].length || + if (offset >= _mip_map[level].length || (get_subsample(level, offset) & sig_mask)) { // Zoom in unless we reached the minimum // zoom - if(level == min_level) + if (level == min_level) break; level--; @@ -317,11 +317,11 @@ void LogicDataSnapshot::get_subsampled_edges( // If individual samples within the limit of resolution, // do a linear search for the next transition within the // block - if(min_length < MipMapScaleFactor) { - for(; index < end; index++) { + if (min_length < MipMapScaleFactor) { + for (; index < end; index++) { const bool sample = (get_sample(index) & sig_mask) != 0; - if(sample != last_sample) + if (sample != last_sample) break; } } @@ -331,7 +331,7 @@ void LogicDataSnapshot::get_subsampled_edges( // Take the last sample of the quanization block const int64_t final_index = index + block_length; - if(index + block_length > end) + if (index + block_length > end) break; // Store the final state diff --git a/pv/samplingbar.cpp b/pv/samplingbar.cpp index 02e4e71d..5f9e4371 100644 --- a/pv/samplingbar.cpp +++ b/pv/samplingbar.cpp @@ -83,7 +83,7 @@ SamplingBar::SamplingBar(QWidget *parent) : struct sr_dev_inst* SamplingBar::get_selected_device() const { const int index = _device_selector.currentIndex(); - if(index < 0) + if (index < 0) return NULL; return (sr_dev_inst*)_device_selector.itemData( @@ -93,7 +93,7 @@ struct sr_dev_inst* SamplingBar::get_selected_device() const uint64_t SamplingBar::get_record_length() const { const int index = _record_length_selector.currentIndex(); - if(index < 0) + if (index < 0) return 0; return _record_length_selector.itemData(index).value(); @@ -104,12 +104,12 @@ uint64_t SamplingBar::get_sample_rate() const assert(_sample_rate_value_action); assert(_sample_rate_list_action); - if(_sample_rate_value_action->isVisible()) + if (_sample_rate_value_action->isVisible()) return (uint64_t)_sample_rate_value.value(); - else if(_sample_rate_list_action->isVisible()) + else if (_sample_rate_list_action->isVisible()) { const int index = _sample_rate_list.currentIndex(); - if(index < 0) + if (index < 0) return 0; return _sample_rate_list.itemData(index).value(); diff --git a/pv/sigsession.cpp b/pv/sigsession.cpp index e4a58a61..e19291d4 100644 --- a/pv/sigsession.cpp +++ b/pv/sigsession.cpp @@ -47,7 +47,7 @@ SigSession::~SigSession() { stop_capture(); - if(_sampling_thread.get()) + if (_sampling_thread.get()) _sampling_thread->join(); _sampling_thread.reset(); @@ -85,13 +85,13 @@ void SigSession::start_capture(struct sr_dev_inst *sdi, void SigSession::stop_capture() { - if(get_capture_state() == Stopped) + if (get_capture_state() == Stopped) return; sr_session_stop(); // Check that sampling stopped - if(_sampling_thread.get()) + if (_sampling_thread.get()) _sampling_thread->join(); _sampling_thread.reset(); } @@ -181,7 +181,7 @@ void SigSession::data_feed_in(const struct sr_dev_inst *sdi, // Create an empty LogiData for coming data snapshots _logic_data.reset(new LogicData(meta_logic)); assert(_logic_data); - if(!_logic_data) + if (!_logic_data) break; } @@ -194,7 +194,7 @@ void SigSession::data_feed_in(const struct sr_dev_inst *sdi, const sr_probe *const probe = (const sr_probe*)g_slist_nth_data( sdi->probes, i); - if(probe->enabled) + if (probe->enabled) { shared_ptr signal( new LogicSignal(probe->name, @@ -213,7 +213,7 @@ void SigSession::data_feed_in(const struct sr_dev_inst *sdi, { lock_guard lock(_data_mutex); assert(packet->payload); - if(!_cur_logic_snapshot) + if (!_cur_logic_snapshot) { // Create a new data snapshot _cur_logic_snapshot = shared_ptr( diff --git a/pv/view/header.cpp b/pv/view/header.cpp index 5f1de744..63679012 100644 --- a/pv/view/header.cpp +++ b/pv/view/header.cpp @@ -75,7 +75,7 @@ boost::shared_ptr Header::get_mouse_over_signal( 0, s->get_v_offset() - v_offset, w, View::SignalHeight); - if(s->pt_in_label_rect(signal_heading_rect, pt)) + if (s->pt_in_label_rect(signal_heading_rect, pt)) return s; } @@ -116,12 +116,12 @@ void Header::mousePressEvent(QMouseEvent *event) const vector< shared_ptr > sigs( _view.session().get_signals()); - if(event->button() & Qt::LeftButton) { + if (event->button() & Qt::LeftButton) { _mouse_down_point = event->pos(); // Save the offsets of any signals which will be dragged BOOST_FOREACH(const shared_ptr s, sigs) - if(s->selected()) + if (s->selected()) _drag_sigs.push_back( make_pair(s, s->get_v_offset())); } @@ -129,29 +129,29 @@ void Header::mousePressEvent(QMouseEvent *event) // Select the signal if it has been clicked const shared_ptr mouse_over_signal = get_mouse_over_signal(event->pos()); - if(mouse_over_signal) { - if(mouse_over_signal->selected()) + if (mouse_over_signal) { + if (mouse_over_signal->selected()) mouse_over_signal->select(false); else { mouse_over_signal->select(true); - if(~QApplication::keyboardModifiers() & + if (~QApplication::keyboardModifiers() & Qt::ControlModifier) _drag_sigs.clear(); // Add the signal to the drag list - if(event->button() & Qt::LeftButton) + if (event->button() & Qt::LeftButton) _drag_sigs.push_back( make_pair(mouse_over_signal, mouse_over_signal->get_v_offset())); } } - if(~QApplication::keyboardModifiers() & Qt::ControlModifier) { + if (~QApplication::keyboardModifiers() & Qt::ControlModifier) { // Unselect all other signals because the Ctrl is not // pressed BOOST_FOREACH(const shared_ptr s, sigs) - if(s != mouse_over_signal) + if (s != mouse_over_signal) s->select(false); } @@ -161,7 +161,7 @@ void Header::mousePressEvent(QMouseEvent *event) void Header::mouseReleaseEvent(QMouseEvent *event) { assert(event); - if(event->button() == Qt::LeftButton) { + if (event->button() == Qt::LeftButton) { _drag_sigs.clear(); _view.normalize_layout(); } @@ -173,14 +173,14 @@ void Header::mouseMoveEvent(QMouseEvent *event) _mouse_point = event->pos(); // Move the signals if we are dragging - if(!_drag_sigs.empty()) { + if (!_drag_sigs.empty()) { const int delta = event->pos().y() - _mouse_down_point.y(); - for(std::list, + for (std::list, int> >::iterator i = _drag_sigs.begin(); i != _drag_sigs.end(); i++) { const boost::shared_ptr sig((*i).first); - if(sig) { + if (sig) { const int y = (*i).second + delta; const int y_snap = ((y + View::SignalSnapGridSize / 2) / @@ -210,7 +210,7 @@ void Header::contextMenuEvent(QContextMenuEvent *event) { const shared_ptr s = get_mouse_over_signal(_mouse_point); - if(!s) + if (!s) return; QMenu menu(this); @@ -225,26 +225,26 @@ void Header::contextMenuEvent(QContextMenuEvent *event) void Header::on_action_set_name_triggered() { shared_ptr context_signal = _context_signal; - if(!context_signal) + if (!context_signal) return; const QString new_label = QInputDialog::getText(this, tr("Set Name"), tr("Name"), QLineEdit::Normal, context_signal->get_name()); - if(!new_label.isEmpty()) + if (!new_label.isEmpty()) context_signal->set_name(new_label); } void Header::on_action_set_colour_triggered() { shared_ptr context_signal = _context_signal; - if(!context_signal) + if (!context_signal) return; const QColor new_colour = QColorDialog::getColor( context_signal->get_colour(), this, tr("Set Colour")); - if(new_colour.isValid()) + if (new_colour.isValid()) context_signal->set_colour(new_colour); } diff --git a/pv/view/logicsignal.cpp b/pv/view/logicsignal.cpp index b2302e9e..03d6aa25 100644 --- a/pv/view/logicsignal.cpp +++ b/pv/view/logicsignal.cpp @@ -77,7 +77,7 @@ void LogicSignal::paint(QPainter &p, const QRect &rect, double scale, const deque< shared_ptr > &snapshots = _data->get_snapshots(); - if(snapshots.empty()) + if (snapshots.empty()) return; const shared_ptr &snapshot = @@ -102,7 +102,7 @@ void LogicSignal::paint(QPainter &p, const QRect &rect, double scale, QLineF *const edge_lines = new QLineF[edge_count]; line = edge_lines; - for(vector::const_iterator i = + for (vector::const_iterator i = edges.begin() + 1; i != edges.end() - 1; i++) { const float x = ((*i).first / samples_per_pixel - @@ -135,9 +135,9 @@ void LogicSignal::paint_caps(QPainter &p, QLineF *const lines, { QLineF *line = lines; - for(vector::const_iterator i = + for (vector::const_iterator i = edges.begin(); i != (edges.end() - 1); i++) - if((*i).second == level) { + if ((*i).second == level) { *line++ = QLineF( ((*i).first / samples_per_pixel - pixels_offset) + x_offset, y_offset, diff --git a/pv/view/ruler.cpp b/pv/view/ruler.cpp index bbafdb0f..c043aacf 100644 --- a/pv/view/ruler.cpp +++ b/pv/view/ruler.cpp @@ -76,7 +76,7 @@ void Ruler::paintEvent(QPaintEvent *event) do { tick_period = order_decimal * ScaleUnits[unit++]; - } while(tick_period < min_period && unit < countof(ScaleUnits)); + } while (tick_period < min_period && unit < countof(ScaleUnits)); const unsigned int prefix = (order - FirstSIPrefixPower) / 3; assert(prefix >= 0); @@ -99,15 +99,15 @@ void Ruler::paintEvent(QPaintEvent *event) int division = (int)round(first_minor_division - first_major_division * MinorTickSubdivision); - while(1) + while (1) { const double t = t0 + division * minor_tick_period; const double x = (t - _view.offset()) / _view.scale(); - if(x >= width()) + if (x >= width()) break; - if(division % MinorTickSubdivision == 0) + if (division % MinorTickSubdivision == 0) { // Draw a major tick QString s; @@ -139,7 +139,7 @@ void Ruler::paintEvent(QPaintEvent *event) void Ruler::mouseMoveEvent(QMouseEvent *e) { - if(!_grabbed_marker) + if (!_grabbed_marker) return; _grabbed_marker->set_time(_view.offset() + @@ -148,16 +148,16 @@ void Ruler::mouseMoveEvent(QMouseEvent *e) void Ruler::mousePressEvent(QMouseEvent *e) { - if(e->buttons() & Qt::LeftButton) { + if (e->buttons() & Qt::LeftButton) { _grabbed_marker = NULL; - if(_view.cursors_shown()) { + if (_view.cursors_shown()) { std::pair &cursors = _view.cursors(); - if(cursors.first.get_label_rect( + if (cursors.first.get_label_rect( rect()).contains(e->pos())) _grabbed_marker = &cursors.first; - else if(cursors.second.get_label_rect( + else if (cursors.second.get_label_rect( rect()).contains(e->pos())) _grabbed_marker = &cursors.second; } @@ -171,7 +171,7 @@ void Ruler::mouseReleaseEvent(QMouseEvent *) void Ruler::draw_cursors(QPainter &p) { - if(!_view.cursors_shown()) + if (!_view.cursors_shown()) return; const QRect r = rect(); @@ -183,7 +183,8 @@ void Ruler::draw_cursors(QPainter &p) void Ruler::draw_hover_mark(QPainter &p) { const int x = _view.hover_point().x(); - if(x == -1 || _grabbed_marker) + + if (x == -1 || _grabbed_marker) return; p.setPen(QPen(Qt::NoPen)); diff --git a/pv/view/signal.cpp b/pv/view/signal.cpp index 8fed4273..33cfef2d 100644 --- a/pv/view/signal.cpp +++ b/pv/view/signal.cpp @@ -105,7 +105,7 @@ void Signal::paint_label(QPainter &p, const QRect &rect, bool hover) QPointF(label_rect.left() + 1, label_rect.bottom() - 1) }; - if(_selected) { + if (_selected) { p.setPen(QPen(QApplication::palette().brush( QPalette::Highlight), LabelHighlightRadius, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); diff --git a/pv/view/view.cpp b/pv/view/view.cpp index e0fce889..8fca4be2 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -190,7 +190,7 @@ void View::normalize_layout() void View::get_scroll_layout(double &length, double &offset) const { const shared_ptr sig_data = _session.get_data(); - if(!sig_data) + if (!sig_data) return; length = _data_length / (sig_data->get_samplerate() * _scale); @@ -210,7 +210,7 @@ void View::update_scroll() horizontalScrollBar()->setPageStep(areaSize.width()); - if(length < MaxScrollValue) { + if (length < MaxScrollValue) { horizontalScrollBar()->setRange(0, length); horizontalScrollBar()->setSliderPosition(offset); } else { @@ -241,21 +241,21 @@ void View::reset_signal_layout() bool View::eventFilter(QObject *object, QEvent *event) { const QEvent::Type type = event->type(); - if(type == QEvent::MouseMove) { + if (type == QEvent::MouseMove) { const QMouseEvent *const mouse_event = (QMouseEvent*)event; - if(object == _viewport) + if (object == _viewport) _hover_point = mouse_event->pos(); - else if(object == _ruler) + else if (object == _ruler) _hover_point = QPoint(mouse_event->x(), 0); - else if(object == _header) + else if (object == _header) _hover_point = QPoint(0, mouse_event->y()); else _hover_point = QPoint(-1, -1); hover_point_changed(); - } else if(type == QEvent::Leave) { + } else if (type == QEvent::Leave) { _hover_point = QPoint(-1, -1); hover_point_changed(); } @@ -291,7 +291,7 @@ void View::resizeEvent(QResizeEvent *e) void View::h_scroll_value_changed(int value) { const int range = horizontalScrollBar()->maximum(); - if(range < MaxScrollValue) + if (range < MaxScrollValue) _offset = _scale * value; else { double length = 0, offset; @@ -320,11 +320,11 @@ void View::data_updated() // Get the new data length _data_length = 0; shared_ptr sig_data = _session.get_data(); - if(sig_data) { + if (sig_data) { deque< shared_ptr > &snapshots = sig_data->get_snapshots(); BOOST_FOREACH(shared_ptr s, snapshots) - if(s) + if (s) _data_length = max(_data_length, s->get_sample_count()); } diff --git a/pv/view/viewport.cpp b/pv/view/viewport.cpp index 03b07fdf..6ce52abc 100644 --- a/pv/view/viewport.cpp +++ b/pv/view/viewport.cpp @@ -98,7 +98,7 @@ void Viewport::mouseMoveEvent(QMouseEvent *event) { assert(event); - if(event->buttons() & Qt::LeftButton) + if (event->buttons() & Qt::LeftButton) { _view.set_scale_offset(_view.scale(), _mouse_down_offset + @@ -120,7 +120,7 @@ void Viewport::wheelEvent(QWheelEvent *event) void Viewport::draw_cursors_background(QPainter &p) { - if(!_view.cursors_shown()) + if (!_view.cursors_shown()) return; p.setPen(Qt::NoPen); @@ -137,7 +137,7 @@ void Viewport::draw_cursors_background(QPainter &p) void Viewport::draw_cursors_foreground(QPainter &p) { - if(!_view.cursors_shown()) + if (!_view.cursors_shown()) return; const QRect r = rect(); diff --git a/test/logicdatasnapshot.cpp b/test/logicdatasnapshot.cpp index 3dd72285..07d34f28 100644 --- a/test/logicdatasnapshot.cpp +++ b/test/logicdatasnapshot.cpp @@ -74,7 +74,7 @@ BOOST_AUTO_TEST_CASE(Basic) //----- Test LogicDataSnapshot::push_logic -----// BOOST_CHECK(s.get_sample_count() == 0); - for(unsigned int i = 0; i < LogicDataSnapshot::ScaleStepCount; i++) + for (unsigned int i = 0; i < LogicDataSnapshot::ScaleStepCount; i++) { const LogicDataSnapshot::MipMapLevel &m = s._mip_map[i]; BOOST_CHECK_EQUAL(m.length, 0); @@ -88,7 +88,7 @@ BOOST_AUTO_TEST_CASE(Basic) BOOST_CHECK(s.get_sample_count() == 8); // There should not be enough samples to have a single mip map sample - for(unsigned int i = 0; i < LogicDataSnapshot::ScaleStepCount; i++) + for (unsigned int i = 0; i < LogicDataSnapshot::ScaleStepCount; i++) { const LogicDataSnapshot::MipMapLevel &m = s._mip_map[i]; BOOST_CHECK_EQUAL(m.length, 0); @@ -108,7 +108,7 @@ BOOST_AUTO_TEST_CASE(Basic) BOOST_CHECK_EQUAL(((uint8_t*)m0.data)[0], 0x11); // The higher levels should still be empty - for(unsigned int i = 1; i < LogicDataSnapshot::ScaleStepCount; i++) + for (unsigned int i = 1; i < LogicDataSnapshot::ScaleStepCount; i++) { const LogicDataSnapshot::MipMapLevel &m = s._mip_map[i]; BOOST_CHECK_EQUAL(m.length, 0); @@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE(Basic) BOOST_CHECK_EQUAL(m0.data_length, LogicDataSnapshot::MipMapDataUnit); BOOST_CHECK_EQUAL(((uint8_t*)m0.data)[1], 0x11); - for(unsigned int i = 2; i < m0.length; i++) + for (unsigned int i = 2; i < m0.length; i++) BOOST_CHECK_EQUAL(((uint8_t*)m0.data)[i], 0); const LogicDataSnapshot::MipMapLevel &m1 = s._mip_map[1]; @@ -166,7 +166,7 @@ BOOST_AUTO_TEST_CASE(LargeData) logic.data = new uint8_t[Length]; uint8_t *data = (uint8_t*)logic.data; - for(unsigned int i = 0; i < Length; i++) + for (unsigned int i = 0; i < Length; i++) *data++ = (uint8_t)(i >> 8); LogicDataSnapshot s(logic); @@ -181,7 +181,7 @@ BOOST_AUTO_TEST_CASE(LargeData) BOOST_REQUIRE(s._mip_map[0].data != NULL); prev_sample = 0; - for(unsigned int i = 0; i < s._mip_map[0].length;) + for (unsigned int i = 0; i < s._mip_map[0].length;) { BOOST_TEST_MESSAGE("Testing mip_map[0].data[" << i << "]"); @@ -190,7 +190,7 @@ BOOST_AUTO_TEST_CASE(LargeData) prev_sample ^ sample); prev_sample = sample; - for(int j = 1; i < s._mip_map[0].length && j < 16; j++) + for (int j = 1; i < s._mip_map[0].length && j < 16; j++) { BOOST_TEST_MESSAGE("Testing mip_map[0].data[" << i << "]"); BOOST_CHECK_EQUAL(s.get_subsample(0, i++) & 0xFF, 0); @@ -204,7 +204,7 @@ BOOST_AUTO_TEST_CASE(LargeData) BOOST_REQUIRE(s._mip_map[1].data != NULL); prev_sample = 0; - for(unsigned int i = 0; i < s._mip_map[1].length; i++) + for (unsigned int i = 0; i < s._mip_map[1].length; i++) { BOOST_TEST_MESSAGE("Testing mip_map[1].data[" << i << "]"); @@ -222,7 +222,7 @@ BOOST_AUTO_TEST_CASE(LargeData) BOOST_REQUIRE(s._mip_map[2].data != NULL); prev_sample = 0; - for(unsigned int i = 0; i < s._mip_map[2].length; i++) + for (unsigned int i = 0; i < s._mip_map[2].length; i++) { BOOST_TEST_MESSAGE("Testing mip_map[2].data[" << i << "]"); @@ -239,12 +239,12 @@ BOOST_AUTO_TEST_CASE(LargeData) LogicDataSnapshot::MipMapDataUnit); BOOST_REQUIRE(s._mip_map[3].data != NULL); - for(unsigned int i = 0; i < s._mip_map[3].length; i++) + for (unsigned int i = 0; i < s._mip_map[3].length; i++) BOOST_CHECK_EQUAL(*((uint8_t*)s._mip_map[3].data + i), 0xFF); // Check the higher levels - for(unsigned int i = 4; i < LogicDataSnapshot::ScaleStepCount; i++) + for (unsigned int i = 4; i < LogicDataSnapshot::ScaleStepCount; i++) { const LogicDataSnapshot::MipMapLevel &m = s._mip_map[i]; BOOST_CHECK_EQUAL(m.length, 0); @@ -259,7 +259,7 @@ BOOST_AUTO_TEST_CASE(LargeData) BOOST_CHECK_EQUAL(edges.size(), 32); - for(unsigned int i = 0; i < edges.size() - 1; i++) + for (unsigned int i = 0; i < edges.size() - 1; i++) { BOOST_CHECK_EQUAL(edges[i].first, i * 32768); BOOST_CHECK_EQUAL(edges[i].second, i & 1); @@ -289,9 +289,9 @@ BOOST_AUTO_TEST_CASE(Pulses) logic.data = (uint64_t*)new uint8_t[Length]; uint8_t *p = (uint8_t*)logic.data; - for(int i = 0; i < Cycles; i++) { + for (int i = 0; i < Cycles; i++) { *p++ = 0xFF; - for(int j = 1; j < Period; j++) + for (int j = 1; j < Period; j++) *p++ = 0x00; } @@ -305,11 +305,11 @@ BOOST_AUTO_TEST_CASE(Pulses) LogicDataSnapshot::MipMapDataUnit); BOOST_REQUIRE(s._mip_map[0].data != NULL); - for(unsigned int i = 0; i < s._mip_map[0].length;) { + for (unsigned int i = 0; i < s._mip_map[0].length;) { BOOST_TEST_MESSAGE("Testing mip_map[0].data[" << i << "]"); BOOST_CHECK_EQUAL(s.get_subsample(0, i++) & 0xFF, 0xFF); - for(int j = 1; + for (int j = 1; i < s._mip_map[0].length && j < Period/LogicDataSnapshot::MipMapScaleFactor; j++) { BOOST_TEST_MESSAGE( @@ -319,7 +319,7 @@ BOOST_AUTO_TEST_CASE(Pulses) } // Check the higher levels are all inactive - for(unsigned int i = 1; i < LogicDataSnapshot::ScaleStepCount; i++) { + for (unsigned int i = 1; i < LogicDataSnapshot::ScaleStepCount; i++) { const LogicDataSnapshot::MipMapLevel &m = s._mip_map[i]; BOOST_CHECK_EQUAL(m.length, 0); BOOST_CHECK_EQUAL(m.data_length, 0); @@ -331,7 +331,7 @@ BOOST_AUTO_TEST_CASE(Pulses) BOOST_REQUIRE_EQUAL(edges.size(), Cycles + 2); BOOST_CHECK_EQUAL(0, false); - for(unsigned int i = 1; i < edges.size(); i++) + for (unsigned int i = 1; i < edges.size(); i++) BOOST_CHECK_EQUAL(edges[i].second, false); } @@ -352,10 +352,10 @@ BOOST_AUTO_TEST_CASE(LongPulses) logic.data = (uint64_t*)new uint64_t[Length]; uint64_t *p = (uint64_t*)logic.data; - for(int i = 0; i < Cycles; i++) { - for(j = 0; j < PulseWidth; j++) + for (int i = 0; i < Cycles; i++) { + for (j = 0; j < PulseWidth; j++) *p++ = ~0; - for(; j < Period; j++) + for (; j < Period; j++) *p++ = 0; } @@ -369,14 +369,14 @@ BOOST_AUTO_TEST_CASE(LongPulses) LogicDataSnapshot::MipMapDataUnit); BOOST_REQUIRE(s._mip_map[0].data != NULL); - for(unsigned int i = 0; i < s._mip_map[0].length;) { - for(j = 0; i < s._mip_map[0].length && j < 2; j++) { + for (unsigned int i = 0; i < s._mip_map[0].length;) { + for (j = 0; i < s._mip_map[0].length && j < 2; j++) { BOOST_TEST_MESSAGE( "Testing mip_map[0].data[" << i << "]"); BOOST_CHECK_EQUAL(s.get_subsample(0, i++), ~0); } - for(; i < s._mip_map[0].length && + for (; i < s._mip_map[0].length && j < Period/LogicDataSnapshot::MipMapScaleFactor; j++) { BOOST_TEST_MESSAGE( "Testing mip_map[0].data[" << i << "]"); @@ -385,7 +385,7 @@ BOOST_AUTO_TEST_CASE(LongPulses) } // Check the higher levels are all inactive - for(unsigned int i = 1; i < LogicDataSnapshot::ScaleStepCount; i++) { + for (unsigned int i = 1; i < LogicDataSnapshot::ScaleStepCount; i++) { const LogicDataSnapshot::MipMapLevel &m = s._mip_map[i]; BOOST_CHECK_EQUAL(m.length, 0); BOOST_CHECK_EQUAL(m.data_length, 0); @@ -396,7 +396,7 @@ BOOST_AUTO_TEST_CASE(LongPulses) s.get_subsampled_edges(edges, 0, Length-1, 16.0f, 2); BOOST_REQUIRE_EQUAL(edges.size(), Cycles * 2 + 1); - for(int i = 0; i < Cycles; i++) { + for (int i = 0; i < Cycles; i++) { BOOST_CHECK_EQUAL(edges[i*2].first, i * Period); BOOST_CHECK_EQUAL(edges[i*2].second, true); BOOST_CHECK_EQUAL(edges[i*2+1].first, i * Period + PulseWidth); @@ -415,7 +415,7 @@ BOOST_AUTO_TEST_CASE(LongPulses) BOOST_CHECK_EQUAL(edges[1].first, 16); BOOST_CHECK_EQUAL(edges[1].second, false); - for(int i = 1; i < Cycles; i++) { + for (int i = 1; i < Cycles; i++) { BOOST_CHECK_EQUAL(edges[i+1].first, i * Period); BOOST_CHECK_EQUAL(edges[i+1].second, false); } @@ -447,7 +447,7 @@ BOOST_AUTO_TEST_CASE(LisaMUsbHid) logic.data = new uint8_t[Length]; uint8_t *data = (uint8_t*)logic.data; - for(unsigned int i = 0; i < countof(Edges); i++) { + for (unsigned int i = 0; i < countof(Edges); i++) { const int edgePos = Edges[i]; memset(&data[lastEdgePos], state ? 0x02 : 0, edgePos - lastEdgePos - 1);