From 802fadccd7423e017b583b5c4933c81b618b9d26 Mon Sep 17 00:00:00 2001 From: DL1YCF Date: Sun, 22 Nov 2020 15:46:28 +0100 Subject: [PATCH] Some 'style' improvements suggested by cppcheck --- MacOS.c | 7 ++++--- midi2.c | 4 ++-- new_protocol.c | 2 +- old_protocol.c | 2 +- vfo.c | 3 +-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/MacOS.c b/MacOS.c index ec095ae..3fc19cf 100644 --- a/MacOS.c +++ b/MacOS.c @@ -6,6 +6,8 @@ * * MaOSstartup(char *path) : create working dir in "$HOME/Library/Application Support" etc. * + * where *path is argv[0], the file name of the running executable + * */ #ifdef __APPLE__ @@ -56,7 +58,7 @@ void MacOSstartup(char *path) { // If the current work dir is NOT "/", just do nothing // *workdir=0; - c=getcwd(workdir,sizeof(workdir)); + if (getcwd(workdir,sizeof(workdir)) == NULL) return; if (strlen(workdir) != 1 || *workdir != '/') return; // @@ -103,8 +105,7 @@ void MacOSstartup(char *path) { // // Copy icon from app bundle to the work dir // - c=getcwd(workdir,sizeof(workdir)); - if (strlen(path) < 1024) { + if (getcwd(workdir,sizeof(workdir)) != NULL && strlen(path) < 1024) { // // source = basename of the executable // diff --git a/midi2.c b/midi2.c index f7a3c18..e316ea1 100644 --- a/midi2.c +++ b/midi2.c @@ -27,8 +27,8 @@ void NewMidiEvent(enum MIDIevent event, int channel, int note, int val) { static enum MIDIaction last_wheel_action=MIDI_ACTION_NONE ; static struct timespec tp, last_wheel_tp={0,0}; long delta; - struct timespec ts; - double now; + struct timespec ts; // used in debug code + double now; // used in debug code //Un-comment the next three lines to get a log of incoming MIDI events with milli-second time stamps //clock_gettime(CLOCK_MONOTONIC, &ts); diff --git a/new_protocol.c b/new_protocol.c index 32f88b2..64cabfe 100644 --- a/new_protocol.c +++ b/new_protocol.c @@ -1909,7 +1909,7 @@ static void process_high_priority() { if (cw_keyer_internal) { // Stops CAT cw transmission if paddle hit in "internal" CW - if ((dash || dot) && cw_keyer_internal) cw_key_hit=1; + if ((dash || dot)) cw_key_hit=1; } else { #ifdef LOCALCW // diff --git a/old_protocol.c b/old_protocol.c index 544d271..d0222e2 100644 --- a/old_protocol.c +++ b/old_protocol.c @@ -1076,7 +1076,7 @@ static void process_control_bytes() { if (cw_keyer_internal) { // Stops CAT cw transmission if paddle hit in "internal" CW - if ((dash || dot) && cw_keyer_internal) cw_key_hit=1; + if ((dash || dot)) cw_key_hit=1; } else { #ifdef LOCALCW // diff --git a/vfo.c b/vfo.c index 4e69fc4..20f6e71 100644 --- a/vfo.c +++ b/vfo.c @@ -370,11 +370,10 @@ void vfo_band_changed(int id,int b) { vfo[id].band=b; vfo[id].frequency=entry->frequency; vfo[id].mode=entry->mode; - vfo[id].filter=entry->filter; vfo[id].lo=band->frequencyLO+band->errorLO; // -// Change to the filter/NR combination stored for this mode +// Apply the filter/NR combination stored for this mode // m=vfo[id].mode; -- 2.45.2