kopia lustrzana https://github.com/Hamlib/Hamlib
Fix error return values
All constant error values RIG_E* should be negated when returned. Found with: grep -nrE RETURNFUNC.?.RIG_E.+ --include=*.{c,h} | grep -v \-pull/1729/head
rodzic
56eea198be
commit
1e7b1a628e
|
@ -293,7 +293,7 @@ static int aclog_transaction(RIG *rig, char *cmd, char *value,
|
|||
}
|
||||
|
||||
// we get an unknown response if function does not exist
|
||||
if (strstr(xml, "UNKNOWN")) { set_transaction_inactive(rig); RETURNFUNC(RIG_ENAVAIL); }
|
||||
if (strstr(xml, "UNKNOWN")) { set_transaction_inactive(rig); RETURNFUNC(-RIG_ENAVAIL); }
|
||||
|
||||
if (value) { strncpy(value, xml, value_len); }
|
||||
|
||||
|
@ -304,7 +304,7 @@ static int aclog_transaction(RIG *rig, char *cmd, char *value,
|
|||
if (value && strlen(value) == 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: no value returned\n", __func__);
|
||||
set_transaction_inactive(rig); RETURNFUNC(RIG_EPROTO);
|
||||
set_transaction_inactive(rig); RETURNFUNC(-RIG_EPROTO);
|
||||
}
|
||||
|
||||
ELAPSED2;
|
||||
|
@ -646,7 +646,7 @@ static int aclog_open(RIG *rig)
|
|||
if (retval != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: aclog_get_freq not working!!\n", __func__);
|
||||
RETURNFUNC(RIG_EPROTO);
|
||||
RETURNFUNC(-RIG_EPROTO);
|
||||
}
|
||||
|
||||
STATE(rig)->current_vfo = RIG_VFO_A;
|
||||
|
|
|
@ -610,9 +610,9 @@ static int flrig_transaction(RIG *rig, char *cmd, char *cmd_arg, char *value,
|
|||
read_transaction(rig, xml, sizeof(xml)); // this might time out -- that's OK
|
||||
|
||||
// we get an unknown response if function does not exist
|
||||
if (strstr(xml, "unknown")) { set_transaction_inactive(rig); RETURNFUNC(RIG_ENAVAIL); }
|
||||
if (strstr(xml, "unknown")) { set_transaction_inactive(rig); RETURNFUNC(-RIG_ENAVAIL); }
|
||||
|
||||
if (strstr(xml, "get_bw") && strstr(xml, "NONE")) { set_transaction_inactive(rig); RETURNFUNC(RIG_ENAVAIL); }
|
||||
if (strstr(xml, "get_bw") && strstr(xml, "NONE")) { set_transaction_inactive(rig); RETURNFUNC(-RIG_ENAVAIL); }
|
||||
|
||||
if (value)
|
||||
{
|
||||
|
@ -625,7 +625,7 @@ static int flrig_transaction(RIG *rig, char *cmd, char *cmd_arg, char *value,
|
|||
if (value && strlen(value) == 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: no value returned\n", __func__);
|
||||
set_transaction_inactive(rig); RETURNFUNC(RIG_EPROTO);
|
||||
set_transaction_inactive(rig); RETURNFUNC(-RIG_EPROTO);
|
||||
}
|
||||
|
||||
ELAPSED2;
|
||||
|
@ -919,7 +919,7 @@ static int flrig_open(RIG *rig)
|
|||
if (retval != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: flrig_get_freq not working!!\n", __func__);
|
||||
RETURNFUNC(RIG_EPROTO);
|
||||
RETURNFUNC(-RIG_EPROTO);
|
||||
}
|
||||
|
||||
/* see if get_bwA is available */
|
||||
|
|
|
@ -254,7 +254,7 @@ static int sdrsharp_transaction(RIG *rig, char *cmd, char *value,
|
|||
if (value && strlen(value) == 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: no value returned\n", __func__);
|
||||
set_transaction_inactive(rig); RETURNFUNC(RIG_EPROTO);
|
||||
set_transaction_inactive(rig); RETURNFUNC(-RIG_EPROTO);
|
||||
}
|
||||
|
||||
ELAPSED2;
|
||||
|
@ -395,7 +395,7 @@ static int sdrsharp_open(RIG *rig)
|
|||
if (retval != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: sdrsharp_get_freq not working!!\n", __func__);
|
||||
RETURNFUNC(RIG_EPROTO);
|
||||
RETURNFUNC(-RIG_EPROTO);
|
||||
}
|
||||
|
||||
STATE(rig)->current_vfo = RIG_VFO_A;
|
||||
|
|
|
@ -407,7 +407,7 @@ static int tci1x_transaction(RIG *rig, char *cmd, char *cmd_arg, char *value,
|
|||
while ((value && (strlen(value) == 0))
|
||||
&& retry--); // we'll do retries if needed
|
||||
|
||||
if (value && strlen(value) == 0) { RETURNFUNC(RIG_EPROTO); }
|
||||
if (value && strlen(value) == 0) { RETURNFUNC(-RIG_EPROTO); }
|
||||
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
|
|
@ -9820,7 +9820,7 @@ static int get_roofing_filter(RIG *rig, vfo_t vfo,
|
|||
"%s: Expected a valid roofing filter but got %c from '%s'\n", __func__,
|
||||
roofing_filter_choice, priv->ret_data);
|
||||
|
||||
RETURNFUNC(RIG_EPROTO);
|
||||
RETURNFUNC(-RIG_EPROTO);
|
||||
}
|
||||
|
||||
int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width)
|
||||
|
|
|
@ -8044,7 +8044,7 @@ int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len)
|
|||
rig_debug(RIG_DEBUG_ERR, "%s(%d): response len exceeded max %d chars\n",
|
||||
__FILE__, __LINE__, max_response_len);
|
||||
ELAPSED2;
|
||||
RETURNFUNC2(RIG_EINTERNAL);
|
||||
RETURNFUNC2(-RIG_EINTERNAL);
|
||||
}
|
||||
|
||||
ELAPSED2;
|
||||
|
|
Ładowanie…
Reference in New Issue