2
0
forked from Ivasoft/DSView

Disable many warning messages

This commit is contained in:
dreamsourcelabTAI
2023-06-29 14:49:45 +08:00
parent 6093633b77
commit a503e6404e
59 changed files with 358 additions and 382 deletions

View File

@@ -215,6 +215,12 @@ bool bHighScale = true;
QDateTime dateTime = QDateTime::currentDateTime();
std::string strTime = dateTime .toString("yyyy-MM-dd hh:mm:ss").toStdString();
dsv_info("%s", strTime.c_str());
int bit_width = sizeof(long);
if (bit_width != 8){
dsv_err("Can only run on 64 bit systems");
return 0;
}
//init core
if (!control->Init()){

View File

@@ -48,7 +48,7 @@ AppControl::AppControl(AppControl &o)
AppControl::~AppControl()
{
DESTROY_OBJECT(_session);
// DESTROY_OBJECT(_session);
}
AppControl* AppControl::Instance()

View File

@@ -253,6 +253,7 @@ static void _saveHistory(UserHistory &o, QSettings &st)
st.endGroup();
}
/*
//------font
static void _loadFont(FontOptions &o, QSettings &st)
{
@@ -291,6 +292,7 @@ static void _saveFont(FontOptions &o, QSettings &st)
st.endGroup();
}
*/
//------------AppConfig

View File

@@ -109,14 +109,9 @@ Annotation::Annotation()
_end_sample = 0;
_resIndex = -1;
}
Annotation::Annotation(Annotation &o)
{
}
Annotation::~Annotation()
{
{
}
const std::vector<QString>& Annotation::annotations() const

View File

@@ -45,10 +45,6 @@ public:
Annotation();
~Annotation();
private:
/* disable copy construct */
Annotation(Annotation &o);
public:
inline uint64_t start_sample() const{
return _start_sample;

View File

@@ -285,7 +285,7 @@ const char* AnnotationResTable::format_numberic(const char *hex_str, int fmt)
if (sub_wr != sub_buf){
*sub_wr = 0;
const char *sub_str = format_to_string(sub_buf, fmt);
int sublen = strlen(sub_str);
unsigned int sublen = (unsigned int)strlen(sub_str);
if ((all_wr - all_buf) + sublen > CONVERT_STR_MAX_LEN){
printf("convert error,write buffer is full!\n");
@@ -312,12 +312,12 @@ const char* AnnotationResTable::format_numberic(const char *hex_str, int fmt)
{
*sub_wr = 0;
const char *sub_str = format_to_string(sub_buf, fmt);
int sublen = strlen(sub_str);
unsigned int sublen = (unsigned int)strlen(sub_str);
if ((all_wr - all_buf) + sublen > CONVERT_STR_MAX_LEN)
{
printf("convert error,write buffer is full!\n");
return hex_str;
printf("convert error,write buffer is full!\n");
return hex_str;
}
strncpy(all_wr, sub_str, sublen);

View File

@@ -49,6 +49,13 @@ Row::Row(const Row &o)
_order = o._order;
}
bool Row::operator=(const Row &o)
{
_decoder = o._decoder;
_row = o._row;
_order = o._order;
}
QString Row::title() const
{
if (_decoder && _decoder->name && _row && _row->desc)

View File

@@ -45,6 +45,8 @@ public:
Row(const Row &o);
bool operator=(const Row &o);
public:
inline const srd_decoder* decoder() const{

View File

@@ -200,10 +200,9 @@ void DecoderStack::build_row()
}
// Map out all the classes
for (const GSList *ll = ann_row->ann_classes;
ll; ll = ll->next)
_class_rows[make_pair(decc,
GPOINTER_TO_INT(ll->data))] = row;
for (const GSList *ll = ann_row->ann_classes; ll; ll = ll->next){
_class_rows[make_pair(decc, GPOINTER_TO_INT(ll->data))] = Row(row);
}
order++;
}
@@ -552,7 +551,7 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod
if (end_index >= align_sample_count){
end_index = align_sample_count - 1;
dsv_info("Reset the decode end sample, new:%llu, old:%llu", end_index, decode_end);
dsv_info("Reset the decode end sample, new:%lu, old:%lu", end_index, decode_end);
}
}
}
@@ -661,7 +660,7 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod
}
}
dsv_info("%s%llu", "send to decoder times: ", entry_cnt);
dsv_info("%s%lu", "send to decoder times: ", entry_cnt);
if (error != NULL)
g_free(error);
@@ -717,7 +716,7 @@ void DecoderStack::execute_decode_stack()
decode_end = max(dec->decode_end(), decode_end);
}
dsv_info("decoder start sample:%llu, end sample:%llu, count:%llu", decode_start, decode_end, decode_end - decode_start + 1);
dsv_info("decoder start sample:%lu, end sample:%lu, count:%lu", decode_start, decode_end, decode_end - decode_start + 1);
// Start the session
srd_session_metadata_set(session, SRD_CONF_SAMPLERATE,

View File

@@ -215,8 +215,6 @@ void DsoSnapshot::append_payload(const sr_datafeed_dso &dso)
{
std::lock_guard<std::mutex> lock(_mutex);
//dsv_info("write sample_count:%llu", dso.num_samples);
if (_channel_num > 0 && dso.num_samples > 0) {
append_data(dso.data, dso.num_samples, _instant);
@@ -241,7 +239,7 @@ void DsoSnapshot::append_data(void *data, uint64_t samples, bool instant)
assert(_sample_count <= _total_sample_count);
for (int ch = 0; ch < _channel_num; ch++)
for (unsigned int ch = 0; ch < _channel_num; ch++)
{
uint8_t *src = (uint8_t*)data + ch;
uint8_t *dest = _ch_data[ch];
@@ -250,7 +248,7 @@ void DsoSnapshot::append_data(void *data, uint64_t samples, bool instant)
dest += old_sample_count;
}
for (int i = 0; i < samples; i++)
for (uint64_t i = 0; i < samples; i++)
{
*dest++ = *src;
src += _channel_num;
@@ -511,7 +509,7 @@ bool DsoSnapshot::get_max_min_value(uint8_t &maxv, uint8_t &minv, int chan_index
return false;
}
if (chan_index < 0 || chan_index >= _ch_data.size()){
if (chan_index < 0 || chan_index >= (int)_ch_data.size()){
assert(false);
}

View File

@@ -454,7 +454,7 @@ void LogicSnapshot::capture_ended()
if (offset > 0)
{
for (int chan=0; chan<_channel_num; chan++)
for (unsigned int chan=0; chan<_channel_num; chan++)
{
if (_ch_data[chan][index0].lbp[index1] == NULL){
dsv_err("ERROR:LogicSnapshot::capture_ended(),buffer is null.");
@@ -763,7 +763,7 @@ bool LogicSnapshot::get_nxt_edge_self(uint64_t &index, bool last_sample, uint64_
bool edge_hit = false;
// linear search for the next transition on the root level
for (int64_t i = root_index; !edge_hit && (index <= end) && i < (int64_t)_ch_data[order].size(); i++)
for (uint64_t i = root_index; !edge_hit && (index <= end) && i < (uint64_t)_ch_data[order].size(); i++)
{
uint64_t cur_mask = (~0ULL << root_pos);
@@ -1423,7 +1423,7 @@ void LogicSnapshot::move_first_node_to_last()
struct RootNode rn = _ch_data[i][0];
_ch_data[i].erase(_ch_data[i].begin());
for (int x=0; x<Scale; x++)
for (int x=0; x<(int)Scale; x++)
{
if (rn.lbp[x] != NULL){
free(rn.lbp[x]);
@@ -1467,7 +1467,7 @@ void LogicSnapshot::free_decode_lpb(void *lbp)
void LogicSnapshot::free_head_blocks(int count)
{
assert(count < Scale);
assert(count < (int)Scale);
assert(count > 0);
for (int i = 0; i < (int)_channel_num; i++)

View File

@@ -110,8 +110,7 @@ bool ApplicationParamDlg::ShowDlg(QWidget *parent)
lay->setSpacing(8);
//show config
AppConfig &app = AppConfig::Instance();
int mode = AppControl::Instance()->GetSession()->get_device()->get_work_mode();
AppConfig &app = AppConfig::Instance();
QCheckBox *ck_quickScroll = new QCheckBox();
ck_quickScroll->setChecked(app.appOptions.quickScroll);

View File

@@ -477,10 +477,11 @@ void DecoderOptionsDlg::create_decoder_form(
decoder_form,
parent, font);
if (group->_content_width > _content_width)
if (group->_content_width > _content_width){
_content_width = group->_content_width;
}
form->addRow(group);
form->addRow(group);
}
void DecoderOptionsDlg::commit_probes()

View File

@@ -176,8 +176,10 @@ DeviceOptions::~DeviceOptions()
void DeviceOptions::ChannelChecked(int index, QObject *object)
{
QCheckBox* sc = dynamic_cast<QCheckBox*>(object);
channel_checkbox_clicked(sc);
(void)index;
QCheckBox* sc = dynamic_cast<QCheckBox*>(object);
channel_checkbox_clicked(sc);
}
void DeviceOptions::accept()
@@ -607,7 +609,6 @@ void DeviceOptions::channel_checkbox_clicked(QCheckBox *sc)
if (sc != NULL) {
QGridLayout *const layout = (QGridLayout *)sc->property("Layout").value<void *>();
int i = layout->count();
bool bMap = false;
int ck_index = -1;
int i_dex = 0;
@@ -633,7 +634,7 @@ void DeviceOptions::channel_checkbox_clicked(QCheckBox *sc)
if (w->objectName() == "map-enable"){
QCheckBox *map_ckbox = dynamic_cast<QCheckBox*>(w);
bMap = map_ckbox->isChecked();
map_ckbox->isChecked();
}
if (w->property("Enable").isNull()) {

View File

@@ -221,8 +221,8 @@ void ProtocolExp::save_proc()
if ((*i).second)
{
if (index == row_index)
{
row = (*i).first;
{
row = Row((*i).first);
break;
}
row_index++;

View File

@@ -212,11 +212,7 @@ void DsoTriggerDock::reStyle()
void DsoTriggerDock::paintEvent(QPaintEvent *e)
{
(void*)e;
// QStyleOption opt;
// opt.init(this);
// QPainter p(this);
// style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
(void)e;
}
void DsoTriggerDock::auto_trig(int index)

View File

@@ -586,7 +586,7 @@ void MeasureDock::update_dist()
for (auto &inf : _dist_row_list)
{
if (inf.cursor1 != -1) {
if (inf.cursor1 > cursor_list.size()) {
if (inf.cursor1 > (int)cursor_list.size()) {
inf.start_bt->setText("");
set_cursor_btn_color(inf.start_bt);
inf.cursor1 = -1;
@@ -594,7 +594,7 @@ void MeasureDock::update_dist()
}
if (inf.cursor2 != -1) {
if (inf.cursor2 > cursor_list.size()) {
if (inf.cursor2 > (int)cursor_list.size()) {
inf.end_bt->setText("");
set_cursor_btn_color(inf.end_bt);
inf.cursor2 = -1;
@@ -623,14 +623,14 @@ void MeasureDock::update_edge()
for (auto &inf : _edge_row_list)
{
if (inf.cursor1 != -1) {
if (inf.cursor1 > cursor_list.size()) {
if (inf.cursor1 > (int)cursor_list.size()) {
inf.start_bt->setText("");
set_cursor_btn_color(inf.start_bt);
inf.cursor1 = -1;
}
}
if (inf.cursor2 != -1) {
if (inf.cursor2 > cursor_list.size()) {
if (inf.cursor2 > (int)cursor_list.size()) {
inf.end_bt->setText("");
set_cursor_btn_color(inf.end_bt);
inf.cursor2 = -1;
@@ -642,8 +642,6 @@ void MeasureDock::update_edge()
uint64_t rising_edges;
uint64_t falling_edges;
const auto &sigs = _session->get_signals();
for(auto s : _session->get_signals()) {
if (s->signal_type() == SR_CHANNEL_LOGIC
&& s->enabled()

View File

@@ -454,7 +454,7 @@ void ProtocolDock::del_all_protocol()
void ProtocolDock::decoded_progress(int progress)
{
const auto &decode_sigs = _session->get_decode_signals();
int index = 0;
unsigned int index = 0;
for(auto d : decode_sigs) {
int pg = d->get_progress();
@@ -933,7 +933,7 @@ bool ProtocolDock::protocol_sort_callback(const DecoderInfoItem *o1, const Decod
strncpy(buf, id, sizeof(buf)-1);
char *rd = buf;
char *start = NULL;
int len = 0;
unsigned int len = 0;
while (*rd && len - 1 < sizeof(buf))
{
@@ -1004,6 +1004,8 @@ bool ProtocolDock::protocol_sort_callback(const DecoderInfoItem *o1, const Decod
void ProtocolDock::OnItemClick(void *sender, void *data_handle)
{
(void)sender;
if (data_handle != NULL){
DecoderInfoItem *info = (DecoderInfoItem*)data_handle;
srd_decoder *dec = (srd_decoder *)(info->_data_handle);

View File

@@ -40,6 +40,8 @@ ComboButtonItem::ComboButtonItem(QWidget *parent, ISearchItemClick *click, void
void ComboButtonItem::mousePressEvent(QMouseEvent *e)
{
(void)e;
if (_click != NULL){
_click->OnItemClick(this, _data_handle);
}
@@ -165,6 +167,8 @@ void SearchComboBox::AddDataItem(QString id, QString name, void *data_handle)
void SearchComboBox::OnItemClick(void *sender, void *data_handle)
{
(void)sender;
if (data_handle != NULL && _item_click){
SearchDataItem *item = (SearchDataItem*)data_handle;
this->close();

View File

@@ -1031,7 +1031,7 @@ void TriggerDock::on_serial_value_changed(const QString &v)
}
char tmp[10];
sprintf(tmp, "%02X", val);
sprintf(tmp, "%02lX", val);
_serial_hex_lineEdit->setText(QString(tmp));
}
}

View File

@@ -374,7 +374,6 @@ namespace pv
QString title;
QString details;
QString ch_status = "";
uint64_t error_pattern;
switch (_session->get_error())
{
@@ -533,6 +532,11 @@ namespace pv
int w = parentWidget()->frameGeometry().width();
int h = parentWidget()->frameGeometry().height();
(void)h;
(void)w;
(void)x;
(void)y;
QDesktopWidget *desktop = QApplication::desktop();
int curMonitor = desktop->screenNumber(this);

View File

@@ -71,7 +71,7 @@ DeviceOptions::DeviceOptions()
gvar_list = _device_agent->get_config_list(NULL, key);
const QString name(info->name);
char *label_char = info->name;
const char *label_char = info->name;
QString label(label_char);
switch(key)
@@ -306,8 +306,9 @@ QString DeviceOptions::print_vdiv(GVariant *const gvar)
void DeviceOptions::bind_bandwidths(const QString &name, const QString label, int key,
GVariant *const gvar_list, boost::function<QString (GVariant*)> printer)
{
bool bw_limit;
GVariant *gvar_tmp;
(void)printer;
bool bw_limit = false;
GVariant *gvar;
std::vector< pair<GVariant*, QString> > values;
struct sr_list_item *plist;
@@ -316,11 +317,11 @@ void DeviceOptions::bind_bandwidths(const QString &name, const QString label, in
plist = (struct sr_list_item*)g_variant_get_uint64(gvar_list);
assert(plist);
bw_limit = false;
_device_agent->get_config_bool(SR_CONF_BANDWIDTH, bw_limit);
if (!bw_limit)
if (bw_limit == false){
return;
}
while (plist && plist->id >= 0)
{

View File

@@ -1027,7 +1027,7 @@ namespace pv
make_channels_view_index(start_view_dex);
if (_device_agent.get_work_mode() == LOGIC){
for (int i=0; i<view_indexs.size() && i<_signals.size(); i++){
for (unsigned int i=0; i<view_indexs.size() && i<_signals.size(); i++){
_signals[i]->set_view_index(view_indexs[i]);
}
}

View File

@@ -181,7 +181,7 @@ public:
inline bool re_start(){
if (_is_working)
stop_capture();
start_capture(_is_instant);
return start_capture(_is_instant);
}
inline QDateTime get_session_time(){

View File

@@ -226,15 +226,6 @@ void StoreSession::save_logic(pv::data::LogicSnapshot *logic_snapshot)
_unit_count = logic_snapshot->get_ring_sample_count() / 8 * to_save_probes;
num = logic_snapshot->get_block_num();
/*
dsv_info("total-bytes:%llu, total-sample:%llu, loop-offset:%llu, blocks:%d",
_unit_count,
logic_snapshot->get_ring_sample_count(),
logic_snapshot->get_loop_offset(),
num
);
*/
for(auto s : _session->get_signals())
{
int ch_type = s->get_type();
@@ -275,8 +266,6 @@ void StoreSession::save_logic(pv::data::LogicSnapshot *logic_snapshot)
}
_units_stored += size;
//dsv_info("read-bytes:%llu, block-size:%llu, block-index:%d-%d", _units_stored, size, ch_index, i);
if (_units_stored > _unit_count){
dsv_err("Read block data error!");
assert(false);
@@ -308,7 +297,7 @@ void StoreSession::save_logic(pv::data::LogicSnapshot *logic_snapshot)
void StoreSession::save_analog(pv::data::AnalogSnapshot *analog_snapshot)
{
char chunk_name[20] = {0};
int num;
int num = 0;
int ret = SR_ERR;
int ch_type = -1;
@@ -476,7 +465,6 @@ bool StoreSession::meta_gen(data::Snapshot *snapshot, std::string &str)
int probecnt;
char *s;
struct sr_status status;
const sr_dev_inst *sdi = NULL;
char meta[300] = {0};
sprintf(meta, "%s", "[version]\n"); str += meta;

View File

@@ -632,7 +632,6 @@ namespace pv
if (_updating_sample_count)
return;
GVariant *gvar;
double duration;
uint64_t v;
@@ -730,7 +729,6 @@ namespace pv
.value<double>();
const uint64_t sample_limit = _device_agent->get_sample_limit();
GVariant *gvar;
uint64_t max_sample_rate;
if (_device_agent->get_config_uint64(SR_CONF_MAX_DSO_SAMPLERATE, max_sample_rate) == false)

View File

@@ -141,15 +141,11 @@ namespace pv
private:
SigSession *_session;
DsComboBox _device_selector;
DsComboBox _sample_count;
DsComboBox _sample_rate;
bool _updating_sample_rate;
bool _updating_sample_count;
bool _updating_device_list;
QToolButton _device_type;
QToolButton _configure_button;
DsComboBox _device_selector;
QToolButton _configure_button;
DsComboBox _sample_count;
DsComboBox _sample_rate;
QToolButton _run_stop_button;
QToolButton _instant_button;
QToolButton _mode_button;
@@ -169,6 +165,10 @@ namespace pv
int _last_device_index;
bool _is_run_as_instant;
view::View *_view;
bool _updating_sample_rate;
bool _updating_sample_count;
bool _updating_device_list;
};
} // namespace toolbars

View File

@@ -651,6 +651,8 @@ void* DecodeTrace::get_key_handel()
//to show decoder's property setting dialog
bool DecodeTrace::create_popup(bool isnew)
{
(void)isnew;
int ret = false; //setting have changed flag
while (true)

View File

@@ -126,11 +126,7 @@ void DevMode::set_device()
_close_button->setIcon(QIcon());
_close_button->setDisabled(true);
AppConfig &app = AppConfig::Instance();
int lan = app.frameOptions.language;
QString iconPath = GetIconPath() + "/";
auto dev_mode_list = _device_agent->get_device_mode_list();
for (const GSList *l = dev_mode_list; l; l = l->next)
@@ -204,8 +200,6 @@ void DevMode::on_mode_change()
}
QString iconPath = GetIconPath();
AppConfig &app = AppConfig::Instance();
int lan = app.frameOptions.language;
for(auto i = _mode_list.begin();i != _mode_list.end(); i++)
{

View File

@@ -88,9 +88,6 @@ void dslDial::paint(QPainter &p, QRectF dialRect, QColor dialColor, const QPoint
}
//tr
pText = QString::number(displayValue) + _unit[displayIndex] + "/div";
// QFontMetrics fm(p.font());
// const QRectF valueRect = QRectF(dialRect.left(), dialRect.top()-fm.height()-10, dialRect.width(), fm.height());
// p.drawText(valueRect, Qt::AlignCenter, pText);
// draw +/-
if (dialRect.contains(pt) && pt.x() > dialRect.center().x()) {
@@ -109,8 +106,6 @@ void dslDial::paint(QPainter &p, QRectF dialRect, QColor dialColor, const QPoint
inc ? 10 : -10, hoverRect.width()/2 + 4);
p.restore();
}
(void*)0;
}
void dslDial::set_sel(uint64_t sel)
@@ -158,9 +153,9 @@ uint64_t dslDial::get_max()
uint64_t dslDial::get_value()
{
this->_div = this->_div;
this->_div = this->_div;
if (_sel < 0 || _sel >= _value.count()){
if (_sel >= (uint64_t)_value.count()){
assert(false);
}

View File

@@ -110,16 +110,6 @@ DsoSignal::DsoSignal(data::DsoSnapshot *data,
load_settings();
}
DsoSignal::DsoSignal(const DsoSignal &o)
:Signal(NULL)
{
}
DsoSignal::DsoSignal(DsoSignal &o)
:Signal(NULL)
{
}
DsoSignal::~DsoSignal()
{
DESTROY_OBJECT(_vDial);
@@ -971,6 +961,8 @@ void DsoSignal::paint_trace(QPainter &p,
int zeroY, int left, const int64_t start, const int64_t end, int hw_offset,
const double pixels_offset, const double samples_per_pixel, uint64_t num_channels)
{
(void)num_channels;
const int64_t sample_count = end - start + 1;
if (sample_count > 0) {

View File

@@ -81,9 +81,6 @@ private:
static const uint16_t MS_RectMargin = 10;
static const uint16_t MS_RectHeight = 25;
DsoSignal(const DsoSignal &o);
DsoSignal(DsoSignal &o);
public:
DsoSignal(pv::data::DsoSnapshot *data,
sr_channel *probe);

View File

@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
#include "../dsvdef.h"
#include "groupsignal.h"
#include "view.h"
@@ -95,3 +96,5 @@ QRectF GroupSignal::get_rect(GroupSetRegions type, int y, int right)
} // namespace view
} // namespace pv
*/

View File

@@ -23,6 +23,7 @@
#ifndef DSVIEW_SV_GROUPSIGNAL_H
#define DSVIEW_SV_GROUPSIGNAL_H
/*
#include "signal.h"
#include <list>
@@ -50,21 +51,12 @@ public:
virtual ~GroupSignal();
/**
* Returns true if the trace is visible and enabled.
*/
bool enabled();
pv::data::SignalData* data();
void set_scale(float scale);
/**
* Paints the signal with a QPainter
* @param p the QPainter to paint into.
* @param left the x-coordinate of the left edge of the signal.
* @param right the x-coordinate of the right edge of the signal.
**/
void paint_mid(QPainter &p, int left, int right, QColor fore, QColor back);
QRectF get_rect(GroupSetRegions type, int y, int right);
@@ -88,4 +80,6 @@ private:
} // namespace view
} // namespace pv
*/
#endif // DSVIEW_PV_GROUPSIGNAL_H

View File

@@ -485,8 +485,6 @@ void Viewport::paintProgress(QPainter &p, QColor fore, QColor back)
using pv::view::Signal;
const uint64_t sample_limits = _view.session().cur_samplelimits();
double progress = 0;
int progress100 = 0;
int captured_progress = 0;

View File

@@ -63,7 +63,6 @@ DecoderGroupBox::DecoderGroupBox(data::DecoderStack *decoder_stack,
const srd_decoder *const d = _dec->decoder();
assert(d);
const bool have_probes = (d->channels || d->opt_channels) != 0;
_index = 0;
for(auto dec : _decoder_stack->stack()) {
@@ -120,8 +119,9 @@ DecoderGroupBox::~DecoderGroupBox()
}
bool DecoderGroupBox::eventFilter(QObject *o, QEvent *e)
{
{
(void)e;
(void)o;
return false;
}