Fix cppcheck warnings

pull/252/head
mdblack98 2020-05-05 09:38:36 -05:00
rodzic 8c73836b48
commit 3794bc5a0a
9 zmienionych plików z 28 dodań i 7 usunięć

Wyświetl plik

@ -9,4 +9,5 @@ echo "This takes several hours to run"
SUPPRESS="-i c++/rigclass.cc -i c++/rotclass.cc -i c++/ampclass.cc -i bindings -i lib/getopt.c -i lib/getopt_long.c --suppress=*:extra/gnuradio/demod.h --suppress=*:extra/gnuradio/HrAGC.h --suppress=*:extra/gnuradio/nfm.h --suppress=*:extra/gnuradio/am.h --suppress=*:extra/gnuradio/ssb.h --suppress=*:extra/gnuradio/wfm.h --suppress=*:extra/gnuradio/wfm.h --suppress=*:extra/gnuradio/HrAGC.h --suppress=knownConditionTrueFalse:tests/rotctl.c --suppress=knownConditionTrueFalse:tests/rigctl.c --suppress=knownConditionTrueFalse:tests/ampctl.c --suppress=knownConditionTrueFalse:tests/rotctl_parse.c --suppress=knownConditionTrueFalse:tests/rigctl_parse.c --suppress=knownConditionTrueFalse:tests/ampctl_parse.c"
#CHECK="-D RIG_LEVEL_LINEOUT=1 -D SIGPIPE -D SIGINT -D IPV6_V6ONLY -D RIG_MODE_WFM -D ABI_VERSION=4 -D F_SETSIG=1 -U O_ASYNC -U SA_SIGINFO -U HASH_BLOOM -U HASH_EMIT_KEYS -U HASH_FUNCTION -U __USEP5P6__"
CHECK="-Duint64_t -D HAVE_CONFIG_H -D HAMLIB_EXPORT -D HAMLIB_EXPORT_VAR -D __WORDSIZE -D BACKEND_EXPORT -D PRId64 -D DECLARE_INITRIG_BACKEND -D DECLARE_INITRROT_BACKEND -D DECLARE_INITAMP_BACKEND -U RIG_LEVEL_LINEOUT -U O_ASYNC -U F_SETSIG -U SA_SIGINFO -U SIGPIPE -U gai_strerror -U CMSPAR -U TIOCCBRK -U TIOCSBRK -U TIOCMBIC -U TIOCMBIS -U HASH_BLOOM -U HASH_EMIT_KEYS -U HASH_FUNCTION -U IPV6_V6ONLY -D SIGINT -D WIN32 -D HAVE_SIGNAL"
cppcheck --inline-suppr -I src -I include --include=include/config.h --include=include/hamlib/rig.h -q --force --enable=all --std=c99 $SUPPRESS $CHECK . &>cppcheck.log
#cppcheck --inline-suppr -I src -I include --include=include/config.h --include=include/hamlib/rig.h -q --force --enable=all --std=c99 $SUPPRESS $CHECK . &>cppcheck.log
cppcheck --check-config --inline-suppr -I src -I include --include=include/config.h --include=include/hamlib/rig.h -q --force --enable=all --std=c99 $SUPPRESS $CHECK $1

Wyświetl plik

@ -24,9 +24,13 @@
#ifndef _RIG_H
#define _RIG_H 1
// cppcheck-suppress *
#include <stdio.h>
// cppcheck-suppress *
#include <stdarg.h>
// cppcheck-suppress *
#include <inttypes.h>
// cppcheck-suppress *
#include <time.h>
/* Rig list is in a separate file so as not to mess up w/ this one */
@ -2678,6 +2682,7 @@ extern HAMLIB_EXPORT(void) rig_no_restore_ai();
extern HAMLIB_EXPORT(int) rig_get_cache_timeout_ms(RIG *rig, cache_t selection);
extern HAMLIB_EXPORT(int) rig_set_cache_timeout_ms(RIG *rig, cache_t selection, int ms);
// cppcheck-suppress *
#include <unistd.h>
extern HAMLIB_EXPORT(int) hl_usleep(useconds_t msec);

0
scripts/build-w32.sh 100644 → 100755
Wyświetl plik

0
scripts/build-w64.sh 100644 → 100755
Wyświetl plik

Wyświetl plik

@ -39,7 +39,7 @@
// Note that 1<<0 is satisfied by the last clause here == 0
// This is future-proofed for 63 levels
#define setting2idx_builtin(s) ( \
#define setting2idx_builtin(s) (( \
(s)==(1ull<<1)?1: \
(s)==(1ull<<2)?2: \
(s)==(1ull<<3)?3: \
@ -103,7 +103,7 @@
(s)==(1ull<<61)?61: \
(s)==(1ull<<62)?62: \
(s)==(1ull<<63)?63: \
0 \
0) \
)
#define LVL_PREAMP setting2idx_builtin(RIG_LEVEL_PREAMP)

Wyświetl plik

@ -21,7 +21,8 @@
#ifndef _IOFUNC_H
#define _IOFUNC_H 1
// cppcheck-suppress *
#include <sys/types.h>
#include <hamlib/rig.h>

Wyświetl plik

@ -84,10 +84,12 @@ extern int no_restore_ai;
/* needs config.h included beforehand in .c file */
#ifdef HAVE_INTTYPES_H
// cppcheck-suppress *
# include <inttypes.h>
#endif
#ifdef HAVE_SYS_TIME_H
// cppcheck-suppress *
# include <sys/time.h>
#endif

Wyświetl plik

@ -25,6 +25,7 @@
#ifndef RIGCTL_PARSE_H
#define RIGCTL_PARSE_H
// cppcheck-suppress *
#include <stdio.h>
#include <hamlib/rig.h>

Wyświetl plik

@ -33,30 +33,43 @@
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
// cppcheck-suppress *
#include <windows.h>
#endif
// cppcheck-suppress *
#include <stdio.h>
// cppcheck-suppress *
#include <stdlib.h>
// cppcheck-suppress *
#include <string.h>
// cppcheck-suppress *
#include <unistd.h>
// cppcheck-suppress *
#include <ctype.h>
// cppcheck-suppress *
#include <errno.h>
// cppcheck-suppress *
#include <signal.h>
// cppcheck-suppress *
#include <getopt.h>
// cppcheck-suppress *
#include <sys/types.h>
#ifdef HAVE_NETINET_IN_H
// cppcheck-suppress *
# include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
// cppcheck-suppress *
# include <arpa/inet.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
// cppcheck-suppress *
# include <sys/socket.h>
#elif HAVE_WS2TCPIP_H
# include <ws2tcpip.h>
@ -722,9 +735,7 @@ static int handle_ts2000(void *arg)
int p15 = 0; // P15 Shift status dummy value for now
int retval = rig_get_freq(my_rig, RIG_VFO_A, &freq);
char response[64];
// cppcheck-suppress *
char *fmt =
"IF%011"PRIll"%04d+%05d%1d%1d%1d%02d%1d%1"PRIll"%1d%1d%1d%1d%02d%1d;";
char *fmt = "IF%011"PRIll"%04d+%05d%1d%1d%1d%02d%1d%1"PRIll"%1d%1d%1d%1d%02d%1d;";
if (retval != RIG_OK)
{