From 1c36377480cb13a2ea863a2fd8a045ce2c1ce5f3 Mon Sep 17 00:00:00 2001 From: George Baltz N3GB Date: Tue, 29 Jul 2025 13:10:28 -0400 Subject: [PATCH] Still more cppcheck tweaks --- rigs/icom/icr8500.c | 4 ++-- rigs/yaesu/ft817.c | 2 +- rigs/yaesu/ft857.c | 2 +- rigs/yaesu/ft897.c | 2 +- rotators/ts7400/include/peekpoke.c | 2 +- rotators/ts7400/include/readADC.c | 4 ++-- rotators/ts7400/include/test7400ADC.c | 4 ++-- security/aes.c | 2 +- security/md5.c | 12 ++++++------ security/sha256.c | 2 +- simulators/simft990.c | 2 +- tests/testnet.c | 2 +- 12 files changed, 20 insertions(+), 20 deletions(-) diff --git a/rigs/icom/icr8500.c b/rigs/icom/icr8500.c index 00b6203d8..9aadadde5 100644 --- a/rigs/icom/icr8500.c +++ b/rigs/icom/icr8500.c @@ -57,7 +57,7 @@ { 238, 60 }, \ } } -int icr8500_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); +static int icr8500_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); static struct icom_priv_caps icr8500_priv_caps = { @@ -199,7 +199,7 @@ struct rig_caps icr8500_caps = .hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS }; -int icr8500_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) +static int icr8500_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { switch (func) { diff --git a/rigs/yaesu/ft817.c b/rigs/yaesu/ft817.c index cf6a0167d..0ca3a6bd8 100644 --- a/rigs/yaesu/ft817.c +++ b/rigs/yaesu/ft817.c @@ -674,7 +674,7 @@ static inline long timediff(const struct timeval *tv1, return ((tv.tv_sec * 1000L) + (tv.tv_usec / 1000L)); } -static int check_cache_timeout(struct timeval *tv) +static int check_cache_timeout(const struct timeval *tv) { struct timeval curr; long t; diff --git a/rigs/yaesu/ft857.c b/rigs/yaesu/ft857.c index 3527b0e50..b195f3322 100644 --- a/rigs/yaesu/ft857.c +++ b/rigs/yaesu/ft857.c @@ -460,7 +460,7 @@ static inline long timediff(const struct timeval *tv1, return ((tv.tv_sec * 1000L) + (tv.tv_usec / 1000L)); } -static int check_cache_timeout(struct timeval *tv) +static int check_cache_timeout(const struct timeval *tv) { struct timeval curr; long t; diff --git a/rigs/yaesu/ft897.c b/rigs/yaesu/ft897.c index d16a8cef6..7e3f33bbb 100644 --- a/rigs/yaesu/ft897.c +++ b/rigs/yaesu/ft897.c @@ -594,7 +594,7 @@ static inline long timediff(const struct timeval *tv1, return ((tv.tv_sec * 1000L) + (tv.tv_usec / 1000L)); } -static int check_cache_timeout(struct timeval *tv) +static int check_cache_timeout(const struct timeval *tv) { struct timeval curr; long t; diff --git a/rotators/ts7400/include/peekpoke.c b/rotators/ts7400/include/peekpoke.c index 7ddb08383..544c2a7c2 100644 --- a/rotators/ts7400/include/peekpoke.c +++ b/rotators/ts7400/include/peekpoke.c @@ -4,7 +4,7 @@ #include #include -unsigned int parseBinary(char *str) +unsigned int parseBinary(const char *str) { unsigned int val = 0; diff --git a/rotators/ts7400/include/readADC.c b/rotators/ts7400/include/readADC.c index 8bc9996d2..d91d8ffc7 100644 --- a/rotators/ts7400/include/readADC.c +++ b/rotators/ts7400/include/readADC.c @@ -76,7 +76,7 @@ empty_calibration: return 0; } -void write_calibration(int cal[NUM_CHANNELS][2]) +void write_calibration(const int cal[NUM_CHANNELS][2]) { unsigned short buf[16]; int i, j, k = 0; @@ -107,7 +107,7 @@ static void erase_calibration() } int check_calibration(int cal[NUM_CHANNELS][2], - int stored_cal[NUM_CHANNELS][2], int state) + const int stored_cal[NUM_CHANNELS][2], int state) { double pcnt_diff; int i, j, erase_cal = 0; diff --git a/rotators/ts7400/include/test7400ADC.c b/rotators/ts7400/include/test7400ADC.c index 96201e653..f03954ad5 100644 --- a/rotators/ts7400/include/test7400ADC.c +++ b/rotators/ts7400/include/test7400ADC.c @@ -74,7 +74,7 @@ empty_calibration: return 0; } -void write_calibration(int cal[NUM_CHANNELS][2]) +void write_calibration(const int cal[NUM_CHANNELS][2]) { unsigned short buf[16]; int i, j, k = 0; @@ -105,7 +105,7 @@ static void erase_calibration() } int check_calibration(int cal[NUM_CHANNELS][2], - int stored_cal[NUM_CHANNELS][2], int state) + const int stored_cal[NUM_CHANNELS][2], int state) { double pcnt_diff; int i, j, erase_cal = 0; diff --git a/security/aes.c b/security/aes.c index 9333b8a04..23fb3dac7 100644 --- a/security/aes.c +++ b/security/aes.c @@ -63,7 +63,7 @@ int do_init = 1; #define XTIME(x) ( ( x << 1 ) ^ ( ( x & 0x80 ) ? 0x1B : 0x00 ) ) #define MUL(x,y) ( ( x && y ) ? pow[(log[x] + log[y]) % 255] : 0 ) -void aes_gen_tables(void) +static void aes_gen_tables(void) { int i; uint8 x, y; diff --git a/security/md5.c b/security/md5.c index 9baf0a048..191cfe664 100644 --- a/security/md5.c +++ b/security/md5.c @@ -1,6 +1,6 @@ #include "md5.h" -char *make_digest(const unsigned char *digest, int len) /* {{{ */ +static char *make_digest(const unsigned char *digest, int len) /* {{{ */ { int md5len = sizeof(char) * (len * 2 + 1); char *md5str = (char *) calloc(1, md5len); @@ -64,7 +64,7 @@ char *make_digest(const unsigned char *digest, int len) /* {{{ */ * This processes one or more 64-byte data blocks, but does NOT update * the bit counters. There are no alignment requirements. */ -const void *body(void *ctxBuf, const void *data, size_t size) +static const void *body(void *ctxBuf, const void *data, size_t size) { MD5_CTX *ctx = (MD5_CTX *)ctxBuf; const unsigned char *ptr; @@ -174,7 +174,7 @@ const void *body(void *ctxBuf, const void *data, size_t size) return ptr; } -void MD5Init(void *ctxBuf) +static void MD5Init(void *ctxBuf) { MD5_CTX *ctx = (MD5_CTX *)ctxBuf; ctx->a = 0x67452301; @@ -186,7 +186,7 @@ void MD5Init(void *ctxBuf) ctx->hi = 0; } -void MD5Update(void *ctxBuf, const void *data, size_t size) +static void MD5Update(void *ctxBuf, const void *data, size_t size) { MD5_CTX *ctx = (MD5_CTX *)ctxBuf; MD5_u32plus saved_lo; @@ -229,7 +229,7 @@ void MD5Update(void *ctxBuf, const void *data, size_t size) memcpy(ctx->buffer, data, size); } -void MD5Final(unsigned char *result, void *ctxBuf) +static void MD5Final(unsigned char *result, void *ctxBuf) { MD5_CTX *ctx = (MD5_CTX *)ctxBuf; MD5_u32plus used, free; @@ -282,7 +282,7 @@ void MD5Final(unsigned char *result, void *ctxBuf) memset(ctx, 0, sizeof(*ctx)); } -unsigned char *make_hash(const char *arg) +static unsigned char *make_hash(const char *arg) { MD5_CTX context; static unsigned char digest[65]; diff --git a/security/sha256.c b/security/sha256.c index 811cee623..4a010ebb4 100644 --- a/security/sha256.c +++ b/security/sha256.c @@ -53,7 +53,7 @@ void sha256_starts(sha256_context *ctx) ctx->state[7] = 0x5BE0CD19; } -void sha256_process(sha256_context *ctx, const uint8 data[64]) +static void sha256_process(sha256_context *ctx, const uint8 data[64]) { uint32 temp1, temp2, W[64]; uint32 A, B, C, D, E, F, G, H; diff --git a/simulators/simft990.c b/simulators/simft990.c index 06dca62a6..5dbb569ea 100644 --- a/simulators/simft990.c +++ b/simulators/simft990.c @@ -49,7 +49,7 @@ typedef enum nc_rigid_e NC_RIGID_FTDX101MP = 682 } nc_rigid_t; -void load_dat(const char *filename, unsigned char buf[1492]) +static void load_dat(const char *filename, unsigned char buf[1492]) { FILE *fp = fopen(filename, "r"); char line[4096]; diff --git a/tests/testnet.c b/tests/testnet.c index aff0b9a62..1d1f1f45d 100644 --- a/tests/testnet.c +++ b/tests/testnet.c @@ -106,7 +106,7 @@ static int test_host(char *hoststr, char host[256], char port[6]) } int -main(int argc, char *argv[]) +main(int argc, const char *argv[]) { // IPV4 test_host("127.0.0.1", "127.0.0.1", "");