Commit 3a71ddd7 authored by DreamSourceLab's avatar DreamSourceLab
Browse files

Warnings fix

parent f87f5a23
......@@ -627,8 +627,9 @@ void DecoderStack::decode_proc()
_error_message = QString::fromLocal8Bit(error);
// Destroy the session
if (error)
if (error) {
g_free(error);
}
srd_session_destroy(session);
_decode_state = Stopped;
......@@ -657,8 +658,9 @@ void DecoderStack::annotation_callback(srd_proto_data *pdata, void *decoder)
//lock_guard<mutex> lock(d->_output_mutex);
if (d->_no_memory)
if (d->_no_memory) {
return;
}
const Annotation a(pdata);
......
......@@ -578,7 +578,7 @@ bool LogicSnapshot::get_nxt_edge(
return false;
//const unsigned int min_level = max((int)floorf(logf(min_length) / logf(Scale)) - 1, 0);
const unsigned int min_level = max((int)(log2f(min_length) - 1) / ScalePower, 0);
const unsigned int min_level = max((int)(log2f(min_length) - 1) / (int)ScalePower, 0);
uint64_t root_index = index >> (LeafBlockPower + RootScalePower);
uint8_t root_pos = (index & RootMask) >> LeafBlockPower;
bool edge_hit = false;
......@@ -623,7 +623,7 @@ bool LogicSnapshot::get_pre_edge(uint64_t &index, bool last_sample,
return false;
//const unsigned int min_level = max((int)floorf(logf(min_length) / logf(Scale)) - 1, 1);
const unsigned int min_level = max((int)(log2f(min_length) - 1) / ScalePower, 0);
const unsigned int min_level = max((int)(log2f(min_length) - 1) / (int)ScalePower, 0);
int root_index = index >> (LeafBlockPower + RootScalePower);
uint8_t root_pos = (index & RootMask) >> LeafBlockPower;
bool edge_hit = false;
......
......@@ -45,11 +45,11 @@ namespace data {
class LogicSnapshot : public Snapshot
{
private:
static const int ScaleLevel = 4;
static const int ScalePower = 6;
static const uint64_t ScaleLevel = 4;
static const uint64_t ScalePower = 6;
static const uint64_t Scale = 1 << ScalePower;
static const int ScaleSize = Scale / 8;
static const int RootScalePower = ScalePower;
static const uint64_t ScaleSize = Scale / 8;
static const uint64_t RootScalePower = ScalePower;
static const uint64_t RootScale = 1 << RootScalePower;
static const uint64_t LeafBlockSpace = (Scale + Scale*Scale +
Scale*Scale*Scale + Scale*Scale*Scale*Scale) / 8;
......
......@@ -57,9 +57,10 @@ QWidget* Bool::get_widget(QWidget *parent, bool auto_commit)
g_variant_unref(value);
}
if (auto_commit)
if (auto_commit) {
connect(_check_box, SIGNAL(stateChanged(int)),
this, SLOT(on_state_changed(int)));
}
return _check_box;
}
......
......@@ -72,9 +72,10 @@ QWidget* Double::get_widget(QWidget *parent, bool auto_commit)
g_variant_unref(value);
}
if (auto_commit)
if (auto_commit) {
connect(_spin_box, SIGNAL(valueChanged(double)),
this, SLOT(on_value_changed(double)));
}
return _spin_box;
}
......
......@@ -57,8 +57,9 @@ QWidget* Enum::get_widget(QWidget *parent, bool auto_commit)
return _selector;
GVariant *const value = _getter ? _getter() : NULL;
if (!value)
if (!value) {
return NULL;
}
_selector = new QComboBox(parent);
_selector->setSizeAdjustPolicy(QComboBox::AdjustToContents);
......@@ -72,9 +73,10 @@ QWidget* Enum::get_widget(QWidget *parent, bool auto_commit)
g_variant_unref(value);
if (auto_commit)
if (auto_commit) {
connect(_selector, SIGNAL(currentIndexChanged(int)),
this, SLOT(on_current_item_changed(int)));
}
return _selector;
}
......
......@@ -512,8 +512,9 @@ void SamplingBar::commit_sample_rate()
sample_rate = _sample_rate.itemData(
index).value<uint64_t>();
if (sample_rate == 0)
if (sample_rate == 0) {
return;
}
get_selected_device()->set_config(NULL, NULL,
SR_CONF_SAMPLERATE,
......
......@@ -163,8 +163,9 @@ void Header::mousePressEvent(QMouseEvent *event)
_view.get_traces(ALL_VIEW));
int action;
const bool instant = _view.session().get_instant();
if (instant && _view.session().get_capture_state() == SigSession::Running)
if (instant && _view.session().get_capture_state() == SigSession::Running) {
return;
}
if (event->button() & Qt::LeftButton) {
_mouse_down_point = event->pos();
......
......@@ -194,8 +194,9 @@ void Ruler::paintEvent(QPaintEvent*)
draw_hover_mark(p);
// Draw cursor selection
if (_cursor_sel_visible || _cursor_go_visible)
if (_cursor_sel_visible || _cursor_go_visible) {
draw_cursor_sel(p);
}
p.end();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment