kopia lustrzana https://github.com/Hamlib/Hamlib
Fix cppcheck warnings in yaesu
rodzic
ae1777f6e7
commit
9bc979a360
|
@ -326,15 +326,11 @@ const struct rig_caps ft100_caps =
|
|||
|
||||
int ft100_init(RIG *rig)
|
||||
{
|
||||
struct ft100_priv_data *priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
priv = (struct ft100_priv_data *) calloc(1, sizeof(struct ft100_priv_data));
|
||||
rig->state.priv = (struct ft100_priv_data *) calloc(1, sizeof(struct ft100_priv_data));
|
||||
|
||||
if (!priv) { return -RIG_ENOMEM; }
|
||||
|
||||
rig->state.priv = (void *)priv;
|
||||
if (!rig->state.priv) { return -RIG_ENOMEM; }
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -315,13 +315,15 @@ int ft1000d_init(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft1000d_priv_data *) calloc(1, sizeof(struct ft1000d_priv_data));
|
||||
rig->state.priv = (struct ft1000d_priv_data *) calloc(1, sizeof(struct ft1000d_priv_data));
|
||||
|
||||
if (!priv)
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
|
||||
// Copy native cmd set to private cmd storage area
|
||||
memcpy(priv->pcs, ncmd, sizeof(ncmd));
|
||||
|
||||
|
@ -335,8 +337,6 @@ int ft1000d_init(RIG *rig)
|
|||
priv->current_vfo = RIG_VFO_A;
|
||||
|
||||
|
||||
rig->state.priv = (void *)priv;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -242,15 +242,11 @@ const struct rig_caps ft600_caps =
|
|||
|
||||
int ft600_init(RIG *rig)
|
||||
{
|
||||
struct ft600_priv_data *priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
priv = (struct ft600_priv_data *) calloc(1, sizeof(struct ft600_priv_data));
|
||||
rig->state.priv = (struct ft600_priv_data *) calloc(1, sizeof(struct ft600_priv_data));
|
||||
|
||||
if (!priv) { return -RIG_ENOMEM; }
|
||||
|
||||
rig->state.priv = (void *)priv;
|
||||
if (!rig->state.priv) { return -RIG_ENOMEM; }
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -225,16 +225,16 @@ int ft736_open(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
||||
|
||||
priv = (struct ft736_priv_data *) calloc(1, sizeof(struct ft736_priv_data));
|
||||
rig->state.priv = (struct ft736_priv_data *) calloc(1, sizeof(struct ft736_priv_data));
|
||||
|
||||
if (!priv)
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
priv = rig->state.priv;
|
||||
|
||||
priv->split = RIG_SPLIT_OFF;
|
||||
|
||||
rig->state.priv = priv;
|
||||
|
||||
/* send Ext Cntl ON: Activate CAT */
|
||||
ret = write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH);
|
||||
|
|
|
@ -306,19 +306,15 @@ const struct rig_caps ft747_caps =
|
|||
|
||||
int ft747_init(RIG *rig)
|
||||
{
|
||||
struct ft747_priv_data *p;
|
||||
rig->state.priv = (struct ft747_priv_data *) calloc(1, sizeof(struct ft747_priv_data));
|
||||
|
||||
p = (struct ft747_priv_data *) calloc(1, sizeof(struct ft747_priv_data));
|
||||
|
||||
if (!p) /* whoops! memory shortage! */
|
||||
if (!rig->state.priv) /* whoops! memory shortage! */
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
|
||||
rig->state.priv = (void *)p;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -324,7 +324,7 @@ const struct rig_caps ft757gx2_caps =
|
|||
|
||||
int ft757_init(RIG *rig)
|
||||
{
|
||||
struct ft757_priv_data *p;
|
||||
struct ft757_priv_data *priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__);
|
||||
|
||||
|
@ -333,22 +333,23 @@ int ft757_init(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
p = (struct ft757_priv_data *) calloc(1, sizeof(struct ft757_priv_data));
|
||||
rig->state.priv = (struct ft757_priv_data *) calloc(1, sizeof(struct ft757_priv_data));
|
||||
|
||||
if (!p) /* whoops! memory shortage! */
|
||||
if (!rig->state.priv) /* whoops! memory shortage! */
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
p->curfreq = 1e6;
|
||||
priv = rig->state.priv;
|
||||
|
||||
priv->curfreq = 1e6;
|
||||
|
||||
/* TODO: read pacing from preferences */
|
||||
|
||||
p->pacing = FT757GX_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
|
||||
p->read_update_delay =
|
||||
priv->pacing = FT757GX_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
|
||||
priv->read_update_delay =
|
||||
FT757GX_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */
|
||||
p->current_vfo = RIG_VFO_A; /* default to VFO_A ? */
|
||||
rig->state.priv = (void *)p;
|
||||
priv->current_vfo = RIG_VFO_A; /* default to VFO_A ? */
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -389,34 +389,34 @@ const struct rig_caps ft767gx_caps =
|
|||
|
||||
int ft767_init(RIG *rig)
|
||||
{
|
||||
struct ft767_priv_data *p;
|
||||
struct ft767_priv_data *priv;
|
||||
|
||||
if (!rig)
|
||||
{
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
p = (struct ft767_priv_data *) calloc(1, sizeof(struct ft767_priv_data));
|
||||
rig->state.priv = (struct ft767_priv_data *) calloc(1, sizeof(struct ft767_priv_data));
|
||||
|
||||
if (!p) /* whoops! memory shortage! */
|
||||
if (!rig->state.priv) /* whoops! memory shortage! */
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
priv = rig->state.priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
||||
|
||||
/* TODO: read pacing from preferences */
|
||||
|
||||
p->pacing = FT767GX_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
|
||||
p->read_update_delay =
|
||||
priv->pacing = FT767GX_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
|
||||
priv->read_update_delay =
|
||||
FT767GX_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */
|
||||
p->current_vfo = RIG_VFO_A; /* default to VFO_A ? */
|
||||
p->ack_cmd[0] = 00;
|
||||
p->ack_cmd[1] = 00;
|
||||
p->ack_cmd[2] = 00;
|
||||
p->ack_cmd[3] = 00;
|
||||
p->ack_cmd[4] = 0x0B;
|
||||
rig->state.priv = (void *)p;
|
||||
priv->current_vfo = RIG_VFO_A; /* default to VFO_A ? */
|
||||
priv->ack_cmd[0] = 00;
|
||||
priv->ack_cmd[1] = 00;
|
||||
priv->ack_cmd[2] = 00;
|
||||
priv->ack_cmd[3] = 00;
|
||||
priv->ack_cmd[4] = 0x0B;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -301,19 +301,19 @@ const struct rig_caps ft817_caps =
|
|||
|
||||
int ft817_init(RIG *rig)
|
||||
{
|
||||
struct ft817_priv_data *p;
|
||||
struct ft817_priv_data *priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
|
||||
if ((p = calloc(1, sizeof(struct ft817_priv_data))) == NULL)
|
||||
if ((rig->state.priv = calloc(1, sizeof(struct ft817_priv_data))) == NULL)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
/* Copy complete native cmd set to private cmd storage area */
|
||||
memcpy(p->pcs, ncmd, sizeof(ncmd));
|
||||
priv = rig->state.priv;
|
||||
|
||||
rig->state.priv = (void *) p;
|
||||
/* Copy complete native cmd set to private cmd storage area */
|
||||
memcpy(priv->pcs, ncmd, sizeof(ncmd));
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -356,12 +356,13 @@ static int ft840_init(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft840_priv_data *) calloc(1, sizeof(struct ft840_priv_data));
|
||||
rig->state.priv = (struct ft840_priv_data *) calloc(1, sizeof(struct ft840_priv_data));
|
||||
|
||||
if (!priv) /* whoops! memory shortage! */
|
||||
if (!rig->state.priv) /* whoops! memory shortage! */
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
priv = rig->state.priv;
|
||||
|
||||
/*
|
||||
* Copy native cmd set to private cmd storage area
|
||||
|
@ -373,7 +374,6 @@ static int ft840_init(RIG *rig)
|
|||
priv->read_update_delay =
|
||||
FT840_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */
|
||||
priv->current_vfo = RIG_VFO_MAIN; /* default to whatever */
|
||||
rig->state.priv = (void *)priv;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -523,7 +523,7 @@ const struct rig_caps ft847uni_caps =
|
|||
|
||||
int ft847_init(RIG *rig)
|
||||
{
|
||||
struct ft847_priv_data *p;
|
||||
struct ft847_priv_data *priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called \n", __func__);
|
||||
|
||||
|
@ -532,24 +532,24 @@ int ft847_init(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
p = (struct ft847_priv_data *) calloc(1, sizeof(struct ft847_priv_data));
|
||||
rig->state.priv = (struct ft847_priv_data *) calloc(1, sizeof(struct ft847_priv_data));
|
||||
|
||||
if (!p)
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
priv = rig->state.priv;
|
||||
|
||||
|
||||
p->sat_mode = RIG_SPLIT_OFF;
|
||||
rig->state.priv = (void *)p;
|
||||
priv->sat_mode = RIG_SPLIT_OFF;
|
||||
|
||||
/* for early FT-847's we have our own memory items due to one way comm*/
|
||||
/* until these are set we won't know what the values are */
|
||||
p->freqA = 1; /* 1Hz default */
|
||||
p->freqB = 1; /* 1Hz default */
|
||||
p->mode = RIG_MODE_USB; /* mode USB by default to avoid users not setting mode */
|
||||
p->width = 1; /* 1Hz default */
|
||||
priv->freqA = 1; /* 1Hz default */
|
||||
priv->freqB = 1; /* 1Hz default */
|
||||
priv->mode = RIG_MODE_USB; /* mode USB by default to avoid users not setting mode */
|
||||
priv->width = 1; /* 1Hz default */
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -291,19 +291,19 @@ const struct rig_caps ft857_caps =
|
|||
|
||||
int ft857_init(RIG *rig)
|
||||
{
|
||||
struct ft857_priv_data *p;
|
||||
struct ft857_priv_data *priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
|
||||
|
||||
if ((p = calloc(1, sizeof(struct ft857_priv_data))) == NULL)
|
||||
if ((rig->state.priv = calloc(1, sizeof(struct ft857_priv_data))) == NULL)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
/* Copy complete native cmd set to private cmd storage area */
|
||||
memcpy(p->pcs, ncmd, sizeof(ncmd));
|
||||
priv = rig->state.priv;
|
||||
|
||||
rig->state.priv = (void *) p;
|
||||
/* Copy complete native cmd set to private cmd storage area */
|
||||
memcpy(priv->pcs, ncmd, sizeof(ncmd));
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -292,12 +292,13 @@ static int ft890_init(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft890_priv_data *) calloc(1, sizeof(struct ft890_priv_data));
|
||||
rig->state.priv = (struct ft890_priv_data *) calloc(1, sizeof(struct ft890_priv_data));
|
||||
|
||||
if (!priv) /* whoops! memory shortage! */
|
||||
if (!rig->state.priv) /* whoops! memory shortage! */
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
priv = rig->state.priv;
|
||||
|
||||
/*
|
||||
* Copy native cmd set to private cmd storage area
|
||||
|
@ -309,7 +310,6 @@ static int ft890_init(RIG *rig)
|
|||
priv->read_update_delay =
|
||||
FT890_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */
|
||||
priv->current_vfo = RIG_VFO_MAIN; /* default to whatever */
|
||||
rig->state.priv = (void *)priv;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -294,12 +294,13 @@ static int ft900_init(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft900_priv_data *) calloc(1, sizeof(struct ft900_priv_data));
|
||||
rig->state.priv = (struct ft900_priv_data *) calloc(1, sizeof(struct ft900_priv_data));
|
||||
|
||||
if (!priv) /* whoops! memory shortage! */
|
||||
if (!rig->state.priv) /* whoops! memory shortage! */
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
priv = rig->state.priv;
|
||||
|
||||
/*
|
||||
* Copy native cmd set to private cmd storage area
|
||||
|
@ -311,7 +312,6 @@ static int ft900_init(RIG *rig)
|
|||
priv->read_update_delay =
|
||||
FT900_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */
|
||||
priv->current_vfo = RIG_VFO_MAIN; /* default to whatever */
|
||||
rig->state.priv = (void *)priv;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -372,12 +372,13 @@ static int ft920_init(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft920_priv_data *) calloc(1, sizeof(struct ft920_priv_data));
|
||||
rig->state.priv = (struct ft920_priv_data *) calloc(1, sizeof(struct ft920_priv_data));
|
||||
|
||||
if (!priv)
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
return -RIG_ENOMEM; /* whoops! memory shortage! */
|
||||
}
|
||||
priv = rig->state.priv;
|
||||
|
||||
/*
|
||||
* Copy native cmd set to private cmd storage area
|
||||
|
@ -390,7 +391,6 @@ static int ft920_init(RIG *rig)
|
|||
priv->read_update_delay =
|
||||
FT920_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */
|
||||
priv->current_vfo = RIG_VFO_A; /* default to VFO_A */
|
||||
rig->state.priv = (void *)priv;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -300,13 +300,15 @@ int ft990_init(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
priv = (struct ft990_priv_data *) calloc(1, sizeof(struct ft990_priv_data));
|
||||
rig->state.priv = (struct ft990_priv_data *) calloc(1, sizeof(struct ft990_priv_data));
|
||||
|
||||
if (!priv)
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
|
||||
// Copy native cmd set to private cmd storage area
|
||||
memcpy(priv->pcs, ncmd, sizeof(ncmd));
|
||||
|
||||
|
@ -320,8 +322,6 @@ int ft990_init(RIG *rig)
|
|||
priv->current_vfo = RIG_VFO_MAIN;
|
||||
|
||||
|
||||
rig->state.priv = (void *)priv;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -287,13 +287,15 @@ int newcat_init(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
priv = (struct newcat_priv_data *) calloc(1, sizeof(struct newcat_priv_data));
|
||||
rig->state.priv = (struct newcat_priv_data *) calloc(1, sizeof(struct newcat_priv_data));
|
||||
|
||||
if (!priv) /* whoops! memory shortage! */
|
||||
if (!rig->state.priv) /* whoops! memory shortage! */
|
||||
{
|
||||
return -RIG_ENOMEM;
|
||||
}
|
||||
|
||||
priv = rig->state.priv;
|
||||
|
||||
/* TODO: read pacing from preferences */
|
||||
// priv->pacing = NEWCAT_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
|
||||
priv->read_update_delay =
|
||||
|
@ -302,8 +304,6 @@ int newcat_init(RIG *rig)
|
|||
// priv->current_vfo = RIG_VFO_MAIN; /* default to whatever */
|
||||
// priv->current_vfo = RIG_VFO_A;
|
||||
|
||||
rig->state.priv = (void *)priv;
|
||||
|
||||
priv->rig_id = NC_RIGID_NONE;
|
||||
priv->current_mem = NC_MEM_CHANNEL_NONE;
|
||||
priv->fast_set_commands = FALSE;
|
||||
|
|
|
@ -247,13 +247,9 @@ struct vr5000_priv_data
|
|||
|
||||
int vr5000_init(RIG *rig)
|
||||
{
|
||||
struct vr5000_priv_data *priv;
|
||||
rig->state.priv = (struct vr5000_priv_data *) calloc(1, sizeof(struct vr5000_priv_data));
|
||||
|
||||
priv = (struct vr5000_priv_data *) calloc(1, sizeof(struct vr5000_priv_data));
|
||||
|
||||
if (!priv) { return -RIG_ENOMEM; }
|
||||
|
||||
rig->state.priv = (void *)priv;
|
||||
if (!rig->state.priv) { return -RIG_ENOMEM; }
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -601,12 +601,12 @@ static int vx1700_init(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__);
|
||||
|
||||
priv = calloc(1, sizeof(struct vx1700_priv_data));
|
||||
rig->state.priv = calloc(1, sizeof(struct vx1700_priv_data));
|
||||
|
||||
if (priv == NULL) { return -RIG_ENOMEM; }
|
||||
if (rig->state.priv == NULL) { return -RIG_ENOMEM; }
|
||||
priv = rig->state.priv;
|
||||
|
||||
priv->ch = 1;
|
||||
rig->state.priv = (rig_ptr_t)priv;
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue