kopia lustrzana https://github.com/Hamlib/Hamlib
Fix always true conditions found by cppcheck
https://github.com/Hamlib/Hamlib/issues/1351pull/1404/head
rodzic
631a2a3aa1
commit
5ac1e50b80
|
@ -71,6 +71,7 @@ CHECK="\
|
|||
-D SIGINT \
|
||||
-D WIN32 \
|
||||
-D CLOCK_REALTIME \
|
||||
-D HAVE_PTHREAD \
|
||||
-D HAVE_SIGNAL"
|
||||
|
||||
# If no directory or file name provided, scan the entire project.
|
||||
|
|
|
@ -99,7 +99,7 @@ const struct rig_caps barrett4050_caps =
|
|||
RIG_MODEL(RIG_MODEL_BARRETT_4050),
|
||||
.model_name = "4050",
|
||||
.mfg_name = "Barrett",
|
||||
.version = BACKEND_VER ".0f",
|
||||
.version = BACKEND_VER ".0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
|
|
@ -440,6 +440,7 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
|
|||
rig_debug(RIG_DEBUG_WARN, "%s: retry needed? retry=%d\n", __func__, retry);
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: before read_string\n", __func__);
|
||||
int len = read_string(&rs->rigport, (unsigned char *) tmp_buf, sizeof(tmp_buf),
|
||||
delims,
|
||||
strlen(delims), 0, 1);
|
||||
|
|
|
@ -494,11 +494,6 @@ int elecraft_get_extension_level(RIG *rig, const char *cmd, int *ext_level)
|
|||
|
||||
for (i = 0; elec_ext_id_str_lst[i].level != EXT_LEVEL_NONE; i++)
|
||||
{
|
||||
if (strcmp(elec_ext_id_str_lst[i].id, bufptr) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp(elec_ext_id_str_lst[i].id, bufptr) == 0)
|
||||
{
|
||||
*ext_level = elec_ext_id_str_lst[i].level;
|
||||
|
|
|
@ -161,9 +161,8 @@ static int get_ic10_if(RIG *rig, char *data)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (retval == RIG_OK &&
|
||||
(data_len < priv->if_len ||
|
||||
data[0] != 'I' || data[1] != 'F'))
|
||||
if (data_len < priv->if_len ||
|
||||
data[0] != 'I' || data[1] != 'F')
|
||||
{
|
||||
rig_debug(RIG_DEBUG_WARN, "%s: unexpected answer %s, len=%d\n",
|
||||
__func__, data, data_len);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#ifndef _IC10_H
|
||||
#define _IC10_H 1
|
||||
|
||||
#define IC10_VER "20200407"
|
||||
#define IC10_VER "20231002"
|
||||
|
||||
int ic10_cmd_trim (char *data, int data_len);
|
||||
int ic10_transaction (RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len);
|
||||
|
|
|
@ -1119,7 +1119,7 @@ int kenwood_close(RIG *rig)
|
|||
it's not supported */
|
||||
}
|
||||
|
||||
if (priv->poweron != 0 && rig->state.auto_power_off)
|
||||
if (rig->state.auto_power_off)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: got PS1 so powerdown\n", __func__);
|
||||
rig_set_powerstat(rig, 0);
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "token.h"
|
||||
#include "idx_builtin.h"
|
||||
|
||||
#define BACKEND_VER "20230926"
|
||||
#define BACKEND_VER "20231002"
|
||||
|
||||
#define EOM_KEN ';'
|
||||
#define EOM_TH '\r'
|
||||
|
|
|
@ -652,10 +652,7 @@ static int prm80_do_read_system_state(hamlib_port_t *rigport, char *statebuf)
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (ret >= 0)
|
||||
{
|
||||
statebuf[ret] = '\0';
|
||||
}
|
||||
statebuf[ret] = '\0';
|
||||
|
||||
if (ret < CMD_E_RSP_LEN)
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <sys/time.h>
|
||||
#include <hamlib/rig.h>
|
||||
|
||||
#define BACKEND_VER "20210416"
|
||||
#define BACKEND_VER "20231002.0"
|
||||
|
||||
#define PRM80_MEM_CAP { \
|
||||
.freq = 1, \
|
||||
|
|
|
@ -124,7 +124,7 @@ const struct rig_caps tt588_caps =
|
|||
RIG_MODEL(RIG_MODEL_TT588),
|
||||
.model_name = "TT-588 Omni VII",
|
||||
.mfg_name = "Ten-Tec",
|
||||
.version = "20220718.0",
|
||||
.version = "20231002.0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
@ -293,9 +293,9 @@ static int tt588_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
|
|||
return RIG_OK;
|
||||
}
|
||||
|
||||
if (retval == -RIG_ETIMEOUT) { return retval; }
|
||||
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: read_string failed, try#%d\n", __func__, i + 1);
|
||||
|
||||
return retval;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -105,15 +105,6 @@ typedef struct
|
|||
}
|
||||
FT600_STATUS_INFO;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char byte[8];
|
||||
}
|
||||
// cppcheck-suppress *
|
||||
FT600_FLAG_INFO;
|
||||
|
||||
|
||||
static int ft600_init(RIG *rig);
|
||||
static int ft600_open(RIG *rig);
|
||||
static int ft600_cleanup(RIG *rig);
|
||||
|
@ -133,7 +124,6 @@ static int ft600_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
|
|||
struct ft600_priv_data
|
||||
{
|
||||
FT600_STATUS_INFO status;
|
||||
FT600_FLAG_INFO flags;
|
||||
unsigned char s_meter;
|
||||
|
||||
};
|
||||
|
@ -234,7 +224,7 @@ const struct rig_caps ft600_caps =
|
|||
RIG_MODEL(RIG_MODEL_FT600),
|
||||
.model_name = "FT-600",
|
||||
.mfg_name = "Yaesu",
|
||||
.version = "20201009.0",
|
||||
.version = "20231001.0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
|
|
@ -1161,7 +1161,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
}
|
||||
|
||||
// we need to change vfos, BS, and change back
|
||||
if (!is_ft991 && !is_ft891 && newcat_valid_command(rig, "VS"))
|
||||
if (is_ft991==FALSE && is_ft891==FALSE && newcat_valid_command(rig, "VS"))
|
||||
{
|
||||
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "VS%d;BS%02d%c",
|
||||
vfo1, newcat_band_index(freq), cat_term);
|
||||
|
|
|
@ -68,26 +68,23 @@ static void *apex_read(void *arg)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: data='%s'\n", __func__, data);
|
||||
|
||||
if (retval == 0)
|
||||
switch (data[16])
|
||||
{
|
||||
switch (data[16])
|
||||
{
|
||||
case '0': apex_azimuth = 45; break;
|
||||
case '0': apex_azimuth = 45; break;
|
||||
|
||||
case '1': apex_azimuth = 90; break;
|
||||
case '1': apex_azimuth = 90; break;
|
||||
|
||||
case '2': apex_azimuth = 135; break;
|
||||
case '2': apex_azimuth = 135; break;
|
||||
|
||||
case '3': apex_azimuth = 180; break;
|
||||
case '3': apex_azimuth = 180; break;
|
||||
|
||||
case '4': apex_azimuth = 225; break;
|
||||
case '4': apex_azimuth = 225; break;
|
||||
|
||||
case '5': apex_azimuth = 270; break;
|
||||
case '5': apex_azimuth = 270; break;
|
||||
|
||||
case '6': apex_azimuth = 315; break;
|
||||
case '6': apex_azimuth = 315; break;
|
||||
|
||||
case '7': apex_azimuth = 0; break;
|
||||
}
|
||||
case '7': apex_azimuth = 0; break;
|
||||
}
|
||||
|
||||
// printf("az=%f\n", apex_azimuth);
|
||||
|
|
|
@ -72,7 +72,7 @@ const struct rot_caps apex_shared_loop_rot_caps =
|
|||
ROT_MODEL(ROT_MODEL_APEX_SHARED_LOOP),
|
||||
.model_name = "Shared Loop",
|
||||
.mfg_name = "Apex",
|
||||
.version = "20221224.0",
|
||||
.version = "20231002.0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rot_type = ROT_TYPE_AZIMUTH,
|
||||
|
|
|
@ -143,16 +143,13 @@ again:
|
|||
{
|
||||
printf("Get VFO curr_vfo=%d\n", curr_vfo);
|
||||
|
||||
if (buf[4] == 0x20)
|
||||
if (curr_vfo == 1)
|
||||
{
|
||||
if (curr_vfo == 1)
|
||||
{
|
||||
curr_vfo = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
curr_vfo = 1;
|
||||
}
|
||||
curr_vfo = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
curr_vfo = 1;
|
||||
}
|
||||
|
||||
printf("Get VFO curr_vfo=%d\n", curr_vfo);
|
||||
|
|
|
@ -320,7 +320,7 @@ void *multicast_thread_rx(void *vrig)
|
|||
#if 0
|
||||
char buf[256];
|
||||
#endif
|
||||
int ret = 0;
|
||||
// int ret = 0;
|
||||
RIG *rig = (RIG *)vrig;
|
||||
hamlib_port_t port;
|
||||
rig->state.rig_type = RIG_TYPE_TRANSCEIVER;
|
||||
|
@ -332,7 +332,8 @@ void *multicast_thread_rx(void *vrig)
|
|||
network_open(&port, 4532);
|
||||
#endif
|
||||
|
||||
while (rig->state.multicast->runflag && ret >= 0)
|
||||
//while (rig->state.multicast->runflag && ret >= 0)
|
||||
while (rig->state.multicast->runflag)
|
||||
{
|
||||
#if 0
|
||||
ret = read_string(&rig->state.rigport, (unsigned char *) buf, sizeof(buf), "\n", 1,
|
||||
|
|
43
src/rig.c
43
src/rig.c
|
@ -380,15 +380,12 @@ void add2debugmsgsave(const char *s)
|
|||
|
||||
if (p && strlen(p + 1) > 0)
|
||||
{
|
||||
if (strlen(p + 1) > 0)
|
||||
{
|
||||
strcpy(stmp, p + 1);
|
||||
strcpy(debugmsgsave, stmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
debugmsgsave[0] = '\0';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
debugmsgsave[0] = '\0';
|
||||
}
|
||||
|
||||
--nlines;
|
||||
|
@ -7325,28 +7322,24 @@ static void make_crc_table(unsigned long crcTable[])
|
|||
unsigned long POLYNOMIAL = 0xEDB88320;
|
||||
unsigned char b = 0;
|
||||
|
||||
do
|
||||
// Start with the data byte
|
||||
unsigned long remainder = b;
|
||||
|
||||
unsigned long bit;
|
||||
|
||||
for (bit = 8; bit > 0; --bit)
|
||||
{
|
||||
// Start with the data byte
|
||||
unsigned long remainder = b;
|
||||
|
||||
unsigned long bit;
|
||||
|
||||
for (bit = 8; bit > 0; --bit)
|
||||
if (remainder & 1)
|
||||
{
|
||||
if (remainder & 1)
|
||||
{
|
||||
remainder = (remainder >> 1) ^ POLYNOMIAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
remainder = (remainder >> 1);
|
||||
}
|
||||
remainder = (remainder >> 1) ^ POLYNOMIAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
remainder = (remainder >> 1);
|
||||
}
|
||||
|
||||
crcTable[(size_t)b] = remainder;
|
||||
}
|
||||
while (0 != ++b);
|
||||
|
||||
crcTable[(size_t)b] = remainder;
|
||||
}
|
||||
|
||||
static unsigned long crcTable[256];
|
||||
|
|
|
@ -1110,7 +1110,7 @@ int main(int argc, char *argv[])
|
|||
#endif
|
||||
}
|
||||
}
|
||||
while (retcode == 0 && !ctrl_c);
|
||||
while(!ctrl_c);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: while loop done\n", __func__);
|
||||
|
||||
|
|
|
@ -661,7 +661,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
hl_usleep(400 * 1000); // fairly fast to keep up
|
||||
}
|
||||
while (retcode == 0 && !ctrl_c);
|
||||
while (retval == 0 && !ctrl_c);
|
||||
|
||||
rig_close(my_rig); /* close port */
|
||||
rig_cleanup(my_rig); /* if you care about memory */
|
||||
|
|
|
@ -1096,7 +1096,7 @@ int main(int argc, char *argv[])
|
|||
#endif
|
||||
}
|
||||
}
|
||||
while (retcode == 0 && !ctrl_c);
|
||||
while (!ctrl_c);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: while loop done\n", __func__);
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue