From 062f260c073707d18878f5be755800a894c04058 Mon Sep 17 00:00:00 2001 From: George Baltz N3GB Date: Sat, 19 Jul 2025 15:31:02 -0400 Subject: [PATCH] Clean up some cppcheck gripes in simulators/ --- simulators/simpstrotator.c | 4 ++-- simulators/simts890.c | 13 +++++++------ simulators/simts990.c | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/simulators/simpstrotator.c b/simulators/simpstrotator.c index 1b1454116..74e7cd01a 100644 --- a/simulators/simpstrotator.c +++ b/simulators/simpstrotator.c @@ -8,7 +8,7 @@ #define REPLY_PORT 12002 #define BUFFER_SIZE 1024 -void handle_receive(int recv_sockfd, struct sockaddr_in *client_addr, +static void handle_receive(int recv_sockfd, struct sockaddr_in *client_addr, socklen_t addr_len, char *buffer) { ssize_t recv_len; @@ -28,7 +28,7 @@ void handle_receive(int recv_sockfd, struct sockaddr_in *client_addr, printf("Data: %s\n", buffer); } -void handle_send(int send_sockfd, struct sockaddr_in *client_addr, +static void handle_send(int send_sockfd, struct sockaddr_in *client_addr, socklen_t addr_len, const char *message) { ssize_t sent_len; diff --git a/simulators/simts890.c b/simulators/simts890.c index 7d9120669..b39a40db7 100644 --- a/simulators/simts890.c +++ b/simulators/simts890.c @@ -123,7 +123,7 @@ int tfset = 0; typedef struct kvfo { int freq; - int mode; + unsigned int mode; short band, vfo; // Redundant, but useful for relative movement } *kvfop_t; @@ -267,8 +267,8 @@ getmyline(int fd, char *buf) if (retval != 0) { perror("read failed:"); - close(fd); - fd = openPort(""); + //close(fd); + //fd = openPort(""); } if (strlen(buf) == 0) { hl_usleep(10 * 1000); } @@ -588,7 +588,8 @@ int main(int argc, char *argv[]) else if (strncmp(buf, "SF", 2) == 0) { // Sets and Reads the VFO (Frequency and Mode) - int tmpvfo, tmpfreq, tmpmode, newband; + int tmpvfo, tmpfreq, newband; + unsigned int tmpmode; kvfop_t ovfo, nvfo; if (sscanf(buf, SFformat, &tmpvfo, &tmpfreq, &tmpmode) != 3 || tmpvfo < 0 @@ -599,7 +600,7 @@ int main(int argc, char *argv[]) continue; } - //printf("tmpvfo=%d, tmpfreq=%d, tmpmode=%d\n", tmpvfo, tmpfreq, tmpmode); + //printf("tmpvfo=%d, tmpfreq=%d, tmpmode=%u\n", tmpvfo, tmpfreq, tmpmode); ovfo = *vfoAB[tmpvfo]; newband = freq2band(tmpfreq); @@ -1251,10 +1252,10 @@ int main(int argc, char *argv[]) case '0': // Get/Set Local clock { time_t t; - struct tm *localtm; if (buf[3] == ';') { + const struct tm *localtm; t = time(NULL); localtm = localtime(&t); strftime(&buf[3], BUFSIZ - 3, "%y%m%d%H%M%S;", localtm); diff --git a/simulators/simts990.c b/simulators/simts990.c index 84b4d7c82..c39ba49ac 100644 --- a/simulators/simts990.c +++ b/simulators/simts990.c @@ -116,8 +116,8 @@ getmyline(int fd, char *buf) if (retval != 0) { perror("read failed:"); - close(fd); - fd = openPort(""); + //close(fd); + //fd = openPort(""); } if (strlen(buf) == 0) { hl_usleep(10 * 1000); }