From: Uwe Hermann Date: Sat, 25 Jul 2015 16:05:11 +0000 (+0200) Subject: Minor whitespace fixes. X-Git-Tag: pulseview-0.3.0~165 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f32905530347e1020d5ce7959123cf797c9a4829;p=pulseview.git Minor whitespace fixes. --- diff --git a/main.cpp b/main.cpp index 61ec03a8..62397239 100644 --- a/main.cpp +++ b/main.cpp @@ -159,7 +159,7 @@ int main(int argc, char *argv[]) w.show(); #ifdef ENABLE_SIGNALS - if(SignalHandler::prepare_signals()) { + if (SignalHandler::prepare_signals()) { SignalHandler *const handler = new SignalHandler(&w); QObject::connect(handler, diff --git a/pv/data/decode/annotation.cpp b/pv/data/decode/annotation.cpp index 6287edce..9a165803 100644 --- a/pv/data/decode/annotation.cpp +++ b/pv/data/decode/annotation.cpp @@ -43,7 +43,7 @@ Annotation::Annotation(const srd_proto_data *const pdata) : format_ = pda->ann_class; const char *const *annotations = (char**)pda->ann_text; - while(*annotations) { + while (*annotations) { annotations_.push_back(QString::fromUtf8(*annotations)); annotations++; } diff --git a/pv/data/decode/decoder.cpp b/pv/data/decode/decoder.cpp index 018051df..f5fdd0c9 100644 --- a/pv/data/decode/decoder.cpp +++ b/pv/data/decode/decoder.cpp @@ -102,7 +102,7 @@ bool Decoder::have_required_channels() const set< shared_ptr > Decoder::get_data() { set< shared_ptr > data; - for(auto i = channels_.cbegin(); i != channels_.cend(); i++) { + for (auto i = channels_.cbegin(); i != channels_.cend(); i++) { shared_ptr signal((*i).second); assert(signal); data.insert(signal->logic_data()); @@ -128,14 +128,14 @@ srd_decoder_inst* Decoder::create_decoder_inst(srd_session *session, int unit_si session, decoder_->id, opt_hash); g_hash_table_destroy(opt_hash); - if(!decoder_inst) + if (!decoder_inst) return nullptr; // Setup the channels GHashTable *const channels = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify)g_variant_unref); - for(auto i = channels_.cbegin(); i != channels_.cend(); i++) + for (auto i = channels_.cbegin(); i != channels_.cend(); i++) { shared_ptr signal((*i).second); GVariant *const gvar = g_variant_new_int32( diff --git a/pv/data/decoderstack.cpp b/pv/data/decoderstack.cpp index 201c87f7..35480240 100644 --- a/pv/data/decoderstack.cpp +++ b/pv/data/decoderstack.cpp @@ -107,7 +107,7 @@ void DecoderStack::remove(int index) // Find the decoder in the stack auto iter = stack_.begin(); - for(int i = 0; i < index; i++, iter++) + for (int i = 0; i < index; i++, iter++) assert(iter != stack_.end()); // Delete the element @@ -286,7 +286,7 @@ uint64_t DecoderStack::max_sample_count() const optional DecoderStack::wait_for_data() const { unique_lock input_lock(input_mutex_); - while(!interrupt_ && !frame_complete_ && + while (!interrupt_ && !frame_complete_ && samples_decoded_ >= sample_count_) input_cond_.wait(input_lock); return boost::make_optional(!interrupt_ && @@ -379,7 +379,7 @@ void DecoderStack::decode_proc() do { decode_data(*sample_count, unit_size, session); - } while(error_message_.isEmpty() && (sample_count = wait_for_data())); + } while (error_message_.isEmpty() && (sample_count = wait_for_data())); // Destroy the session srd_session_destroy(session); diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 6b7fe4f5..e6f1a5e1 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -750,7 +750,7 @@ void MainWindow::on_actionViewShowCursors_triggered() assert(view_); const bool show = !view_->cursors_shown(); - if(show) + if (show) view_->centre_cursors(); view_->show_cursors(show); diff --git a/pv/popups/channels.cpp b/pv/popups/channels.cpp index d4ff6c97..6c122b1c 100644 --- a/pv/popups/channels.cpp +++ b/pv/popups/channels.cpp @@ -200,7 +200,7 @@ QGridLayout* Channels::create_channel_group_grid( check_box_signal_map_[checkbox] = sig; - if(++col >= 8) + if (++col >= 8) col = 0, row++; } diff --git a/pv/session.cpp b/pv/session.cpp index b90c0301..bbfb7d24 100644 --- a/pv/session.cpp +++ b/pv/session.cpp @@ -238,9 +238,9 @@ bool Session::add_decoder(srd_decoder *const dec) // Make a list of all the channels std::vector all_channels; - for(const GSList *i = dec->channels; i; i = i->next) + for (const GSList *i = dec->channels; i; i = i->next) all_channels.push_back((const srd_channel*)i->data); - for(const GSList *i = dec->opt_channels; i; i = i->next) + for (const GSList *i = dec->opt_channels; i; i = i->next) all_channels.push_back((const srd_channel*)i->data); // Auto select the initial channels @@ -302,7 +302,7 @@ void Session::set_capture_state(capture_state state) lock_guard lock(sampling_mutex_); const bool changed = capture_state_ != state; capture_state_ = state; - if(changed) + if (changed) capture_state_changed(state); } diff --git a/pv/view/analogsignal.cpp b/pv/view/analogsignal.cpp index fe2979b0..0ac63111 100644 --- a/pv/view/analogsignal.cpp +++ b/pv/view/analogsignal.cpp @@ -181,7 +181,7 @@ void AnalogSignal::paint_envelope(QPainter &p, QRectF *const rects = new QRectF[e.length]; QRectF *rect = rects; - for(uint64_t sample = 0; sample < e.length-1; sample++) { + for (uint64_t sample = 0; sample < e.length-1; sample++) { const float x = ((e.scale * sample + e.start) / samples_per_pixel - pixels_offset) + left; const AnalogSegment::EnvelopeSample *const s = @@ -193,9 +193,9 @@ void AnalogSignal::paint_envelope(QPainter &p, const float t = y - min(s->min, (s+1)->max) * scale_; float h = b - t; - if(h >= 0.0f && h <= 1.0f) + if (h >= 0.0f && h <= 1.0f) h = 1.0f; - if(h <= 0.0f && h >= -1.0f) + if (h <= 0.0f && h >= -1.0f) h = -1.0f; *rect++ = QRectF(x, t, 1.0f, h); diff --git a/pv/view/cursorpair.cpp b/pv/view/cursorpair.cpp index 4f4d3975..46f24556 100644 --- a/pv/view/cursorpair.cpp +++ b/pv/view/cursorpair.cpp @@ -118,7 +118,7 @@ void CursorPair::paint_label(QPainter &p, const QRect &rect, bool hover) const int radius = delta_rect.height() / 2; const QRectF text_rect(delta_rect.intersected( rect).adjusted(radius, 0, -radius, 0)); - if(text_rect.width() >= text_size_.width()) + if (text_rect.width() >= text_size_.width()) { const int highlight_radius = delta_rect.height() / 2 - 2; diff --git a/pv/view/decodetrace.cpp b/pv/view/decodetrace.cpp index 8674f40c..36e7a104 100644 --- a/pv/view/decodetrace.cpp +++ b/pv/view/decodetrace.cpp @@ -658,7 +658,7 @@ void DecodeTrace::create_decoder_form(int index, group->add_layout(decoder_form); // Add the mandatory channels - for(l = decoder->channels; l; l = l->next) { + for (l = decoder->channels; l; l = l->next) { const struct srd_channel *const pdch = (struct srd_channel *)l->data; QComboBox *const combo = create_channel_selector(parent, dec, pdch); @@ -673,7 +673,7 @@ void DecodeTrace::create_decoder_form(int index, } // Add the optional channels - for(l = decoder->opt_channels; l; l = l->next) { + for (l = decoder->opt_channels; l; l = l->next) { const struct srd_channel *const pdch = (struct srd_channel *)l->data; QComboBox *const combo = create_channel_selector(parent, dec, pdch); @@ -748,7 +748,7 @@ void DecodeTrace::commit_decoder_channels(shared_ptr &dec for (const ChannelSelector &s : channel_selectors_) { - if(s.decoder_ != dec) + if (s.decoder_ != dec) break; const LogicSignal *const selection = @@ -756,7 +756,7 @@ void DecodeTrace::commit_decoder_channels(shared_ptr &dec s.combo_->currentIndex()).value(); for (shared_ptr sig : sigs) - if(sig.get() == selection) { + if (sig.get() == selection) { channel_map[s.pdch_] = dynamic_pointer_cast(sig); break; @@ -825,7 +825,7 @@ void DecodeTrace::on_show_hide_decoder(int index) // Find the decoder in the stack auto iter = stack.cbegin(); - for(int i = 0; i < index; i++, iter++) + for (int i = 0; i < index; i++, iter++) assert(iter != stack.end()); shared_ptr dec = *iter; diff --git a/pv/view/header.cpp b/pv/view/header.cpp index 26aae49f..f31a91cc 100644 --- a/pv/view/header.cpp +++ b/pv/view/header.cpp @@ -207,7 +207,7 @@ void Header::on_ungroup() break; } } - } while(restart); + } while (restart); } } // namespace view diff --git a/pv/view/signal.cpp b/pv/view/signal.cpp index 9f97d5bc..08fa54ee 100644 --- a/pv/view/signal.cpp +++ b/pv/view/signal.cpp @@ -105,7 +105,7 @@ void Signal::populate_popup_form(QWidget *parent, QFormLayout *form) name_widget_->setEditable(true); name_widget_->setCompleter(0); - for(unsigned int i = 0; i < countof(ChannelNames); i++) + for (unsigned int i = 0; i < countof(ChannelNames); i++) name_widget_->insertItem(i, ChannelNames[i]); const int index = name_widget_->findText(name_, Qt::MatchExactly); diff --git a/pv/view/view.cpp b/pv/view/view.cpp index d4aa1619..1aa7b729 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -509,7 +509,7 @@ void View::calculate_tick_spacing() min_width += SpacingIncrement; - } while(typical_width > tick_period_ / scale_); + } while (typical_width > tick_period_ / scale_); } void View::update_scroll() diff --git a/pv/view/viewwidget.cpp b/pv/view/viewwidget.cpp index e364d638..600dd621 100644 --- a/pv/view/viewwidget.cpp +++ b/pv/view/viewwidget.cpp @@ -79,7 +79,7 @@ bool ViewWidget::accept_drag() const if (r->dragging()) { if (!item_owner) item_owner = r->owner(); - else if(item_owner != r->owner()) + else if (item_owner != r->owner()) return false; } diff --git a/pv/widgets/decodermenu.cpp b/pv/widgets/decodermenu.cpp index f3c4e06a..3ea1c841 100644 --- a/pv/widgets/decodermenu.cpp +++ b/pv/widgets/decodermenu.cpp @@ -33,7 +33,7 @@ DecoderMenu::DecoderMenu(QWidget *parent, bool first_level_decoder) : { GSList *l = g_slist_sort(g_slist_copy( (GSList*)srd_decoder_list()), decoder_name_cmp); - for(; l; l = l->next) + for (; l; l = l->next) { const srd_decoder *const d = (srd_decoder*)l->data; assert(d); diff --git a/pv/widgets/popup.cpp b/pv/widgets/popup.cpp index 68f79f0f..de2d1b57 100644 --- a/pv/widgets/popup.cpp +++ b/pv/widgets/popup.cpp @@ -238,7 +238,7 @@ void Popup::reposition_widget() if (pos_ == Left) o.rx() = -width(); - else if(pos_ == Top) + else if (pos_ == Top) o.ry() = -height(); o += point_; @@ -300,7 +300,7 @@ void Popup::mouseReleaseEvent(QMouseEvent *e) // We need our own out-of-bounds click handler because QWidget counts // the drop-shadow region as inside the widget - if(!bubble_rect().contains(e->pos())) + if (!bubble_rect().contains(e->pos())) close(); } diff --git a/pv/widgets/popuptoolbutton.cpp b/pv/widgets/popuptoolbutton.cpp index 5153eee5..ff335a90 100644 --- a/pv/widgets/popuptoolbutton.cpp +++ b/pv/widgets/popuptoolbutton.cpp @@ -45,7 +45,7 @@ void PopupToolButton::set_popup(Popup *popup) void PopupToolButton::on_clicked(bool) { - if(!popup_) + if (!popup_) return; const QRect r = rect(); diff --git a/pv/widgets/wellarray.cpp b/pv/widgets/wellarray.cpp index a9418317..1f3bf698 100644 --- a/pv/widgets/wellarray.cpp +++ b/pv/widgets/wellarray.cpp @@ -267,19 +267,19 @@ void WellArray::keyPressEvent(QKeyEvent* e) { switch(e->key()) { // Look at the key code case Qt::Key_Left: // If 'left arrow'-key, - if(curCol > 0) // and cr't not in leftmost col + if (curCol > 0) // and cr't not in leftmost col setCurrent(curRow, curCol - 1); // set cr't to next left column break; case Qt::Key_Right: // Correspondingly... - if(curCol < numCols()-1) + if (curCol < numCols()-1) setCurrent(curRow, curCol + 1); break; case Qt::Key_Up: - if(curRow > 0) + if (curRow > 0) setCurrent(curRow - 1, curCol); break; case Qt::Key_Down: - if(curRow < numRows()-1) + if (curRow < numRows()-1) setCurrent(curRow + 1, curCol); break; case Qt::Key_Space: diff --git a/signalhandler.cpp b/signalhandler.cpp index 71f66f55..fbbcf225 100644 --- a/signalhandler.cpp +++ b/signalhandler.cpp @@ -33,7 +33,7 @@ int SignalHandler::sockets_[2]; bool SignalHandler::prepare_signals() { - if(socketpair(AF_UNIX, SOCK_STREAM, 0, sockets_) != 0) + if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockets_) != 0) return false; struct sigaction sig_action; @@ -42,7 +42,7 @@ bool SignalHandler::prepare_signals() sigemptyset(&sig_action.sa_mask); sig_action.sa_flags = SA_RESTART; - if(sigaction(SIGINT, &sig_action, 0) != 0 || + if (sigaction(SIGINT, &sig_action, 0) != 0 || sigaction(SIGTERM, &sig_action, 0) != 0) { close(sockets_[0]); close(sockets_[1]); @@ -66,7 +66,7 @@ void SignalHandler::on_socket_notifier_activated() socket_notifier_->setEnabled(false); int sig_number; - if(read(sockets_[1], &sig_number, sizeof(int)) != sizeof(int)) { + if (read(sockets_[1], &sig_number, sizeof(int)) != sizeof(int)) { qDebug() << "Failed to catch signal"; abort(); } @@ -86,7 +86,7 @@ void SignalHandler::on_socket_notifier_activated() void SignalHandler::handle_signals(int sig_number) { - if(write(sockets_[0], &sig_number, sizeof(int)) != sizeof(int)) { + if (write(sockets_[0], &sig_number, sizeof(int)) != sizeof(int)) { // Failed to handle signal abort(); }