]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Some 'style' improvements suggested by cppcheck
authorDL1YCF <dl1ycf@darc.de>
Sun, 22 Nov 2020 14:46:28 +0000 (15:46 +0100)
committerDL1YCF <dl1ycf@darc.de>
Sun, 22 Nov 2020 14:46:28 +0000 (15:46 +0100)
MacOS.c
midi2.c
new_protocol.c
old_protocol.c
vfo.c

diff --git a/MacOS.c b/MacOS.c
index ec095ae1f784953add73a9ecc8d9b8ce7b2948f2..3fc19cfa027dafc83fdd3ae18e2612d9f5809324 100644 (file)
--- 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 f7a3c186e35bdebba90cecd55a13c7b9a1edeeb5..e316ea104428dc76bf80d5ba9ed26df6902a940e 100644 (file)
--- 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);
index 32f88b22f5c47fd48bee2635d8cb1e234bccd510..64cabfe29be8ced9b49b2464ff99f983a3e391b5 100644 (file)
@@ -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
       //
index 544d27162581ad5a6a69819b01cfe970a65174be..d0222e2860d583cc74d94dd7c0c12f1d6469b516 100644 (file)
@@ -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 4e69fc4deb59c5a0d5e818f24297fb5fc6acc964..20f6e716488762c08e3a45c5642d8f5eb5af8ad8 100644 (file)
--- 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;