Fix cppcheck warnings

pull/345/head
Michael Black W9MDB 2020-06-21 22:31:31 -05:00
rodzic e092a4a0a4
commit a3c4eb9ee0
7 zmienionych plików z 13 dodań i 12 usunięć

Wyświetl plik

@ -346,6 +346,7 @@ int dxsr8_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
return -RIG_EINVAL;
}
// cppcheck-suppress *
cmd_len = sprintf(cmd, AL "~RW_RXF%08"PRIll EOM, (int64_t)freq);
return dxsr8_transaction(rig, cmd, cmd_len, NULL, NULL);
}
@ -769,4 +770,4 @@ int dxsr8_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
cmd_len = sprintf(cmd, AL "~RW_PTT%02d" EOM, ptt);
return dxsr8_transaction(rig, cmd, cmd_len, NULL, NULL);
}
}

Wyświetl plik

@ -1385,7 +1385,7 @@ int HAMLIB_API parse_hoststr(char *hoststr, char host[256], char port[6])
dummy[0] = 0;
// bracketed IPV6 with optional port
int n = sscanf(hoststr, "[%255[^]]]:%s", host, port);
int n = sscanf(hoststr, "[%255[^]]]:%5s", host, port);
if (n >= 1)
{
@ -1393,7 +1393,7 @@ int HAMLIB_API parse_hoststr(char *hoststr, char host[256], char port[6])
}
// non-bracketed IPV6 with optional link addr
n = sscanf(hoststr, "%x::%x:%x:%x:%x:%%%31[^:]:%s", &net1, &net2, &net3,
n = sscanf(hoststr, "%x::%x:%x:%x:%x:%%%31[^:]:%5s", &net1, &net2, &net3,
&net4, &net5, link, port);
if (strchr(hoststr, '%') && (n == 5 || n == 6))
@ -1433,7 +1433,7 @@ int HAMLIB_API parse_hoststr(char *hoststr, char host[256], char port[6])
// bracketed localhost
if (strstr(hoststr, "::1"))
{
n = sscanf(hoststr, "::1%s", dummy);
n = sscanf(hoststr, "::1%5s", dummy);
strcpy(host, hoststr);
if (n == 1)

Wyświetl plik

@ -130,7 +130,7 @@ int network_open(hamlib_port_t *rp, int default_port)
int status;
struct addrinfo hints, *res, *saved_res;
struct in6_addr serveraddr;
char hoststr[256], portstr[6];
char hoststr[256], portstr[6] = "";
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rig_debug(RIG_DEBUG_VERBOSE, "%s version 1.0\n", __func__);

Wyświetl plik

@ -558,7 +558,6 @@ int HAMLIB_API rig_open(RIG *rig)
value_t parm_value;
//unsigned int net1, net2, net3, net4, net5, net6, net7, net8, port;
int is_network = 0;
char hoststr[256], portstr[6];
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -572,6 +571,7 @@ int HAMLIB_API rig_open(RIG *rig)
if (strlen(rs->rigport.pathname) > 0)
{
char hoststr[256], portstr[6];
status = parse_hoststr(rs->rigport.pathname, hoststr, portstr);
if (status == RIG_OK) { is_network = 1; }
@ -2911,14 +2911,14 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
int retcode, rc2;
vfo_t curr_vfo, tx_vfo;
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, curr_vfo=%s\n", __func__,
rig_strvfo(vfo), rig_strvfo(rig->state.current_vfo));
if (CHECK_RIG_ARG(rig))
{
return -RIG_EINVAL;
}
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, curr_vfo=%s\n", __func__,
rig_strvfo(vfo), rig_strvfo(rig->state.current_vfo));
caps = rig->caps;
if (caps->set_split_freq

Wyświetl plik

@ -1957,6 +1957,7 @@ declare_proto_rig(get_freq)
{
int status;
freq_t freq;
// cppcheck-suppress *
char *fmt = "%"PRIll"%c";
status = rig_get_freq(rig, vfo, &freq);

Wyświetl plik

@ -737,8 +737,8 @@ 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 =
// cppcheck-suppress *
"IF%011"PRIll"%04d+%05d%1d%1d%1d%02d%1d%1"PRIll"%1d%1d%1d%1d%02d%1d;";
if (retval != RIG_OK)

Wyświetl plik

@ -685,8 +685,7 @@ int main(int argc, char *argv[])
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
hints.ai_socktype = SOCK_STREAM;/* TCP socket */
hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */
hints.ai_flags = AI_CANONNAME;
hints.ai_flags = AI_PASSIVE | AI_CANONNAME; /* For wildcard IP address */
hints.ai_protocol = 0; /* Any protocol */
retcode = getaddrinfo(src_addr, portno, &hints, &result);