kopia lustrzana https://github.com/Hamlib/Hamlib
Fix sign of error return values
All RIG_E* constants should be negated when returned or compared. Change the usages of RIG_IS_SOFT_ERRCODE() for consistency.pull/1751/head
rodzic
355d237ffe
commit
72bde6e131
|
@ -222,10 +222,10 @@ enum rig_errcode_e {
|
|||
* Soft errors are caused by invalid parameters and software/hardware features
|
||||
* and cannot be fixed by retries or by re-initializing hardware.
|
||||
*/
|
||||
#define RIG_IS_SOFT_ERRCODE(errcode) (errcode == RIG_EINVAL || errcode == RIG_ENIMPL || errcode == RIG_ERJCTED \
|
||||
|| errcode == RIG_ETRUNC || errcode == RIG_ENAVAIL || errcode == RIG_ENTARGET \
|
||||
|| errcode == RIG_EVFO || errcode == RIG_EDOM || errcode == RIG_EDEPRECATED \
|
||||
|| errcode == RIG_ESECURITY || errcode == RIG_EPOWER)
|
||||
#define RIG_IS_SOFT_ERRCODE(errcode) (errcode == -RIG_EINVAL || errcode == -RIG_ENIMPL || errcode == -RIG_ERJCTED \
|
||||
|| errcode == -RIG_ETRUNC || errcode == -RIG_ENAVAIL || errcode == -RIG_ENTARGET \
|
||||
|| errcode == -RIG_EVFO || errcode == -RIG_EDOM || errcode == -RIG_EDEPRECATED \
|
||||
|| errcode == -RIG_ESECURITY || errcode == -RIG_EPOWER)
|
||||
|
||||
/**
|
||||
* \brief Token in the netrigctl protocol for returning error code
|
||||
|
|
|
@ -816,7 +816,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
// if we get a hard error we try to reopen the rig again
|
||||
// this should cover short dropouts that can occur
|
||||
if (retcode < 0 && !RIG_IS_SOFT_ERRCODE(-retcode))
|
||||
if (retcode < 0 && !RIG_IS_SOFT_ERRCODE(retcode))
|
||||
{
|
||||
int retry = 3;
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: i/o error\n", __func__);
|
||||
|
@ -833,7 +833,7 @@ int main(int argc, char *argv[])
|
|||
while (retry-- > 0 && retcode != RIG_OK);
|
||||
}
|
||||
}
|
||||
while (!ctrl_c && (retcode == RIG_OK || RIG_IS_SOFT_ERRCODE(-retcode)));
|
||||
while (!ctrl_c && (retcode == RIG_OK || RIG_IS_SOFT_ERRCODE(retcode)));
|
||||
|
||||
if (interactive && prompt)
|
||||
{
|
||||
|
|
|
@ -1282,7 +1282,7 @@ void *handle_socket(void *arg)
|
|||
|
||||
// if we get a hard error we try to reopen the rig again
|
||||
// this should cover short dropouts that can occur
|
||||
if (retcode < 0 && !RIG_IS_SOFT_ERRCODE(-retcode))
|
||||
if (retcode < 0 && !RIG_IS_SOFT_ERRCODE(retcode))
|
||||
{
|
||||
int retry = 3;
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: i/o error\n", __func__);
|
||||
|
@ -1312,7 +1312,7 @@ void *handle_socket(void *arg)
|
|||
while (!ctrl_c && !rig_opened && retry-- > 0 && retcode != RIG_OK);
|
||||
}
|
||||
}
|
||||
while (!ctrl_c && (retcode == RIG_OK || RIG_IS_SOFT_ERRCODE(-retcode)));
|
||||
while (!ctrl_c && (retcode == RIG_OK || RIG_IS_SOFT_ERRCODE(retcode)));
|
||||
|
||||
#if defined(HAVE_PTHREAD)
|
||||
|
||||
|
|
|
@ -1283,7 +1283,7 @@ void *handle_socket(void *arg)
|
|||
|
||||
// if we get a hard error we try to reopen the rig again
|
||||
// this should cover short dropouts that can occur
|
||||
if (retcode < 0 && !RIG_IS_SOFT_ERRCODE(-retcode))
|
||||
if (retcode < 0 && !RIG_IS_SOFT_ERRCODE(retcode))
|
||||
{
|
||||
int retry = 3;
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: i/o error\n", __func__);
|
||||
|
@ -1313,7 +1313,7 @@ void *handle_socket(void *arg)
|
|||
while (!ctrl_c && !rig_opened && retry-- > 0 && retcode != RIG_OK);
|
||||
}
|
||||
}
|
||||
while (!ctrl_c && (retcode == RIG_OK || RIG_IS_SOFT_ERRCODE(-retcode)));
|
||||
while (!ctrl_c && (retcode == RIG_OK || RIG_IS_SOFT_ERRCODE(retcode)));
|
||||
|
||||
client_done:
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue