From 4327797e347c57946abd19449cb3436f3f2afcfb Mon Sep 17 00:00:00 2001 From: DreamSourceLab Date: Fri, 2 Jun 2017 14:01:49 +0800 Subject: [PATCH] Warnings fix --- DSView/main.cpp | 6 ++-- DSView/pv/data/analog.cpp | 1 - DSView/pv/data/analogsnapshot.cpp | 1 - DSView/pv/data/analogsnapshot.h | 2 ++ DSView/pv/data/decode/decoder.cpp | 1 - DSView/pv/data/decoderstack.cpp | 1 + DSView/pv/data/dso.cpp | 1 - DSView/pv/data/dsosnapshot.cpp | 1 - DSView/pv/data/dsosnapshot.h | 5 +-- DSView/pv/data/group.cpp | 1 - DSView/pv/data/groupsnapshot.cpp | 1 - DSView/pv/data/logic.cpp | 1 - DSView/pv/data/logicsnapshot.cpp | 15 ++++---- DSView/pv/data/logicsnapshot.h | 2 ++ DSView/pv/data/mathstack.cpp | 1 + DSView/pv/data/snapshot.h | 3 -- DSView/pv/device/device.cpp | 2 -- DSView/pv/device/devinst.cpp | 4 +-- DSView/pv/device/devinst.h | 6 ++-- DSView/pv/device/file.cpp | 2 -- DSView/pv/device/inputfile.cpp | 3 -- DSView/pv/device/sessionfile.cpp | 2 -- DSView/pv/devicemanager.cpp | 3 -- DSView/pv/dialogs/calibration.cpp | 2 -- DSView/pv/dialogs/deviceoptions.cpp | 1 - DSView/pv/dialogs/deviceoptions.h | 5 +-- DSView/pv/dialogs/dsomeasure.cpp | 1 - DSView/pv/dialogs/fftoptions.cpp | 1 - DSView/pv/dialogs/protocolexp.cpp | 1 - DSView/pv/dialogs/protocollist.cpp | 1 - DSView/pv/dialogs/search.cpp | 1 - DSView/pv/dialogs/search.h | 2 +- DSView/pv/dialogs/waitingdialog.cpp | 2 -- DSView/pv/dock/dsotriggerdock.cpp | 3 -- DSView/pv/dock/dsotriggerdock.h | 3 -- DSView/pv/dock/measuredock.cpp | 2 -- DSView/pv/dock/measuredock.h | 3 -- DSView/pv/dock/protocoldock.cpp | 1 - DSView/pv/dock/protocoldock.h | 2 -- DSView/pv/dock/searchdock.cpp | 1 - DSView/pv/dock/searchdock.h | 2 -- DSView/pv/dock/triggerdock.cpp | 1 - DSView/pv/dock/triggerdock.h | 2 -- DSView/pv/mainframe.cpp | 1 - DSView/pv/mainwindow.cpp | 1 - DSView/pv/prop/binding/deviceoptions.h | 1 - DSView/pv/sigsession.cpp | 1 - DSView/pv/sigsession.h | 1 - DSView/pv/storesession.cpp | 3 ++ DSView/pv/toolbars/filebar.cpp | 1 - DSView/pv/toolbars/logobar.cpp | 1 - DSView/pv/toolbars/samplingbar.cpp | 5 --- DSView/pv/toolbars/samplingbar.h | 3 -- DSView/pv/toolbars/titlebar.cpp | 5 --- DSView/pv/toolbars/trigbar.cpp | 1 - DSView/pv/view/analogsignal.cpp | 1 - DSView/pv/view/cursor.cpp | 1 - DSView/pv/view/decodetrace.cpp | 1 + DSView/pv/view/devmode.cpp | 1 - DSView/pv/view/dsosignal.cpp | 2 -- DSView/pv/view/groupsignal.cpp | 2 -- DSView/pv/view/header.cpp | 22 +++++++----- DSView/pv/view/mathtrace.cpp | 5 ++- DSView/pv/view/ruler.cpp | 1 - DSView/pv/view/signal.cpp | 1 - DSView/pv/view/signal.h | 2 +- DSView/pv/view/timemarker.cpp | 1 - DSView/pv/view/timemarker.h | 1 - DSView/pv/view/trace.cpp | 1 - DSView/pv/view/trace.h | 2 -- DSView/pv/view/view.cpp | 1 - DSView/pv/view/view.h | 1 - DSView/pv/view/viewport.cpp | 1 - DSView/pv/view/viewport.h | 6 ++-- libsigrok4DSL/backend.c | 4 +-- libsigrok4DSL/dsdevice.c | 4 +-- libsigrok4DSL/hardware/DSL/command.c | 2 ++ libsigrok4DSL/hardware/DSL/dscope.c | 13 +++---- libsigrok4DSL/hardware/DSL/dslogic.c | 6 ++-- libsigrok4DSL/hardware/common/ezusb.c | 5 ++- libsigrok4DSL/hardware/common/usb.c | 4 +-- libsigrok4DSL/hardware/demo/demo.c | 4 +-- libsigrok4DSL/hwdriver.c | 4 +-- libsigrok4DSL/input/in_binary.c | 4 +-- libsigrok4DSL/input/in_vcd.c | 4 +-- libsigrok4DSL/input/in_wav.c | 4 +-- libsigrok4DSL/libsigrok.h | 11 ++---- libsigrok4DSL/log.c | 4 +-- libsigrok4DSL/output/csv.c | 4 +-- libsigrok4DSL/output/gnuplot.c | 12 ++++--- libsigrok4DSL/output/output.c | 2 +- libsigrok4DSL/output/srzip.c | 4 +-- libsigrok4DSL/output/vcd.c | 4 +-- libsigrok4DSL/session.c | 4 +-- libsigrok4DSL/session_driver.c | 4 +-- libsigrok4DSL/session_file.c | 4 +-- libsigrok4DSL/std.c | 2 +- libsigrok4DSL/strutil.c | 49 +++++++++++++------------- libsigrok4DSL/trigger.c | 6 ++-- libsigrokdecode4DSL/srd.c | 7 ++-- 100 files changed, 135 insertions(+), 219 deletions(-) diff --git a/DSView/main.cpp b/DSView/main.cpp index e1bd1593..2d2a0002 100644 --- a/DSView/main.cpp +++ b/DSView/main.cpp @@ -20,14 +20,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - +#include #ifdef ENABLE_DECODE -#include /* First, so we avoid a _POSIX_C_SOURCE warning. */ +#include #endif #include -#include - #include #include diff --git a/DSView/pv/data/analog.cpp b/DSView/pv/data/analog.cpp index 4d3c5ca5..6685e453 100644 --- a/DSView/pv/data/analog.cpp +++ b/DSView/pv/data/analog.cpp @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "analog.h" #include "analogsnapshot.h" diff --git a/DSView/pv/data/analogsnapshot.cpp b/DSView/pv/data/analogsnapshot.cpp index cfc22080..23669a7b 100644 --- a/DSView/pv/data/analogsnapshot.cpp +++ b/DSView/pv/data/analogsnapshot.cpp @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include #include diff --git a/DSView/pv/data/analogsnapshot.h b/DSView/pv/data/analogsnapshot.h index 8767f6c3..798d812a 100644 --- a/DSView/pv/data/analogsnapshot.h +++ b/DSView/pv/data/analogsnapshot.h @@ -24,6 +24,8 @@ #ifndef DSVIEW_PV_DATA_ANALOGSNAPSHOT_H #define DSVIEW_PV_DATA_ANALOGSNAPSHOT_H +#include + #include "snapshot.h" #include diff --git a/DSView/pv/data/decode/decoder.cpp b/DSView/pv/data/decode/decoder.cpp index 1c8d2a9d..fed10d77 100644 --- a/DSView/pv/data/decode/decoder.cpp +++ b/DSView/pv/data/decode/decoder.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include #include #include "decoder.h" diff --git a/DSView/pv/data/decoderstack.cpp b/DSView/pv/data/decoderstack.cpp index 38d54a00..f6a816fa 100644 --- a/DSView/pv/data/decoderstack.cpp +++ b/DSView/pv/data/decoderstack.cpp @@ -18,6 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + #include #include diff --git a/DSView/pv/data/dso.cpp b/DSView/pv/data/dso.cpp index 2a6ce2c7..7362010f 100644 --- a/DSView/pv/data/dso.cpp +++ b/DSView/pv/data/dso.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "dso.h" #include "dsosnapshot.h" diff --git a/DSView/pv/data/dsosnapshot.cpp b/DSView/pv/data/dsosnapshot.cpp index b3e06955..05227cb3 100644 --- a/DSView/pv/data/dsosnapshot.cpp +++ b/DSView/pv/data/dsosnapshot.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include #include diff --git a/DSView/pv/data/dsosnapshot.h b/DSView/pv/data/dsosnapshot.h index e34ca502..5e33eca7 100644 --- a/DSView/pv/data/dsosnapshot.h +++ b/DSView/pv/data/dsosnapshot.h @@ -23,11 +23,12 @@ #ifndef DSVIEW_PV_DATA_DSOSNAPSHOT_H #define DSVIEW_PV_DATA_DSOSNAPSHOT_H -#include "snapshot.h" - #include #include +#include +#include "snapshot.h" + namespace DsoSnapshotTest { class Basic; } diff --git a/DSView/pv/data/group.cpp b/DSView/pv/data/group.cpp index 7d027db3..a9ee2cbe 100644 --- a/DSView/pv/data/group.cpp +++ b/DSView/pv/data/group.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "group.h" #include "groupsnapshot.h" diff --git a/DSView/pv/data/groupsnapshot.cpp b/DSView/pv/data/groupsnapshot.cpp index e7cac5d3..ae6b6cb3 100644 --- a/DSView/pv/data/groupsnapshot.cpp +++ b/DSView/pv/data/groupsnapshot.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include #include diff --git a/DSView/pv/data/logic.cpp b/DSView/pv/data/logic.cpp index ee499f43..9797b214 100644 --- a/DSView/pv/data/logic.cpp +++ b/DSView/pv/data/logic.cpp @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "logic.h" #include "logicsnapshot.h" diff --git a/DSView/pv/data/logicsnapshot.cpp b/DSView/pv/data/logicsnapshot.cpp index 0a2d6979..98d79bbf 100644 --- a/DSView/pv/data/logicsnapshot.cpp +++ b/DSView/pv/data/logicsnapshot.cpp @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include #include @@ -662,7 +661,7 @@ bool LogicSnapshot::block_nxt_edge(uint64_t *lbp, uint64_t &index, uint64_t bloc { unsigned int level = min_level; bool fast_forward = true; - const uint64_t last = last_sample ? ~0ULL : 0; + const uint64_t last = last_sample ? ~0ULL : 0ULL; //----- Search Next Edge Within Current LeafBlock -----// if (level == 0) @@ -704,7 +703,7 @@ bool LogicSnapshot::block_nxt_edge(uint64_t *lbp, uint64_t &index, uint64_t bloc // Check if there was a change in this block if (sample) { - index = (index & (~0 << (level + 1)*ScalePower)) + (bsf_folded(sample) << level*ScalePower); + index = (index & (~0ULL << (level + 1)*ScalePower)) + (bsf_folded(sample) << level*ScalePower); break; } else { index = ((index >> (level + 1)*ScalePower) + 1) << (level + 1)*ScalePower; @@ -730,7 +729,7 @@ bool LogicSnapshot::block_nxt_edge(uint64_t *lbp, uint64_t &index, uint64_t bloc // Update the low level position of the change in this block if (level == 0 ? sample ^ last : sample) { - index = (index & (~0 << (level + 1)*ScalePower)) + (bsf_folded(level == 0 ? sample ^ last : sample) << level*ScalePower); + index = (index & (~0ULL << (level + 1)*ScalePower)) + (bsf_folded(level == 0 ? sample ^ last : sample) << level*ScalePower); if (level == min_level) break; } @@ -747,7 +746,7 @@ bool LogicSnapshot::block_pre_edge(uint64_t *lbp, uint64_t &index, bool last_sam unsigned int level = min_level; bool fast_forward = true; - const uint64_t last = last_sample ? ~0ULL : 0; + const uint64_t last = last_sample ? ~0ULL : 0ULL; uint64_t block_start = index & ~LeafMask; //----- Search Next Edge Within Current LeafBlock -----// @@ -801,7 +800,7 @@ bool LogicSnapshot::block_pre_edge(uint64_t *lbp, uint64_t &index, bool last_sam // Check if there was a change in this block if (sample) { - index = (index & (~0 << (level + 1)*ScalePower)) + + index = (index & (~0ULL << (level + 1)*ScalePower)) + (bsr64(sample) << level*ScalePower) + ~(~0ULL << level*ScalePower); break; @@ -832,7 +831,7 @@ bool LogicSnapshot::block_pre_edge(uint64_t *lbp, uint64_t &index, bool last_sam // Update the low level position of the change in this block if (level == 0 ? sample ^ last : sample) { - index = (index & (~0 << (level + 1)*ScalePower)) + + index = (index & (~0ULL << (level + 1)*ScalePower)) + (bsr64(level == 0 ? sample ^ last : sample) << level*ScalePower) + ~(~0ULL << level*ScalePower); if (level == min_level) { @@ -840,7 +839,7 @@ bool LogicSnapshot::block_pre_edge(uint64_t *lbp, uint64_t &index, bool last_sam break; } } else { - index = (index & (~0 << (level + 1)*ScalePower)); + index = (index & (~0ULL << (level + 1)*ScalePower)); } } } diff --git a/DSView/pv/data/logicsnapshot.h b/DSView/pv/data/logicsnapshot.h index f914c1fb..496fd27c 100644 --- a/DSView/pv/data/logicsnapshot.h +++ b/DSView/pv/data/logicsnapshot.h @@ -24,6 +24,8 @@ #ifndef DSVIEW_PV_DATA_LOGICSNAPSHOT_H #define DSVIEW_PV_DATA_LOGICSNAPSHOT_H +#include + #include "snapshot.h" #include diff --git a/DSView/pv/data/mathstack.cpp b/DSView/pv/data/mathstack.cpp index 9f76cb8a..dc19f3d7 100644 --- a/DSView/pv/data/mathstack.cpp +++ b/DSView/pv/data/mathstack.cpp @@ -17,6 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + #include "mathstack.h" #include diff --git a/DSView/pv/data/snapshot.h b/DSView/pv/data/snapshot.h index 36b935af..a94e3e80 100644 --- a/DSView/pv/data/snapshot.h +++ b/DSView/pv/data/snapshot.h @@ -20,12 +20,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #ifndef DSVIEW_PV_DATA_SNAPSHOT_H #define DSVIEW_PV_DATA_SNAPSHOT_H -#include - #include namespace pv { diff --git a/DSView/pv/device/device.cpp b/DSView/pv/device/device.cpp index 56870acf..e8868d79 100644 --- a/DSView/pv/device/device.cpp +++ b/DSView/pv/device/device.cpp @@ -21,8 +21,6 @@ #include -#include - #include "device.h" using std::ostringstream; diff --git a/DSView/pv/device/devinst.cpp b/DSView/pv/device/devinst.cpp index 652c548e..604424d9 100644 --- a/DSView/pv/device/devinst.cpp +++ b/DSView/pv/device/devinst.cpp @@ -19,12 +19,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + + #include #include -#include - #include "devinst.h" #include diff --git a/DSView/pv/device/devinst.h b/DSView/pv/device/devinst.h index b45f515e..5a484598 100644 --- a/DSView/pv/device/devinst.h +++ b/DSView/pv/device/devinst.h @@ -22,16 +22,16 @@ #ifndef DSVIEW_PV_DEVICE_DEVINST_H #define DSVIEW_PV_DEVICE_DEVINST_H -#include - #include #include +#include #include - #include +#include + struct sr_dev_inst; struct sr_channel; struct sr_channel_group; diff --git a/DSView/pv/device/file.cpp b/DSView/pv/device/file.cpp index d0de5e0c..04b6eb4a 100644 --- a/DSView/pv/device/file.cpp +++ b/DSView/pv/device/file.cpp @@ -29,8 +29,6 @@ #include -#include - using std::string; namespace pv { diff --git a/DSView/pv/device/inputfile.cpp b/DSView/pv/device/inputfile.cpp index 69de8f80..84d8957b 100644 --- a/DSView/pv/device/inputfile.cpp +++ b/DSView/pv/device/inputfile.cpp @@ -20,15 +20,12 @@ */ #include - #include #include #include #include "inputfile.h" -#include - using std::string; namespace pv { diff --git a/DSView/pv/device/sessionfile.cpp b/DSView/pv/device/sessionfile.cpp index ada63fc3..5540e42b 100644 --- a/DSView/pv/device/sessionfile.cpp +++ b/DSView/pv/device/sessionfile.cpp @@ -21,8 +21,6 @@ #include "sessionfile.h" -#include - namespace pv { namespace device { diff --git a/DSView/pv/devicemanager.cpp b/DSView/pv/devicemanager.cpp index 7b986105..3b760f93 100644 --- a/DSView/pv/devicemanager.cpp +++ b/DSView/pv/devicemanager.cpp @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "devicemanager.h" #include "device/devinst.h" #include "device/device.h" @@ -38,8 +37,6 @@ #include -#include - using boost::shared_ptr; using std::list; using std::map; diff --git a/DSView/pv/dialogs/calibration.cpp b/DSView/pv/dialogs/calibration.cpp index 32d754ad..d8cca7f3 100755 --- a/DSView/pv/dialogs/calibration.cpp +++ b/DSView/pv/dialogs/calibration.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "calibration.h" #include @@ -30,7 +29,6 @@ #include #include -#include "libsigrok4DSL/libsigrok.h" #include "../view/trace.h" using namespace boost; diff --git a/DSView/pv/dialogs/deviceoptions.cpp b/DSView/pv/dialogs/deviceoptions.cpp index 0824716d..a8471246 100644 --- a/DSView/pv/dialogs/deviceoptions.cpp +++ b/DSView/pv/dialogs/deviceoptions.cpp @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "deviceoptions.h" #include diff --git a/DSView/pv/dialogs/deviceoptions.h b/DSView/pv/dialogs/deviceoptions.h index 52b314ae..8c41aa59 100644 --- a/DSView/pv/dialogs/deviceoptions.h +++ b/DSView/pv/dialogs/deviceoptions.h @@ -40,8 +40,9 @@ #include -#include -#include +#include +#include "../device/devinst.h" +#include "../prop/binding/deviceoptions.h" #include "../toolbars/titlebar.h" #include "../dialogs/dsdialog.h" diff --git a/DSView/pv/dialogs/dsomeasure.cpp b/DSView/pv/dialogs/dsomeasure.cpp index ec04ee33..b0cf2716 100644 --- a/DSView/pv/dialogs/dsomeasure.cpp +++ b/DSView/pv/dialogs/dsomeasure.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "dsomeasure.h" #include "../device/devinst.h" diff --git a/DSView/pv/dialogs/fftoptions.cpp b/DSView/pv/dialogs/fftoptions.cpp index 6c928a0f..49b8bd56 100644 --- a/DSView/pv/dialogs/fftoptions.cpp +++ b/DSView/pv/dialogs/fftoptions.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "fftoptions.h" #include diff --git a/DSView/pv/dialogs/protocolexp.cpp b/DSView/pv/dialogs/protocolexp.cpp index 860138e2..04be836b 100644 --- a/DSView/pv/dialogs/protocolexp.cpp +++ b/DSView/pv/dialogs/protocolexp.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "protocolexp.h" #include diff --git a/DSView/pv/dialogs/protocollist.cpp b/DSView/pv/dialogs/protocollist.cpp index 78fa327c..d96f8695 100644 --- a/DSView/pv/dialogs/protocollist.cpp +++ b/DSView/pv/dialogs/protocollist.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "protocollist.h" #include diff --git a/DSView/pv/dialogs/search.cpp b/DSView/pv/dialogs/search.cpp index cede9607..c1797197 100644 --- a/DSView/pv/dialogs/search.cpp +++ b/DSView/pv/dialogs/search.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "search.h" #include "../view/logicsignal.h" diff --git a/DSView/pv/dialogs/search.h b/DSView/pv/dialogs/search.h index f4105fb6..31e965ef 100644 --- a/DSView/pv/dialogs/search.h +++ b/DSView/pv/dialogs/search.h @@ -28,8 +28,8 @@ #include #include #include + #include "../sigsession.h" -#include #include "../toolbars/titlebar.h" #include "dsdialog.h" #include "../device/devinst.h" diff --git a/DSView/pv/dialogs/waitingdialog.cpp b/DSView/pv/dialogs/waitingdialog.cpp index bb8ddf36..ee89d2ff 100644 --- a/DSView/pv/dialogs/waitingdialog.cpp +++ b/DSView/pv/dialogs/waitingdialog.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "waitingdialog.h" #include @@ -31,7 +30,6 @@ #include #include -#include "libsigrok4DSL/libsigrok.h" #include "../view/trace.h" using namespace boost; diff --git a/DSView/pv/dock/dsotriggerdock.cpp b/DSView/pv/dock/dsotriggerdock.cpp index 8f6dffbb..6fb2f41c 100644 --- a/DSView/pv/dock/dsotriggerdock.cpp +++ b/DSView/pv/dock/dsotriggerdock.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "dsotriggerdock.h" #include "../sigsession.h" #include "../device/devinst.h" @@ -39,8 +38,6 @@ #include #include -#include "libsigrok4DSL/libsigrok.h" - using namespace boost; using namespace std; diff --git a/DSView/pv/dock/dsotriggerdock.h b/DSView/pv/dock/dsotriggerdock.h index 5062f5d5..bdc23595 100644 --- a/DSView/pv/dock/dsotriggerdock.h +++ b/DSView/pv/dock/dsotriggerdock.h @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #ifndef DSVIEW_PV_DSOTRIGGERDOCK_H #define DSVIEW_PV_DSOTRIGGERDOCK_H @@ -32,8 +31,6 @@ #include -#include - namespace pv { class SigSession; diff --git a/DSView/pv/dock/measuredock.cpp b/DSView/pv/dock/measuredock.cpp index fb116eea..b83fc861 100644 --- a/DSView/pv/dock/measuredock.cpp +++ b/DSView/pv/dock/measuredock.cpp @@ -42,8 +42,6 @@ #include #include -#include "libsigrok4DSL/libsigrok.h" - using namespace boost; namespace pv { diff --git a/DSView/pv/dock/measuredock.h b/DSView/pv/dock/measuredock.h index d049782d..920033c8 100644 --- a/DSView/pv/dock/measuredock.h +++ b/DSView/pv/dock/measuredock.h @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #ifndef DSVIEW_PV_MEASUREDOCK_H #define DSVIEW_PV_MEASUREDOCK_H @@ -43,8 +42,6 @@ #include -#include - namespace pv { class SigSession; diff --git a/DSView/pv/dock/protocoldock.cpp b/DSView/pv/dock/protocoldock.cpp index 8311c5a5..e0b8a50b 100644 --- a/DSView/pv/dock/protocoldock.cpp +++ b/DSView/pv/dock/protocoldock.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "protocoldock.h" #include "../sigsession.h" #include "../view/decodetrace.h" diff --git a/DSView/pv/dock/protocoldock.h b/DSView/pv/dock/protocoldock.h index ec56170d..8fb7d600 100644 --- a/DSView/pv/dock/protocoldock.h +++ b/DSView/pv/dock/protocoldock.h @@ -40,8 +40,6 @@ #include #include -#include - #include "../data/decodermodel.h" namespace pv { diff --git a/DSView/pv/dock/searchdock.cpp b/DSView/pv/dock/searchdock.cpp index 4f81f2ba..6f6f143e 100644 --- a/DSView/pv/dock/searchdock.cpp +++ b/DSView/pv/dock/searchdock.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "searchdock.h" #include "../sigsession.h" #include "../view/cursor.h" diff --git a/DSView/pv/dock/searchdock.h b/DSView/pv/dock/searchdock.h index d99c9b17..b328199a 100644 --- a/DSView/pv/dock/searchdock.h +++ b/DSView/pv/dock/searchdock.h @@ -42,8 +42,6 @@ #include -#include - #include "../widgets/fakelineedit.h" namespace pv { diff --git a/DSView/pv/dock/triggerdock.cpp b/DSView/pv/dock/triggerdock.cpp index cf5c654c..ee5ed628 100644 --- a/DSView/pv/dock/triggerdock.cpp +++ b/DSView/pv/dock/triggerdock.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "triggerdock.h" #include "../sigsession.h" #include "../device/devinst.h" diff --git a/DSView/pv/dock/triggerdock.h b/DSView/pv/dock/triggerdock.h index 9c88d3b4..e63390c7 100644 --- a/DSView/pv/dock/triggerdock.h +++ b/DSView/pv/dock/triggerdock.h @@ -43,8 +43,6 @@ #include -#include - namespace pv { class SigSession; diff --git a/DSView/pv/mainframe.cpp b/DSView/pv/mainframe.cpp index 1c612b66..4e003094 100644 --- a/DSView/pv/mainframe.cpp +++ b/DSView/pv/mainframe.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "mainframe.h" #include "toolbars/titlebar.h" diff --git a/DSView/pv/mainwindow.cpp b/DSView/pv/mainwindow.cpp index 7a6f0bf2..0557933d 100644 --- a/DSView/pv/mainwindow.cpp +++ b/DSView/pv/mainwindow.cpp @@ -83,7 +83,6 @@ #include #include #include -#include using boost::shared_ptr; using boost::dynamic_pointer_cast; diff --git a/DSView/pv/prop/binding/deviceoptions.h b/DSView/pv/prop/binding/deviceoptions.h index 709baf05..3d52356b 100644 --- a/DSView/pv/prop/binding/deviceoptions.h +++ b/DSView/pv/prop/binding/deviceoptions.h @@ -30,7 +30,6 @@ #include #include - #include "binding.h" namespace pv { diff --git a/DSView/pv/sigsession.cpp b/DSView/pv/sigsession.cpp index d071c9a1..ed5d6514 100644 --- a/DSView/pv/sigsession.cpp +++ b/DSView/pv/sigsession.cpp @@ -26,7 +26,6 @@ #include "sigsession.h" #include "mainwindow.h" - #include "devicemanager.h" #include "device/device.h" #include "device/file.h" diff --git a/DSView/pv/sigsession.h b/DSView/pv/sigsession.h index 6b9e33c0..609efe9e 100644 --- a/DSView/pv/sigsession.h +++ b/DSView/pv/sigsession.h @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #ifndef DSVIEW_PV_SIGSESSION_H #define DSVIEW_PV_SIGSESSION_H diff --git a/DSView/pv/storesession.cpp b/DSView/pv/storesession.cpp index 37cba7f7..be62fbfb 100644 --- a/DSView/pv/storesession.cpp +++ b/DSView/pv/storesession.cpp @@ -19,6 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */ +#define __STDC_FORMAT_MACROS + #include "storesession.h" #include diff --git a/DSView/pv/toolbars/filebar.cpp b/DSView/pv/toolbars/filebar.cpp index ce070ea2..6b3b8f00 100644 --- a/DSView/pv/toolbars/filebar.cpp +++ b/DSView/pv/toolbars/filebar.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include #include #include diff --git a/DSView/pv/toolbars/logobar.cpp b/DSView/pv/toolbars/logobar.cpp index 91d52539..a7f64c21 100644 --- a/DSView/pv/toolbars/logobar.cpp +++ b/DSView/pv/toolbars/logobar.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include #include diff --git a/DSView/pv/toolbars/samplingbar.cpp b/DSView/pv/toolbars/samplingbar.cpp index b1da58a2..0e84016c 100644 --- a/DSView/pv/toolbars/samplingbar.cpp +++ b/DSView/pv/toolbars/samplingbar.cpp @@ -19,15 +19,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include - #include - #include -#include - #include #include #include diff --git a/DSView/pv/toolbars/samplingbar.h b/DSView/pv/toolbars/samplingbar.h index 8720bf20..5fb8979e 100644 --- a/DSView/pv/toolbars/samplingbar.h +++ b/DSView/pv/toolbars/samplingbar.h @@ -24,7 +24,6 @@ #define DSVIEW_PV_TOOLBARS_SAMPLINGBAR_H #include - #include #include @@ -36,8 +35,6 @@ #include #include -#include - #include "../sigsession.h" struct st_dev_inst; diff --git a/DSView/pv/toolbars/titlebar.cpp b/DSView/pv/toolbars/titlebar.cpp index 26237fcf..b53c3696 100644 --- a/DSView/pv/toolbars/titlebar.cpp +++ b/DSView/pv/toolbars/titlebar.cpp @@ -30,11 +30,6 @@ #include #include -#ifdef Q_OS_WIN -#pragma comment(lib, "user32.lib") -#include -#endif - namespace pv { namespace toolbars { diff --git a/DSView/pv/toolbars/trigbar.cpp b/DSView/pv/toolbars/trigbar.cpp index d6160005..fe54f94a 100644 --- a/DSView/pv/toolbars/trigbar.cpp +++ b/DSView/pv/toolbars/trigbar.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "trigbar.h" #include "../sigsession.h" #include "../device/devinst.h" diff --git a/DSView/pv/view/analogsignal.cpp b/DSView/pv/view/analogsignal.cpp index 49755ab8..83d079ab 100644 --- a/DSView/pv/view/analogsignal.cpp +++ b/DSView/pv/view/analogsignal.cpp @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include #include diff --git a/DSView/pv/view/cursor.cpp b/DSView/pv/view/cursor.cpp index 6fc5ec2d..4f96b1aa 100644 --- a/DSView/pv/view/cursor.cpp +++ b/DSView/pv/view/cursor.cpp @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "cursor.h" #include "ruler.h" diff --git a/DSView/pv/view/decodetrace.cpp b/DSView/pv/view/decodetrace.cpp index f69c5b87..34a7ae32 100644 --- a/DSView/pv/view/decodetrace.cpp +++ b/DSView/pv/view/decodetrace.cpp @@ -18,6 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + extern "C" { #include } diff --git a/DSView/pv/view/devmode.cpp b/DSView/pv/view/devmode.cpp index b13a2bff..93f138e0 100644 --- a/DSView/pv/view/devmode.cpp +++ b/DSView/pv/view/devmode.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "devmode.h" #include "view.h" #include "trace.h" diff --git a/DSView/pv/view/dsosignal.cpp b/DSView/pv/view/dsosignal.cpp index aee2e780..7f862329 100644 --- a/DSView/pv/view/dsosignal.cpp +++ b/DSView/pv/view/dsosignal.cpp @@ -19,9 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include - #include #include "../../extdef.h" diff --git a/DSView/pv/view/groupsignal.cpp b/DSView/pv/view/groupsignal.cpp index 0f60328e..082ce139 100644 --- a/DSView/pv/view/groupsignal.cpp +++ b/DSView/pv/view/groupsignal.cpp @@ -19,9 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include - #include #include "groupsignal.h" diff --git a/DSView/pv/view/header.cpp b/DSView/pv/view/header.cpp index 0bd859c9..80d21c8b 100644 --- a/DSView/pv/view/header.cpp +++ b/DSView/pv/view/header.cpp @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "header.h" #include "view.h" @@ -332,6 +331,8 @@ void Header::leaveEvent(QEvent*) void Header::contextMenuEvent(QContextMenuEvent *event) { + (void)event; + int action; const boost::shared_ptr t = get_mTrace(action, _mouse_point); @@ -339,15 +340,18 @@ void Header::contextMenuEvent(QContextMenuEvent *event) if (!t || !t->selected() || action != Trace::LABEL) return; - QMenu menu(this); - if (t->get_type() == SR_CHANNEL_LOGIC) - menu.addAction(_action_add_group); - else if (t->get_type() == SR_CHANNEL_GROUP) - menu.addAction(_action_del_group); + /* + * disable group function for v0.97 temporarily + */ +// QMenu menu(this); +// if (t->get_type() == SR_CHANNEL_LOGIC) +// menu.addAction(_action_add_group); +// else if (t->get_type() == SR_CHANNEL_GROUP) +// menu.addAction(_action_del_group); - _context_trace = t; - menu.exec(event->globalPos()); - _context_trace.reset(); +// _context_trace = t; +// menu.exec(event->globalPos()); +// _context_trace.reset(); } void Header::on_action_set_name_triggered() diff --git a/DSView/pv/view/mathtrace.cpp b/DSView/pv/view/mathtrace.cpp index d388e1b5..ecd18cf7 100644 --- a/DSView/pv/view/mathtrace.cpp +++ b/DSView/pv/view/mathtrace.cpp @@ -17,22 +17,21 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include "mathtrace.h" +#include #include #include #include #include +#include "mathtrace.h" #include "../sigsession.h" #include "../data/dso.h" #include "../data/dsosnapshot.h" #include "../view/dsosignal.h" #include "../view/viewport.h" #include "../device/devinst.h" - #include "../data/mathstack.h" using namespace boost; diff --git a/DSView/pv/view/ruler.cpp b/DSView/pv/view/ruler.cpp index e900074c..904e791a 100644 --- a/DSView/pv/view/ruler.cpp +++ b/DSView/pv/view/ruler.cpp @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "ruler.h" #include "cursor.h" diff --git a/DSView/pv/view/signal.cpp b/DSView/pv/view/signal.cpp index b61b8d70..54880748 100644 --- a/DSView/pv/view/signal.cpp +++ b/DSView/pv/view/signal.cpp @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include #include diff --git a/DSView/pv/view/signal.h b/DSView/pv/view/signal.h index 2d73549e..944fa7c9 100644 --- a/DSView/pv/view/signal.h +++ b/DSView/pv/view/signal.h @@ -35,7 +35,7 @@ #include #include -#include "libsigrok4DSL/libsigrok.h" +#include #include "trace.h" namespace pv { diff --git a/DSView/pv/view/timemarker.cpp b/DSView/pv/view/timemarker.cpp index 2c8d8d73..c907991f 100644 --- a/DSView/pv/view/timemarker.cpp +++ b/DSView/pv/view/timemarker.cpp @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "timemarker.h" #include "view.h" diff --git a/DSView/pv/view/timemarker.h b/DSView/pv/view/timemarker.h index 5cd34450..953e153a 100644 --- a/DSView/pv/view/timemarker.h +++ b/DSView/pv/view/timemarker.h @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #ifndef DSVIEW_PV_VIEW_MARKER_H #define DSVIEW_PV_VIEW_MARKER_H diff --git a/DSView/pv/view/trace.cpp b/DSView/pv/view/trace.cpp index aec3700b..827bfb91 100644 --- a/DSView/pv/view/trace.cpp +++ b/DSView/pv/view/trace.cpp @@ -21,7 +21,6 @@ */ #include - #include #include diff --git a/DSView/pv/view/trace.h b/DSView/pv/view/trace.h index 1f3a4c41..27ff543a 100644 --- a/DSView/pv/view/trace.h +++ b/DSView/pv/view/trace.h @@ -31,8 +31,6 @@ #include -#include - #include "selectableitem.h" #include "dsldial.h" diff --git a/DSView/pv/view/view.cpp b/DSView/pv/view/view.cpp index f2778e84..2f3cf180 100644 --- a/DSView/pv/view/view.cpp +++ b/DSView/pv/view/view.cpp @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include #include #include diff --git a/DSView/pv/view/view.h b/DSView/pv/view/view.h index 88d62b11..b516d6e0 100644 --- a/DSView/pv/view/view.h +++ b/DSView/pv/view/view.h @@ -25,7 +25,6 @@ #define DSVIEW_PV_VIEW_VIEW_H #include - #include #include diff --git a/DSView/pv/view/viewport.cpp b/DSView/pv/view/viewport.cpp index a7dcee52..2106301d 100644 --- a/DSView/pv/view/viewport.cpp +++ b/DSView/pv/view/viewport.cpp @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include "viewport.h" #include "ruler.h" diff --git a/DSView/pv/view/viewport.h b/DSView/pv/view/viewport.h index b87994e3..d601a0ff 100644 --- a/DSView/pv/view/viewport.h +++ b/DSView/pv/view/viewport.h @@ -24,6 +24,8 @@ #ifndef DSVIEW_PV_VIEW_VIEWPORT_H #define DSVIEW_PV_VIEW_VIEWPORT_H +#include + #include #include @@ -31,10 +33,8 @@ #include #include -#include - -#include "../../extdef.h" #include "../view/view.h" +#include "../../extdef.h" class QPainter; class QPaintEvent; diff --git a/libsigrok4DSL/backend.c b/libsigrok4DSL/backend.c index 22750784..5096f6c1 100644 --- a/libsigrok4DSL/backend.c +++ b/libsigrok4DSL/backend.c @@ -18,10 +18,10 @@ * along with this program. If not, see . */ -#include -#include "config.h" /* Needed for HAVE_LIBUSB_1_0 and others. */ #include "libsigrok.h" #include "libsigrok-internal.h" +#include +#include "config.h" /* Needed for HAVE_LIBUSB_1_0 and others. */ /** * @mainpage libsigrok API diff --git a/libsigrok4DSL/dsdevice.c b/libsigrok4DSL/dsdevice.c index cbc56591..9389eda0 100644 --- a/libsigrok4DSL/dsdevice.c +++ b/libsigrok4DSL/dsdevice.c @@ -17,11 +17,11 @@ * along with this program. If not, see . */ +#include "libsigrok.h" +#include "libsigrok-internal.h" #include #include #include "config.h" /* Needed for HAVE_LIBUSB_1_0 and others. */ -#include "libsigrok.h" -#include "libsigrok-internal.h" /* Message logging helpers with subsystem-specific prefix string. */ #define LOG_PREFIX "device: " diff --git a/libsigrok4DSL/hardware/DSL/command.c b/libsigrok4DSL/hardware/DSL/command.c index 654824e8..3317eb5f 100644 --- a/libsigrok4DSL/hardware/DSL/command.c +++ b/libsigrok4DSL/hardware/DSL/command.c @@ -17,6 +17,8 @@ * along with this program. If not, see . */ +#include "libsigrok.h" +#include "libsigrok-internal.h" //#include #include "command.h" //#include "libsigrok.h" diff --git a/libsigrok4DSL/hardware/DSL/dscope.c b/libsigrok4DSL/hardware/DSL/dscope.c index 862eebc8..750fe186 100644 --- a/libsigrok4DSL/hardware/DSL/dscope.c +++ b/libsigrok4DSL/hardware/DSL/dscope.c @@ -18,6 +18,8 @@ * along with this program. If not, see . */ +#include "libsigrok.h" +#include "libsigrok-internal.h" #include #include #include @@ -35,10 +37,10 @@ #define min(a,b) ((a)<(b)?(a):(b)) static const int single_buffer_time = 20; -static const int total_buffer_time = 200; static const int buffer_size = 1024 * 1024; static const int instant_buffer_size = 1024 * 1024; static const int cons_buffer_size = 128; +static const int total_buffer_time = 200; static struct sr_dev_mode mode_list[] = { {"OSC", DSO}, @@ -47,8 +49,7 @@ static struct sr_dev_mode mode_list[] = { static const char *opmodes[] = { "Normal", "Internal Test", - "External Test", - "DRAM Loopback Test", + "Internal Test", }; static const char *thresholds[] = { @@ -1542,10 +1543,6 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi, devc->op_mode = SR_OP_BUFFER; } else if (!strcmp(stropt, opmodes[SR_OP_INTERNAL_TEST])) { devc->op_mode = SR_OP_INTERNAL_TEST; - } else if (!strcmp(stropt, opmodes[SR_OP_EXTERNAL_TEST])) { - devc->op_mode = SR_OP_EXTERNAL_TEST; - } else if (!strcmp(stropt, opmodes[SR_OP_LOOPBACK_TEST])) { - devc->op_mode = SR_OP_LOOPBACK_TEST; } else { ret = SR_ERR; } @@ -2690,10 +2687,10 @@ static int dev_acquisition_start(struct sr_dev_inst *sdi, void *cb_data) (void)cb_data; struct DSL_context *devc; - struct drv_context *drvc; struct sr_usb_dev_inst *usb; struct libusb_transfer *transfer; struct ds_trigger_pos *trigger_pos; + struct drv_context *drvc; const struct libusb_pollfd **lupfd; unsigned int i; int ret; diff --git a/libsigrok4DSL/hardware/DSL/dslogic.c b/libsigrok4DSL/hardware/DSL/dslogic.c index cf4ad80c..c89bd527 100644 --- a/libsigrok4DSL/hardware/DSL/dslogic.c +++ b/libsigrok4DSL/hardware/DSL/dslogic.c @@ -18,6 +18,8 @@ * along with this program. If not, see . */ +#include "libsigrok.h" +#include "libsigrok-internal.h" #include #include #include @@ -2367,7 +2369,7 @@ static unsigned int get_timeout(struct DSL_context *devc) total_size = get_buffer_size(devc) * get_number_of_transfers(devc); timeout = total_size / to_bytes_per_ms(devc); - //return timeout + timeout / 4; /* Leave a headroom of 25% percent. */ + if (devc->op_mode == SR_OP_STREAM) return timeout + timeout / 4; /* Leave a headroom of 25% percent. */ else @@ -2531,8 +2533,8 @@ static int dev_acquisition_start(struct sr_dev_inst *sdi, void *cb_data) (void)cb_data; struct DSL_context *devc; - struct drv_context *drvc; struct sr_usb_dev_inst *usb; + struct drv_context *drvc; const struct libusb_pollfd **lupfd; unsigned int i; int ret; diff --git a/libsigrok4DSL/hardware/common/ezusb.c b/libsigrok4DSL/hardware/common/ezusb.c index b664a16b..b02e5313 100644 --- a/libsigrok4DSL/hardware/common/ezusb.c +++ b/libsigrok4DSL/hardware/common/ezusb.c @@ -20,15 +20,14 @@ /* * Helper functions for the Cypress EZ-USB / FX2 series chips. */ - +#include "libsigrok.h" +#include "libsigrok-internal.h" //#include #include #include #include #include #include -#include "libsigrok.h" -#include "libsigrok-internal.h" /* Message logging helpers with subsystem-specific prefix string. */ #define LOG_PREFIX "ezusb: " diff --git a/libsigrok4DSL/hardware/common/usb.c b/libsigrok4DSL/hardware/common/usb.c index 4e1d9afb..ac3f6fe6 100644 --- a/libsigrok4DSL/hardware/common/usb.c +++ b/libsigrok4DSL/hardware/common/usb.c @@ -17,11 +17,11 @@ * along with this program. If not, see . */ +#include "libsigrok.h" +#include "libsigrok-internal.h" #include #include //#include -#include "libsigrok.h" -#include "libsigrok-internal.h" /* SR_CONF_CONN takes one of these: */ #define CONN_USB_VIDPID "^([0-9a-z]{4})\\.([0-9a-z]{4})$" diff --git a/libsigrok4DSL/hardware/demo/demo.c b/libsigrok4DSL/hardware/demo/demo.c index ea766c7b..6e37c4b5 100644 --- a/libsigrok4DSL/hardware/demo/demo.c +++ b/libsigrok4DSL/hardware/demo/demo.c @@ -20,6 +20,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libsigrok.h" +#include "libsigrok-internal.h" #include #include #include @@ -29,8 +31,6 @@ #include #define pipe(fds) _pipe(fds, 4096, _O_BINARY) #endif -#include "libsigrok.h" -#include "libsigrok-internal.h" /* Message logging helpers with subsystem-specific prefix string. */ #define LOG_PREFIX "demo: " diff --git a/libsigrok4DSL/hwdriver.c b/libsigrok4DSL/hwdriver.c index be319b5f..1e8304b3 100644 --- a/libsigrok4DSL/hwdriver.c +++ b/libsigrok4DSL/hwdriver.c @@ -17,6 +17,8 @@ * along with this program. If not, see . */ +#include "libsigrok.h" +#include "libsigrok-internal.h" #include #include #include @@ -24,8 +26,6 @@ #include #include #include "config.h" /* Needed for HAVE_LIBUSB_1_0 and others. */ -#include "libsigrok.h" -#include "libsigrok-internal.h" /* Message logging helpers with subsystem-specific prefix string. */ #define LOG_PREFIX "hwdriver: " diff --git a/libsigrok4DSL/input/in_binary.c b/libsigrok4DSL/input/in_binary.c index ad4d0c9b..f75e1a1a 100644 --- a/libsigrok4DSL/input/in_binary.c +++ b/libsigrok4DSL/input/in_binary.c @@ -17,14 +17,14 @@ * along with this program. If not, see . */ +#include "libsigrok.h" +#include "libsigrok-internal.h" #include #include #include #include #include #include -#include "libsigrok.h" -#include "libsigrok-internal.h" /* Message logging helpers with subsystem-specific prefix string. */ #define LOG_PREFIX "input/binary: " diff --git a/libsigrok4DSL/input/in_vcd.c b/libsigrok4DSL/input/in_vcd.c index c69c55bf..c4dcd523 100644 --- a/libsigrok4DSL/input/in_vcd.c +++ b/libsigrok4DSL/input/in_vcd.c @@ -57,12 +57,12 @@ /* */ +#include "libsigrok.h" +#include "libsigrok-internal.h" #include #include #include #include -#include "libsigrok.h" -#include "libsigrok-internal.h" /* Message logging helpers with subsystem-specific prefix string. */ #define LOG_PREFIX "input/vcd: " diff --git a/libsigrok4DSL/input/in_wav.c b/libsigrok4DSL/input/in_wav.c index f8d87ed3..33db01d9 100644 --- a/libsigrok4DSL/input/in_wav.c +++ b/libsigrok4DSL/input/in_wav.c @@ -17,13 +17,13 @@ * along with this program. If not, see . */ +#include "libsigrok.h" +#include "libsigrok-internal.h" #include #include #include #include #include -#include "libsigrok.h" -#include "libsigrok-internal.h" /* Message logging helpers with subsystem-specific prefix string. */ #define LOG_PREFIX "input/wav: " diff --git a/libsigrok4DSL/libsigrok.h b/libsigrok4DSL/libsigrok.h index 772cdf26..2dfec1c3 100644 --- a/libsigrok4DSL/libsigrok.h +++ b/libsigrok4DSL/libsigrok.h @@ -20,21 +20,14 @@ #ifndef LIBSIGROK_SIGROK_H #define LIBSIGROK_SIGROK_H +#include + #include #include #include #include #include -#ifndef _WIN32 -#include -#else -#define WINVER 0x0501 -#define _WIN32_WINNT WINVER -#include -#include -#endif - #ifdef __cplusplus extern "C" { #endif diff --git a/libsigrok4DSL/log.c b/libsigrok4DSL/log.c index 2841160a..f5b6af4e 100644 --- a/libsigrok4DSL/log.c +++ b/libsigrok4DSL/log.c @@ -18,10 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include #include "libsigrok.h" #include "libsigrok-internal.h" +#include +#include /** * @file diff --git a/libsigrok4DSL/output/csv.c b/libsigrok4DSL/output/csv.c index 9befc92f..37241ca4 100644 --- a/libsigrok4DSL/output/csv.c +++ b/libsigrok4DSL/output/csv.c @@ -18,12 +18,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libsigrok.h" +#include "libsigrok-internal.h" #include #include #include #include "config.h" /* Needed for PACKAGE_STRING and others. */ -#include "libsigrok.h" -#include "libsigrok-internal.h" #define LOG_PREFIX "output/csv" diff --git a/libsigrok4DSL/output/gnuplot.c b/libsigrok4DSL/output/gnuplot.c index b547a623..c5731714 100644 --- a/libsigrok4DSL/output/gnuplot.c +++ b/libsigrok4DSL/output/gnuplot.c @@ -18,12 +18,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include -#include -#include "config.h" /* Needed for PACKAGE_STRING and others. */ #include "libsigrok.h" #include "libsigrok-internal.h" +#include +#include +#include +#include +#include +#include "config.h" /* Needed for PACKAGE_STRING and others. */ #define LOG_PREFIX "output/gnuplot" @@ -189,7 +191,7 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p memcpy(ctx->prevsample, sample, logic->unitsize); /* The first column is a counter (needed for gnuplot). */ - g_string_append_printf(*out, "%" PRIu64 "\t", ctx->samplecount); + g_string_append_printf(*out, "%"PRIu64"\t", ctx->samplecount); /* The next columns are the values of all channels. */ for (p = 0; p < ctx->num_enabled_channels; p++) { diff --git a/libsigrok4DSL/output/output.c b/libsigrok4DSL/output/output.c index b0ba97fe..639bd24b 100644 --- a/libsigrok4DSL/output/output.c +++ b/libsigrok4DSL/output/output.c @@ -17,9 +17,9 @@ * along with this program. If not, see . */ -#include #include "libsigrok.h" #include "libsigrok-internal.h" +#include /** @cond PRIVATE */ #define LOG_PREFIX "output" diff --git a/libsigrok4DSL/output/srzip.c b/libsigrok4DSL/output/srzip.c index 3249e276..e75871b9 100644 --- a/libsigrok4DSL/output/srzip.c +++ b/libsigrok4DSL/output/srzip.c @@ -17,6 +17,8 @@ * along with this program. If not, see . */ +#include "libsigrok.h" +#include "libsigrok-internal.h" #include #include #include @@ -24,8 +26,6 @@ #include #include #include -#include "libsigrok.h" -#include "libsigrok-internal.h" #define LOG_PREFIX "output/srzip" diff --git a/libsigrok4DSL/output/vcd.c b/libsigrok4DSL/output/vcd.c index e42ca8c5..43b4b4c2 100644 --- a/libsigrok4DSL/output/vcd.c +++ b/libsigrok4DSL/output/vcd.c @@ -19,12 +19,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libsigrok.h" +#include "libsigrok-internal.h" #include #include #include #include "config.h" /* Needed for PACKAGE and others. */ -#include "libsigrok.h" -#include "libsigrok-internal.h" #define LOG_PREFIX "output/vcd" diff --git a/libsigrok4DSL/session.c b/libsigrok4DSL/session.c index 625b991f..311e622d 100644 --- a/libsigrok4DSL/session.c +++ b/libsigrok4DSL/session.c @@ -17,13 +17,13 @@ * along with this program. If not, see . */ +#include "libsigrok.h" +#include "libsigrok-internal.h" #include #include #include #include #include -#include "libsigrok.h" -#include "libsigrok-internal.h" /* Message logging helpers with subsystem-specific prefix string. */ #define LOG_PREFIX "session: " diff --git a/libsigrok4DSL/session_driver.c b/libsigrok4DSL/session_driver.c index 31d2da5c..1a663fb7 100644 --- a/libsigrok4DSL/session_driver.c +++ b/libsigrok4DSL/session_driver.c @@ -17,6 +17,8 @@ * along with this program. If not, see . */ +#include "libsigrok.h" +#include "libsigrok-internal.h" #include #include #include @@ -25,8 +27,6 @@ #include #include #include -#include "libsigrok.h" -#include "libsigrok-internal.h" /* Message logging helpers with subsystem-specific prefix string. */ #define LOG_PREFIX "virtual-session: " diff --git a/libsigrok4DSL/session_file.c b/libsigrok4DSL/session_file.c index 5b03ddba..2de9e444 100644 --- a/libsigrok4DSL/session_file.c +++ b/libsigrok4DSL/session_file.c @@ -17,6 +17,8 @@ * along with this program. If not, see . */ +#include "libsigrok.h" +#include "libsigrok-internal.h" #include #include #include @@ -27,8 +29,6 @@ #include #include #include "config.h" /* Needed for PACKAGE_VERSION and others. */ -#include "libsigrok.h" -#include "libsigrok-internal.h" /* Message logging helpers with subsystem-specific prefix string. */ #define LOG_PREFIX "session-file: " diff --git a/libsigrok4DSL/std.c b/libsigrok4DSL/std.c index 7ade9755..8a04fe99 100644 --- a/libsigrok4DSL/std.c +++ b/libsigrok4DSL/std.c @@ -18,9 +18,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include #include "libsigrok.h" #include "libsigrok-internal.h" +#include /** * Standard sr_driver_init() API helper. diff --git a/libsigrok4DSL/strutil.c b/libsigrok4DSL/strutil.c index 336d8f7e..1c469164 100644 --- a/libsigrok4DSL/strutil.c +++ b/libsigrok4DSL/strutil.c @@ -18,11 +18,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libsigrok.h" +#include "libsigrok-internal.h" #include #include #include -#include "libsigrok.h" -#include "libsigrok-internal.h" +#include /* Message logging helpers with subsystem-specific prefix string. */ #define LOG_PREFIX "strutil: " @@ -67,26 +68,26 @@ SR_API char *sr_si_string_u64(uint64_t x, const char *unit) if (unit == NULL) unit = ""; - if ((x >= SR_GHZ(1)) && (x % SR_GHZ(1) == 0)) { - return g_strdup_printf("%" PRIu64 " G%s", x / SR_GHZ(1), unit); - } else if ((x >= SR_GHZ(1)) && (x % SR_GHZ(1) != 0)) { - return g_strdup_printf("%" PRIu64 ".%" PRIu64 " G%s", - x / SR_GHZ(1), x % SR_GHZ(1), unit); - } else if ((x >= SR_MHZ(1)) && (x % SR_MHZ(1) == 0)) { - return g_strdup_printf("%" PRIu64 " M%s", - x / SR_MHZ(1), unit); - } else if ((x >= SR_MHZ(1)) && (x % SR_MHZ(1) != 0)) { - return g_strdup_printf("%" PRIu64 ".%" PRIu64 " M%s", - x / SR_MHZ(1), x % SR_MHZ(1), unit); - } else if ((x >= SR_KHZ(1)) && (x % SR_KHZ(1) == 0)) { - return g_strdup_printf("%" PRIu64 " k%s", - x / SR_KHZ(1), unit); - } else if ((x >= SR_KHZ(1)) && (x % SR_KHZ(1) != 0)) { + if ((x >= SR_GHZ(1)) && (x % SR_GHZ(1) == 0)) { + return g_strdup_printf("%" PRIu64 " G%s", x / SR_GHZ(1), unit); + } else if ((x >= SR_GHZ(1)) && (x % SR_GHZ(1) != 0)) { + return g_strdup_printf("%" PRIu64 ".%" PRIu64 " G%s", + x / SR_GHZ(1), x % SR_GHZ(1), unit); + } else if ((x >= SR_MHZ(1)) && (x % SR_MHZ(1) == 0)) { + return g_strdup_printf("%" PRIu64 " M%s", + x / SR_MHZ(1), unit); + } else if ((x >= SR_MHZ(1)) && (x % SR_MHZ(1) != 0)) { + return g_strdup_printf("%" PRIu64 ".%" PRIu64 " M%s", + x / SR_MHZ(1), x % SR_MHZ(1), unit); + } else if ((x >= SR_KHZ(1)) && (x % SR_KHZ(1) == 0)) { + return g_strdup_printf("%" PRIu64 " k%s", + x / SR_KHZ(1), unit); + } else if ((x >= SR_KHZ(1)) && (x % SR_KHZ(1) != 0)) { return g_strdup_printf("%" PRIu64 ".%" PRIu64 " K%s", - x / SR_KHZ(1), x % SR_KHZ(1), unit); - } else { - return g_strdup_printf("%" PRIu64 " %s", x, unit); - } + x / SR_KHZ(1), x % SR_KHZ(1), unit); + } else { + return g_strdup_printf("%" PRIu64 " %s", x, unit); + } sr_err("%s: Error creating SI units string.", __func__); return NULL; @@ -115,19 +116,19 @@ SR_API char *sr_iec_string_u64(uint64_t x, const char *unit) if ((x >= SR_GB(1)) && (x % SR_GB(1) == 0)) { return g_strdup_printf("%" PRIu64 " G%s", x / SR_GB(1), unit); } else if ((x >= SR_GB(1)) && (x % SR_GB(1) != 0)) { - return g_strdup_printf("%" PRIu64 ".%" PRIu64 "G%s", + return g_strdup_printf("%" PRIu64 ".%" PRIu64 " G%s", x / SR_GB(1), x % SR_GB(1), unit); } else if ((x >= SR_MB(1)) && (x % SR_MB(1) == 0)) { return g_strdup_printf("%" PRIu64 " M%s", x / SR_MB(1), unit); } else if ((x >= SR_MB(1)) && (x % SR_MB(1) != 0)) { - return g_strdup_printf("%" PRIu64 ".%" PRIu64 "M%s", + return g_strdup_printf("%" PRIu64 ".%" PRIu64 " M%s", x / SR_MB(1), x % SR_MB(1), unit); } else if ((x >= SR_KB(1)) && (x % SR_KB(1) == 0)) { return g_strdup_printf("%" PRIu64 " k%s", x / SR_KB(1), unit); } else if ((x >= SR_KB(1)) && (x % SR_KB(1) != 0)) { - return g_strdup_printf("%" PRIu64 ".%" PRIu64 "K%s", + return g_strdup_printf("%" PRIu64 ".%" PRIu64 " K%s", x / SR_KB(1), x % SR_KB(1), unit); } else { return g_strdup_printf("%" PRIu64 " %s", x, unit); diff --git a/libsigrok4DSL/trigger.c b/libsigrok4DSL/trigger.c index f9d80956..6171ec46 100644 --- a/libsigrok4DSL/trigger.c +++ b/libsigrok4DSL/trigger.c @@ -2,14 +2,14 @@ * This file is part of the DSLogic project. */ +#include "libsigrok.h" +#include "libsigrok-internal.h" #include #include #include #include #include #include -#include "libsigrok.h" -#include "libsigrok-internal.h" /* Message logging helpers with subsystem-specific prefix string. */ #define LOG_PREFIX "session: " @@ -244,7 +244,7 @@ SR_PRIV uint64_t ds_trigger_get_mask0(uint16_t stage) for (i = TriggerProbes - 1; i >= 0 ; i--) { mask = (mask << 1); - mask += (trigger->trigger0[stage][i] == 'X' || trigger->trigger0[stage][i] == 'C'); + mask += ((trigger->trigger0[stage][i] == 'X') | (trigger->trigger0[stage][i] == 'C')); } return mask; diff --git a/libsigrokdecode4DSL/srd.c b/libsigrokdecode4DSL/srd.c index 5933f881..a630db37 100644 --- a/libsigrokdecode4DSL/srd.c +++ b/libsigrokdecode4DSL/srd.c @@ -142,9 +142,9 @@ static int searchpath_add_xdg_dir(const char *datadir) SRD_API int srd_init(const char *path) { const char *const *sys_datadirs; - const char *env_path; size_t i; int ret; + const char *env_path; if (max_session_id != -1) { srd_err("libsigrokdecode is already initialized."); @@ -158,7 +158,6 @@ SRD_API int srd_init(const char *path) /* Initialize the Python interpreter. */ Py_InitializeEx(0); - /* Locations relative to the XDG system data directories. */ sys_datadirs = g_get_system_data_dirs(); for (i = g_strv_length((char **)sys_datadirs); i > 0; i--) { @@ -168,13 +167,13 @@ SRD_API int srd_init(const char *path) return ret; } } -#ifdef DECODERS_DIR + #ifdef DECODERS_DIR /* Hardcoded decoders install location, if defined. */ if ((ret = srd_decoder_searchpath_add(DECODERS_DIR)) != SRD_OK) { Py_Finalize(); return ret; } -#endif + #endif /* Location relative to the XDG user data directory. */ ret = searchpath_add_xdg_dir(g_get_user_data_dir()); if (ret != SRD_OK) {