fix compile warning

This commit is contained in:
DreamSourceLab 2015-07-17 16:23:42 +08:00
parent aec079cbd3
commit 91938e444f
22 changed files with 51 additions and 53 deletions

View File

@ -3,4 +3,6 @@ rm ./cmake_install.cmake
rm -r ./CMakeFiles rm -r ./CMakeFiles
rm ./Makefile rm ./Makefile
rm ./CMakeCache.txt rm ./CMakeCache.txt
find . -name 'moc_*.cpp*' | xargs rm -rf
find . -name 'qrc_*.cpp' | xargs rm -rf
echo "rm cmake cache end..." echo "rm cmake cache end..."

View File

@ -173,7 +173,7 @@ private:
QString _error_message; QString _error_message;
std::auto_ptr<boost::thread> _decode_thread; std::unique_ptr<boost::thread> _decode_thread;
decode_state _decode_state; decode_state _decode_state;
bool _options_changed; bool _options_changed;

View File

@ -192,9 +192,7 @@ void LogicSnapshot::get_subsampled_edges(
float min_length, int sig_index) float min_length, int sig_index)
{ {
uint64_t index = start; uint64_t index = start;
unsigned int level;
bool last_sample; bool last_sample;
bool fast_forward;
assert(end <= get_sample_count()); assert(end <= get_sample_count());
assert(start <= end); assert(start <= end);
@ -447,9 +445,9 @@ bool LogicSnapshot::get_pre_edge(
// If resolution is less than a mip map block, // If resolution is less than a mip map block,
// round up to the beginning of the mip-map block // round up to the beginning of the mip-map block
// for this level of detail // for this level of detail
const int min_level_scale_power = const unsigned int min_level_scale_power =
(level + 1) * MipMapScalePower; (level + 1) * MipMapScalePower;
if (index < (1 << min_level_scale_power)) if (index < (uint64_t)(1 << min_level_scale_power))
index = 0; index = 0;
else else
index = pow2_ceil(index, min_level_scale_power) - (1 << min_level_scale_power) - 1; index = pow2_ceil(index, min_level_scale_power) - (1 << min_level_scale_power) - 1;
@ -539,16 +537,13 @@ bool LogicSnapshot::get_pre_edge(
// do a linear search for the next transition within the // do a linear search for the next transition within the
// block // block
if (min_length < MipMapScaleFactor) { if (min_length < MipMapScaleFactor) {
for (; index >= 0; index--) { for (; index > 0; index--) {
const bool sample = (get_sample(index) & const bool sample = (get_sample(index) &
sig_mask) != 0; sig_mask) != 0;
if (sample != last_sample) { if (sample != last_sample) {
index++; index++;
return true; return true;
} }
if (index == 0)
return false;
} }
} }
} }

View File

@ -632,7 +632,6 @@ bool MainWindow::load_session(QString name)
bool isEnabled = false; bool isEnabled = false;
foreach (const QJsonValue &value, sessionObj["channel"].toArray()) { foreach (const QJsonValue &value, sessionObj["channel"].toArray()) {
QJsonObject obj = value.toObject(); QJsonObject obj = value.toObject();
qDebug("obj.index = %d", obj["index"].toDouble());
if ((probe->index == obj["index"].toDouble()) && if ((probe->index == obj["index"].toDouble()) &&
(probe->type == obj["type"].toDouble())) { (probe->type == obj["type"].toDouble())) {
isEnabled = true; isEnabled = true;

View File

@ -32,20 +32,20 @@
using boost::optional; using boost::optional;
using namespace std; using namespace std;
#define INT8_MIN (-0x7f - 1) //#define INT8_MIN (-0x7f - 1)
#define INT16_MIN (-0x7fff - 1) //#define INT16_MIN (-0x7fff - 1)
#define INT32_MIN (-0x7fffffff - 1) //#define INT32_MIN (-0x7fffffff - 1)
#define INT64_MIN (-0x7fffffffffffffff - 1) //#define INT64_MIN (-0x7fffffffffffffff - 1)
//
#define INT8_MAX 0x7f //#define INT8_MAX 0x7f
#define INT16_MAX 0x7fff //#define INT16_MAX 0x7fff
#define INT32_MAX 0x7fffffff //#define INT32_MAX 0x7fffffff
#define INT64_MAX 0x7fffffffffffffff //#define INT64_MAX 0x7fffffffffffffff
//
#define UINT8_MAX 0xff //#define UINT8_MAX 0xff
#define UINT16_MAX 0xffff //#define UINT16_MAX 0xffff
#define UINT32_MAX 0xffffffff //#define UINT32_MAX 0xffffffff
#define UINT64_MAX 0xffffffffffffffff //#define UINT64_MAX 0xffffffffffffffff
namespace pv { namespace pv {
namespace prop { namespace prop {

View File

@ -205,7 +205,7 @@ QList<QString> SigSession::getSuportedExportFormats(){
format.append((*supportedModules)->id); format.append((*supportedModules)->id);
format.append(")"); format.append(")");
list.append(format); list.append(format);
*supportedModules++; supportedModules++;
} }
return list; return list;
} }
@ -245,7 +245,7 @@ void SigSession::export_file(const QString name, QWidget* parent, const QString
outModule = *supportedModules; outModule = *supportedModules;
break; break;
} }
*supportedModules++; supportedModules++;
} }
if(outModule == NULL) if(outModule == NULL)
return; return;
@ -283,8 +283,8 @@ void SigSession::export_file(const QString name, QWidget* parent, const QString
unsigned char* datat = (unsigned char*)snapshot->get_data(); unsigned char* datat = (unsigned char*)snapshot->get_data();
unsigned int numsamples = snapshot->get_sample_count()*snapshot->unit_size(); unsigned int numsamples = snapshot->get_sample_count()*snapshot->unit_size();
GString *data_out; GString *data_out;
int usize = 8192; unsigned int usize = 8192;
int size = usize; unsigned int size = usize;
struct sr_datafeed_logic lp; struct sr_datafeed_logic lp;
struct sr_datafeed_packet p; struct sr_datafeed_packet p;
for(uint64_t i = 0; i < numsamples; i+=usize){ for(uint64_t i = 0; i < numsamples; i+=usize){
@ -311,8 +311,8 @@ void SigSession::export_file(const QString name, QWidget* parent, const QString
unsigned char* datat = (unsigned char*)snapshot->get_data(); unsigned char* datat = (unsigned char*)snapshot->get_data();
unsigned int numsamples = snapshot->get_sample_count(); unsigned int numsamples = snapshot->get_sample_count();
GString *data_out; GString *data_out;
int usize = 8192; unsigned int usize = 8192;
int size = usize; unsigned int size = usize;
struct sr_datafeed_dso dp; struct sr_datafeed_dso dp;
struct sr_datafeed_packet p; struct sr_datafeed_packet p;
for(uint64_t i = 0; i < numsamples; i+=usize){ for(uint64_t i = 0; i < numsamples; i+=usize){

View File

@ -251,10 +251,10 @@ private:
boost::shared_ptr<data::GroupSnapshot> _cur_group_snapshot; boost::shared_ptr<data::GroupSnapshot> _cur_group_snapshot;
int _group_cnt; int _group_cnt;
std::auto_ptr<boost::thread> _sampling_thread; std::unique_ptr<boost::thread> _sampling_thread;
libusb_hotplug_callback_handle _hotplug_handle; libusb_hotplug_callback_handle _hotplug_handle;
std::auto_ptr<boost::thread> _hotplug; std::unique_ptr<boost::thread> _hotplug;
bool _hot_attach; bool _hot_attach;
bool _hot_detach; bool _hot_detach;

View File

@ -151,7 +151,8 @@ void Cursor::paint_fix_label(QPainter &p, const QRect &rect,
void Cursor::compute_text_size(QPainter &p, unsigned int prefix) void Cursor::compute_text_size(QPainter &p, unsigned int prefix)
{ {
_text_size = p.boundingRect(QRectF(), 0, (void)prefix;
_text_size = p.boundingRect(QRectF(), 0,
Ruler::format_real_time(_index, _view.session().get_device()->get_sample_rate())).size(); Ruler::format_real_time(_index, _view.session().get_device()->get_sample_rate())).size();
} }

View File

@ -72,7 +72,6 @@ LogicSignal::LogicSignal(boost::shared_ptr<pv::device::DevInst> dev_inst,
Signal(dev_inst, probe, SR_CHANNEL_LOGIC), Signal(dev_inst, probe, SR_CHANNEL_LOGIC),
_data(data) _data(data)
{ {
assert(probe->index >= 0);
_colour = SignalColours[probe->index % countof(SignalColours)]; _colour = SignalColours[probe->index % countof(SignalColours)];
} }
@ -82,7 +81,6 @@ LogicSignal::LogicSignal(const Signal &s,
Signal(s, probe), Signal(s, probe),
_data(data) _data(data)
{ {
assert(probe->index >= 0);
} }
LogicSignal::~LogicSignal() LogicSignal::~LogicSignal()

View File

@ -53,7 +53,7 @@ const QPen Trace::SignalAxisPen = QColor(128, 128, 128, 64);
const QPen Trace::AxisPen(QColor(128, 128, 128, 64)); const QPen Trace::AxisPen(QColor(128, 128, 128, 64));
const int Trace::LabelHitPadding = 2; const int Trace::LabelHitPadding = 2;
Trace::Trace(QString name, int index, int type) : Trace::Trace(QString name, uint16_t index, int type) :
_view(NULL), _view(NULL),
_name(name), _name(name),
_v_offset(INT_MAX), _v_offset(INT_MAX),

View File

@ -84,7 +84,7 @@ public:
static const QPen SignalAxisPen; static const QPen SignalAxisPen;
protected: protected:
Trace(QString name, int index, int type); Trace(QString name, uint16_t index, int type);
Trace(QString name, std::list<int> index_list, int type, int sec_index); Trace(QString name, std::list<int> index_list, int type, int sec_index);
/** /**

View File

@ -444,7 +444,7 @@ void Viewport::mousePressEvent(QMouseEvent *event)
_dso_xm_index[i-1] = min(_dso_xm_index[i-1], _dso_xm_index[i]); _dso_xm_index[i-1] = min(_dso_xm_index[i-1], _dso_xm_index[i]);
_dso_xm_index[i] = max_index; _dso_xm_index[i] = max_index;
} }
_dso_xm_stage = (++_dso_xm_stage) % (DsoMeasureStages + 1); _dso_xm_stage = (_dso_xm_stage + 1) % (DsoMeasureStages + 1);
} }
} }
} }

View File

@ -47,7 +47,7 @@
*/ */
/** @private */ /** @private */
SR_PRIV struct sr_channel *sr_channel_new(int index, int type, SR_PRIV struct sr_channel *sr_channel_new(uint16_t index, int type,
gboolean enabled, const char *name) gboolean enabled, const char *name)
{ {
struct sr_channel *probe; struct sr_channel *probe;
@ -156,7 +156,7 @@ SR_API int sr_dev_probe_enable(const struct sr_dev_inst *sdi, int probenum,
* *
* @since 0.1.0 (but the API changed in 0.2.0) * @since 0.1.0 (but the API changed in 0.2.0)
*/ */
SR_API int sr_dev_trigger_set(const struct sr_dev_inst *sdi, int probenum, SR_API int sr_dev_trigger_set(const struct sr_dev_inst *sdi, uint16_t probenum,
const char *trigger) const char *trigger)
{ {
GSList *l; GSList *l;

View File

@ -606,7 +606,7 @@ static int init(struct sr_context *sr_ctx)
static int set_probes(struct sr_dev_inst *sdi, int num_probes) static int set_probes(struct sr_dev_inst *sdi, int num_probes)
{ {
int j; uint16_t j;
struct sr_channel *probe; struct sr_channel *probe;
for (j = 0; j < num_probes; j++) { for (j = 0; j < num_probes; j++) {
@ -627,7 +627,7 @@ static int set_probes(struct sr_dev_inst *sdi, int num_probes)
static int adjust_probes(struct sr_dev_inst *sdi, int num_probes) static int adjust_probes(struct sr_dev_inst *sdi, int num_probes)
{ {
int j; uint16_t j;
GSList *l; GSList *l;
struct sr_channel *probe; struct sr_channel *probe;
GSList *p; GSList *p;

View File

@ -676,7 +676,7 @@ static int init(struct sr_context *sr_ctx)
static int set_probes(struct sr_dev_inst *sdi, int num_probes) static int set_probes(struct sr_dev_inst *sdi, int num_probes)
{ {
int j; uint16_t j;
struct sr_channel *probe; struct sr_channel *probe;
for (j = 0; j < num_probes; j++) { for (j = 0; j < num_probes; j++) {
@ -696,7 +696,7 @@ static int set_probes(struct sr_dev_inst *sdi, int num_probes)
static int adjust_probes(struct sr_dev_inst *sdi, int num_probes) static int adjust_probes(struct sr_dev_inst *sdi, int num_probes)
{ {
int j; uint16_t j;
GSList *l; GSList *l;
struct sr_channel *probe; struct sr_channel *probe;
GSList *p; GSList *p;

View File

@ -204,7 +204,7 @@ static GSList *hw_scan(GSList *options)
struct drv_context *drvc; struct drv_context *drvc;
struct dev_context *devc; struct dev_context *devc;
GSList *devices; GSList *devices;
int i; uint16_t i;
(void)options; (void)options;
@ -396,7 +396,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
struct sr_channel *ch, struct sr_channel *ch,
const struct sr_channel_group *cg) const struct sr_channel_group *cg)
{ {
int i, ret; uint16_t i;
int ret;
const char *stropt; const char *stropt;
struct sr_channel *probe; struct sr_channel *probe;

View File

@ -53,7 +53,7 @@ static int format_match(const char *filename)
static int init(struct sr_input *in, const char *filename) static int init(struct sr_input *in, const char *filename)
{ {
struct sr_channel *probe; struct sr_channel *probe;
int num_probes, i; uint16_t num_probes, i;
char name[SR_MAX_PROBENAME_LEN + 1]; char name[SR_MAX_PROBENAME_LEN + 1];
char *param; char *param;
struct context *ctx; struct context *ctx;

View File

@ -319,7 +319,7 @@ static int format_match(const char *filename)
static int init(struct sr_input *in, const char *filename) static int init(struct sr_input *in, const char *filename)
{ {
struct sr_channel *probe; struct sr_channel *probe;
int num_probes, i; uint16_t num_probes, i;
char name[SR_MAX_PROBENAME_LEN + 1]; char name[SR_MAX_PROBENAME_LEN + 1];
char *param; char *param;
struct context *ctx; struct context *ctx;

View File

@ -83,7 +83,7 @@ SR_PRIV int sr_err(const char *format, ...);
/*--- device.c --------------------------------------------------------------*/ /*--- device.c --------------------------------------------------------------*/
SR_PRIV struct sr_channel *sr_channel_new(int index, int type, SR_PRIV struct sr_channel *sr_channel_new(uint16_t index, int type,
gboolean enabled, const char *name); gboolean enabled, const char *name);
SR_PRIV void sr_dev_probes_free(struct sr_dev_inst *sdi); SR_PRIV void sr_dev_probes_free(struct sr_dev_inst *sdi);

View File

@ -556,7 +556,7 @@ enum {
struct sr_channel { struct sr_channel {
/* The index field will go: use g_slist_length(sdi->channels) instead. */ /* The index field will go: use g_slist_length(sdi->channels) instead. */
int index; uint16_t index;
int type; int type;
gboolean enabled; gboolean enabled;
char *name; char *name;

View File

@ -49,7 +49,7 @@ SR_API int sr_dev_probe_name_set(const struct sr_dev_inst *sdi,
int probenum, const char *name); int probenum, const char *name);
SR_API int sr_dev_probe_enable(const struct sr_dev_inst *sdi, int probenum, SR_API int sr_dev_probe_enable(const struct sr_dev_inst *sdi, int probenum,
gboolean state); gboolean state);
SR_API int sr_dev_trigger_set(const struct sr_dev_inst *sdi, int probenum, SR_API int sr_dev_trigger_set(const struct sr_dev_inst *sdi, uint16_t probenum,
const char *trigger); const char *trigger);
SR_API gboolean sr_dev_has_option(const struct sr_dev_inst *sdi, int key); SR_API gboolean sr_dev_has_option(const struct sr_dev_inst *sdi, int key);
SR_API GSList *sr_dev_list(const struct sr_dev_driver *driver); SR_API GSList *sr_dev_list(const struct sr_dev_driver *driver);

View File

@ -121,8 +121,10 @@ SR_API int sr_session_load(const char *filename)
struct zip_stat zs; struct zip_stat zs;
struct sr_dev_inst *sdi; struct sr_dev_inst *sdi;
struct sr_channel *probe; struct sr_channel *probe;
int ret, probenum, devcnt, version, i, j; int ret, devcnt, i, j;
uint64_t tmp_u64, total_probes, enabled_probes, p; uint16_t probenum;
uint64_t tmp_u64, total_probes, enabled_probes;
uint16_t p;
char **sections, **keys, *metafile, *val, s[11]; char **sections, **keys, *metafile, *val, s[11];
char probename[SR_MAX_PROBENAME_LEN + 1]; char probename[SR_MAX_PROBENAME_LEN + 1];