From bf1a05084da8456cb06d22cc2aa6155eb407fe0d Mon Sep 17 00:00:00 2001 From: mdblack98 Date: Sun, 3 May 2020 17:24:42 -0500 Subject: [PATCH] astyle files --- dummy/netrigctl.c | 2 +- rigs/aor/aor.c | 6 ++++-- rigs/aor/ar3030.c | 6 ++++-- rigs/aor/ar7030p.c | 6 ++++-- rigs/icom/ic746.c | 6 ++++-- rigs/icom/icr75.c | 6 ++++-- rigs/kenwood/ic10.c | 6 ++++-- rigs/kenwood/kenwood.c | 25 ++++++++++++++++++------- rigs/kenwood/pihpsdr.c | 6 ++++-- rigs/kenwood/th.c | 6 ++++-- rigs/kenwood/thd72.c | 6 ++++-- rigs/kenwood/thd74.c | 6 ++++-- rigs/kenwood/tmd710.c | 6 ++++-- rigs/kenwood/tmv7.c | 6 ++++-- rigs/kenwood/ts2000.c | 6 ++++-- rigs/prm80/prm80.c | 6 ++++-- rigs/uniden/uniden.c | 6 ++++-- rigs/yaesu/ft1000d.c | 6 ++++-- rigs/yaesu/ft990.c | 6 ++++-- rigs/yaesu/ft991.c | 24 ++++++++++++------------ rigs/yaesu/newcat.c | 5 ++++- src/conf.c | 6 +++--- src/misc.c | 19 ++++++++++++------- src/rig.c | 7 +++++-- tests/cachetest.c | 3 ++- tests/rigctld.c | 3 ++- 26 files changed, 127 insertions(+), 69 deletions(-) diff --git a/dummy/netrigctl.c b/dummy/netrigctl.c index b6b7ca92b..616cb6948 100644 --- a/dummy/netrigctl.c +++ b/dummy/netrigctl.c @@ -564,7 +564,7 @@ static int netrigctl_close(RIG *rig) } rig_debug(RIG_DEBUG_ERR, "%s: done status=%s\n", __func__, rigerror(ret)); - usleep(10*1000); + usleep(10 * 1000); return RIG_OK; } diff --git a/rigs/aor/aor.c b/rigs/aor/aor.c index db292a807..a95457401 100644 --- a/rigs/aor/aor.c +++ b/rigs/aor/aor.c @@ -1331,8 +1331,10 @@ int aor_get_channel(RIG *rig, channel_t *chan, int read_only) retval = parse_chan_line(rig, chan, chanbuf, mem_caps); #warning Need to add setting rig to channel values - if (!read_only) { - // Set rig to channel values + + if (!read_only) + { + // Set rig to channel values } return retval; diff --git a/rigs/aor/ar3030.c b/rigs/aor/ar3030.c index 5adea08ef..67f09f5b2 100644 --- a/rigs/aor/ar3030.c +++ b/rigs/aor/ar3030.c @@ -806,8 +806,10 @@ int ar3030_get_channel(RIG *rig, channel_t *chan, int read_only) chan->flags = infobuf[4] == '1' ? RIG_CHFLAG_SKIP : RIG_CHFLAG_NONE; #warning Need to add setting rig to channel values - if (!read_only) { - // Set rig to channel values + + if (!read_only) + { + // Set rig to channel values } return RIG_OK; diff --git a/rigs/aor/ar7030p.c b/rigs/aor/ar7030p.c index 89d621613..9c449335d 100644 --- a/rigs/aor/ar7030p.c +++ b/rigs/aor/ar7030p.c @@ -1755,8 +1755,10 @@ static int ar7030p_get_channel(RIG *rig, channel_t *chan, int read_only) } #warning Need to add setting rig to channel values - if (!read_only) { - // Set rig to channel values + + if (!read_only) + { + // Set rig to channel values } return (rc); diff --git a/rigs/icom/ic746.c b/rigs/icom/ic746.c index c6953ecff..8fae70865 100644 --- a/rigs/icom/ic746.c +++ b/rigs/icom/ic746.c @@ -1054,8 +1054,10 @@ int ic746pro_get_channel(RIG *rig, channel_t *chan, int read_only) } #warning Need to add setting rig to channel values - if (!read_only) { - // Set rig to channel values + + if (!read_only) + { + // Set rig to channel values } return RIG_OK; diff --git a/rigs/icom/icr75.c b/rigs/icom/icr75.c index 719368391..713bc886d 100644 --- a/rigs/icom/icr75.c +++ b/rigs/icom/icr75.c @@ -417,8 +417,10 @@ int icr75_get_channel(RIG *rig, channel_t *chan, int read_only) } #warning Need to add setting rig to channel values - if (!read_only) { - // Set rig to channel values + + if (!read_only) + { + // Set rig to channel values } return RIG_OK; diff --git a/rigs/kenwood/ic10.c b/rigs/kenwood/ic10.c index 3e9c912dc..844942e66 100644 --- a/rigs/kenwood/ic10.c +++ b/rigs/kenwood/ic10.c @@ -718,8 +718,10 @@ int ic10_get_channel(RIG *rig, channel_t *chan, int read_only) } #warning Need to add setting rig to channel values - if (!read_only) { - // Set rig to channel values + + if (!read_only) + { + // Set rig to channel values } return RIG_OK; diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 86aaee904..dc3c0ff15 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -265,14 +265,17 @@ int kenwood_transaction(RIG *rig, const char *cmdstr, char *data, if (cache_age_ms < 500) // 500ms cache time { rig_debug(RIG_DEBUG_TRACE, "%s: cache hit, age=%dms\n", __func__, cache_age_ms); - if (data) strncpy(data, priv->last_if_response, datasize); + + if (data) { strncpy(data, priv->last_if_response, datasize); } + return RIG_OK; } // else we drop through and do the real IF command } - if (strlen(cmdstr) > 2 || strcmp(cmdstr,"RX")==0 || strcmp(cmdstr,"TX") == 0) + if (strlen(cmdstr) > 2 || strcmp(cmdstr, "RX") == 0 + || strcmp(cmdstr, "TX") == 0) { // then we must be setting something so we'll invalidate the cache rig_debug(RIG_DEBUG_TRACE, "%s: cache invalidated\n", __func__); @@ -494,12 +497,16 @@ transaction_read: // seems some rigs will send back an IF response to RX/TX when it changes the status // normally RX/TX returns nothing when it's a null effect // TS-950SDX is known to behave this way - if (strncmp(cmdstr,"RX",2)==0 || strncmp(cmdstr,"TX",2)==0) { - if (strncmp(priv->verify_cmd,"IF",2)==0) { - rig_debug(RIG_DEBUG_TRACE,"%s: RX/TX got IF response so we're good\n", __func__); + if (strncmp(cmdstr, "RX", 2) == 0 || strncmp(cmdstr, "TX", 2) == 0) + { + if (strncmp(priv->verify_cmd, "IF", 2) == 0) + { + rig_debug(RIG_DEBUG_TRACE, "%s: RX/TX got IF response so we're good\n", + __func__); goto transaction_quit; } } + if (priv->verify_cmd[0] != buffer[0] || (priv->verify_cmd[1] && priv->verify_cmd[1] != buffer[1])) { @@ -699,10 +706,12 @@ int kenwood_open(RIG *rig) err = kenwood_get_id(rig, id); - if (err == RIG_OK) { // some rigs give ID while in standby + if (err == RIG_OK) // some rigs give ID while in standby + { powerstat_t powerstat = 0; rig_debug(RIG_DEBUG_TRACE, "%s: got ID so try PS\n", __func__); err = rig_get_powerstat(rig, &powerstat); + if (err == RIG_OK && powerstat == 0) { rig_debug(RIG_DEBUG_TRACE, "%s: got PS0 so powerup\n", __func__); @@ -716,9 +725,11 @@ int kenwood_open(RIG *rig) rig_set_powerstat(rig, 1); /* Try get id again */ err = kenwood_get_id(rig, id); + if (RIG_OK != err) { - rig_debug(RIG_DEBUG_ERR, "%s: no response to get_id from rig...contintuing anyways.\n", __func__); + rig_debug(RIG_DEBUG_ERR, + "%s: no response to get_id from rig...contintuing anyways.\n", __func__); } } diff --git a/rigs/kenwood/pihpsdr.c b/rigs/kenwood/pihpsdr.c index cdd4fd348..eb1e61d75 100644 --- a/rigs/kenwood/pihpsdr.c +++ b/rigs/kenwood/pihpsdr.c @@ -567,8 +567,10 @@ int pihspdr_get_channel(RIG *rig, channel_t *chan, int read_only) } #warning Need to add setting rig to channel values - if (!read_only) { - // Set rig to channel values + + if (!read_only) + { + // Set rig to channel values } return RIG_OK; diff --git a/rigs/kenwood/th.c b/rigs/kenwood/th.c index c67380055..0cdf16d0b 100644 --- a/rigs/kenwood/th.c +++ b/rigs/kenwood/th.c @@ -2227,8 +2227,10 @@ int th_get_channel(RIG *rig, channel_t *chan, int read_only) } #warning Need to add setting rig to channel values - if (!read_only) { - // Set rig to channel values + + if (!read_only) + { + // Set rig to channel values } return RIG_OK; diff --git a/rigs/kenwood/thd72.c b/rigs/kenwood/thd72.c index 6eeb5633d..1bf4c60e6 100644 --- a/rigs/kenwood/thd72.c +++ b/rigs/kenwood/thd72.c @@ -1408,8 +1408,10 @@ static int thd72_get_channel(RIG *rig, channel_t *chan, int read_only) } #warning Need to add setting rig to channel values - if (!read_only) { - // Set rig to channel values + + if (!read_only) + { + // Set rig to channel values } return RIG_OK; diff --git a/rigs/kenwood/thd74.c b/rigs/kenwood/thd74.c index 6bedae71e..63294bcb3 100644 --- a/rigs/kenwood/thd74.c +++ b/rigs/kenwood/thd74.c @@ -1325,8 +1325,10 @@ static int thd74_get_channel(RIG *rig, channel_t *chan, int read_only) } #warning Need to add setting rig to channel values - if (!read_only) { - // Set rig to channel values + + if (!read_only) + { + // Set rig to channel values } return RIG_OK; diff --git a/rigs/kenwood/tmd710.c b/rigs/kenwood/tmd710.c index b1d013f97..031cf6140 100644 --- a/rigs/kenwood/tmd710.c +++ b/rigs/kenwood/tmd710.c @@ -1934,8 +1934,10 @@ int tmd710_get_channel(RIG *rig, channel_t *chan, int read_only) chan->ext_levels = NULL; #warning Need to add setting rig to channel values - if (!read_only) { - // Set rig to channel values + + if (!read_only) + { + // Set rig to channel values } return RIG_OK; diff --git a/rigs/kenwood/tmv7.c b/rigs/kenwood/tmv7.c index 4e424ab23..cd6a51bfc 100644 --- a/rigs/kenwood/tmv7.c +++ b/rigs/kenwood/tmv7.c @@ -650,8 +650,10 @@ int tmv7_get_channel(RIG *rig, channel_t *chan, int read_only) } #warning Need to add setting rig to channel values - if (!read_only) { - // Set rig to channel values + + if (!read_only) + { + // Set rig to channel values } return RIG_OK; diff --git a/rigs/kenwood/ts2000.c b/rigs/kenwood/ts2000.c index 36c933bf5..915437f7f 100644 --- a/rigs/kenwood/ts2000.c +++ b/rigs/kenwood/ts2000.c @@ -594,8 +594,10 @@ int ts2000_get_channel(RIG *rig, channel_t *chan, int read_only) } #warning Need to add setting rig to channel values - if (!read_only) { - // Set rig to channel values + + if (!read_only) + { + // Set rig to channel values } return RIG_OK; diff --git a/rigs/prm80/prm80.c b/rigs/prm80/prm80.c index 0eab18513..fef821aa2 100644 --- a/rigs/prm80/prm80.c +++ b/rigs/prm80/prm80.c @@ -330,8 +330,10 @@ int prm80_get_channel(RIG *rig, channel_t *chan, int read_only) chan->rptr_offs = chan->tx_freq - chan->freq; #warning Need to add setting rig to channel values - if (!read_only) { - // Set rig to channel values + + if (!read_only) + { + // Set rig to channel values } return RIG_OK; diff --git a/rigs/uniden/uniden.c b/rigs/uniden/uniden.c index 3153ecf3f..bacadae64 100644 --- a/rigs/uniden/uniden.c +++ b/rigs/uniden/uniden.c @@ -642,8 +642,10 @@ int uniden_get_channel(RIG *rig, channel_t *chan, int read_only) } #warning Need to add setting rig to channel values - if (!read_only) { - // Set rig to channel values + + if (!read_only) + { + // Set rig to channel values } return RIG_OK; diff --git a/rigs/yaesu/ft1000d.c b/rigs/yaesu/ft1000d.c index d57ab4321..0c9e77612 100644 --- a/rigs/yaesu/ft1000d.c +++ b/rigs/yaesu/ft1000d.c @@ -3169,8 +3169,10 @@ int ft1000d_get_channel(RIG *rig, channel_t *chan, int read_only) } #warning Need to add setting rig to channel values - if (!read_only) { - // Set rig to channel values + + if (!read_only) + { + // Set rig to channel values } return RIG_OK; diff --git a/rigs/yaesu/ft990.c b/rigs/yaesu/ft990.c index 828fdbafc..2c6ac2551 100644 --- a/rigs/yaesu/ft990.c +++ b/rigs/yaesu/ft990.c @@ -3116,8 +3116,10 @@ int ft990_get_channel(RIG *rig, channel_t *chan, int read_only) } #warning Need to add setting rig to channel values - if (!read_only) { - // Set rig to channel values + + if (!read_only) + { + // Set rig to channel values } return RIG_OK; diff --git a/rigs/yaesu/ft991.c b/rigs/yaesu/ft991.c index f27f76c9d..de97d1a5e 100644 --- a/rigs/yaesu/ft991.c +++ b/rigs/yaesu/ft991.c @@ -383,29 +383,29 @@ static void debug_ft991info_data(const ft991info *rdata) { rig_debug(RIG_DEBUG_VERBOSE, "%s command %2.2s\n", - __func__, rdata->command); + __func__, rdata->command); rig_debug(RIG_DEBUG_VERBOSE, "%s memory_ch %3.3s\n", - __func__, rdata->memory_ch); + __func__, rdata->memory_ch); rig_debug(RIG_DEBUG_VERBOSE, "%s vfo_freq %9.9s\n", - __func__, rdata->vfo_freq); + __func__, rdata->vfo_freq); rig_debug(RIG_DEBUG_VERBOSE, "%s clarifier %5.5s\n", - __func__, rdata->clarifier); + __func__, rdata->clarifier); rig_debug(RIG_DEBUG_VERBOSE, "%s rx_clarifier %c\n", - __func__, rdata->rx_clarifier); + __func__, rdata->rx_clarifier); rig_debug(RIG_DEBUG_VERBOSE, "%s tx_clarifier %c\n", - __func__, rdata->tx_clarifier); + __func__, rdata->tx_clarifier); rig_debug(RIG_DEBUG_VERBOSE, "%s mode %c\n", - __func__, rdata->mode); + __func__, rdata->mode); rig_debug(RIG_DEBUG_VERBOSE, "%s vfo_memory %c\n", - __func__, rdata->vfo_memory); + __func__, rdata->vfo_memory); rig_debug(RIG_DEBUG_VERBOSE, "%s tone_mode %c\n", - __func__, rdata->tone_mode); + __func__, rdata->tone_mode); rig_debug(RIG_DEBUG_VERBOSE, "%s fixed %2.2s\n", - __func__, rdata->fixed); + __func__, rdata->fixed); rig_debug(RIG_DEBUG_VERBOSE, "%s repeater_offset %c\n", - __func__, rdata->repeater_offset); + __func__, rdata->repeater_offset); rig_debug(RIG_DEBUG_VERBOSE, "%s terminator %c\n", - __func__, rdata->terminator); + __func__, rdata->terminator); } diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 0bfe42995..971e26f41 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -5955,9 +5955,12 @@ int newcat_get_cmd(RIG *rig) strcpy(priv->ret_data, priv->last_if_response); return RIG_OK; } + // we drop through and do the real IF command } - if (priv->cmd_str[2] != ';') // then we must be setting something so we'll invalidate the cache + + if (priv->cmd_str[2] != + ';') // then we must be setting something so we'll invalidate the cache { rig_debug(RIG_DEBUG_TRACE, "%s: cache invalidated\n", __func__); priv->cache_start.tv_sec = 0; diff --git a/src/conf.c b/src/conf.c index f724bda7b..f343f8db5 100644 --- a/src/conf.c +++ b/src/conf.c @@ -549,7 +549,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val) break; case TOK_CACHE_TIMEOUT: - rig_set_cache_timeout_ms(rig,CACHE_ALL,atol(val)); + rig_set_cache_timeout_ms(rig, CACHE_ALL, atol(val)); break; default: @@ -857,11 +857,11 @@ static int frontend_get_conf(RIG *rig, token_t token, char *val) break; case TOK_LO_FREQ: - sprintf(val,"%g", rs->lo_freq); + sprintf(val, "%g", rs->lo_freq); break; case TOK_CACHE_TIMEOUT: - sprintf(val,"%d", rig_get_cache_timeout_ms(rig, CACHE_ALL)); + sprintf(val, "%d", rig_get_cache_timeout_ms(rig, CACHE_ALL)); break; default: diff --git a/src/misc.c b/src/misc.c index 6a576c338..a43f5f6e6 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1260,7 +1260,8 @@ int HAMLIB_API elapsed_ms(struct timespec *start, int option) struct timespec stop; double elapsed_msec; - if (option == ELAPSED_SET) { + if (option == ELAPSED_SET) + { start->tv_sec = start->tv_nsec = 0; } @@ -1271,10 +1272,12 @@ int HAMLIB_API elapsed_ms(struct timespec *start, int option) switch (option) { case ELAPSED_GET: - if (start->tv_nsec == 0) { // if we haven't done SET yet + if (start->tv_nsec == 0) // if we haven't done SET yet + { clock_gettime(CLOCK_REALTIME, start); - return 1000 * 1000; + return 1000 * 1000; } + clock_gettime(CLOCK_REALTIME, &stop); break; @@ -1285,12 +1288,14 @@ int HAMLIB_API elapsed_ms(struct timespec *start, int option) return 999 * 1000; // so we can tell the difference in debug where we came from break; - case ELAPSED_INVALIDATE: - start->tv_sec -= 3600*24*365; // let's back off 1 year -- should expire most elapsed measurements + case ELAPSED_INVALIDATE: + start->tv_sec -= 3600 * 24 * + 365; // let's back off 1 year -- should expire most elapsed measurements break; } - elapsed_msec = ((stop.tv_sec - start->tv_sec) + (stop.tv_nsec/1e9 - - start->tv_nsec/1e9)) * 1e3; + + elapsed_msec = ((stop.tv_sec - start->tv_sec) + (stop.tv_nsec / 1e9 - + start->tv_nsec / 1e9)) * 1e3; rig_debug(RIG_DEBUG_TRACE, "%s: elapsed_secs=%g\n", __func__, elapsed_msec); diff --git a/src/rig.c b/src/rig.c index 0f6995201..d1bdd3def 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1345,7 +1345,9 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) } else { - rig_debug(RIG_DEBUG_TRACE, "%s: cache miss age=%dms, cached_vfo=%s, asked_vfo=%s\n", __func__, cache_ms, rig_strvfo(rig->state.cache.vfo_freq), rig_strvfo(vfo)); + rig_debug(RIG_DEBUG_TRACE, + "%s: cache miss age=%dms, cached_vfo=%s, asked_vfo=%s\n", __func__, cache_ms, + rig_strvfo(rig->state.cache.vfo_freq), rig_strvfo(vfo)); } caps = rig->caps; @@ -1820,7 +1822,8 @@ int HAMLIB_API rig_set_vfo(RIG *rig, vfo_t vfo) elapsed_ms(&rig->state.cache.time_freq, ELAPSED_INVALIDATE); elapsed_ms(&rig->state.cache.time_mode, ELAPSED_INVALIDATE); - rig_debug(RIG_DEBUG_TRACE, "%s: return %d, vfo=%s\n", __func__, retcode, rig_strvfo(vfo)); + rig_debug(RIG_DEBUG_TRACE, "%s: return %d, vfo=%s\n", __func__, retcode, + rig_strvfo(vfo)); return retcode; } diff --git a/tests/cachetest.c b/tests/cachetest.c index 57f33a32a..87e14aa1d 100644 --- a/tests/cachetest.c +++ b/tests/cachetest.c @@ -130,7 +130,8 @@ int main(int argc, char *argv[]) if (retcode != RIG_OK) { printf("Get mode failed?? Err=%s\n", rigerror(retcode)); } - printf("%4dms: Current mode = %s, width = %ld\n", elapsed_ms(&start, ELAPSED_GET), + printf("%4dms: Current mode = %s, width = %ld\n", elapsed_ms(&start, + ELAPSED_GET), rig_strrmode(mode), width); elapsed_ms(&start, ELAPSED_SET); diff --git a/tests/rigctld.c b/tests/rigctld.c index f4e713f8f..442261c04 100644 --- a/tests/rigctld.c +++ b/tests/rigctld.c @@ -969,7 +969,8 @@ void *handle_socket(void *arg) if (!fsockin) { - rig_debug(RIG_DEBUG_ERR, "fdopen(0x%d) in: %s\n", handle_data_arg->sock, strerror(errno)); + rig_debug(RIG_DEBUG_ERR, "fdopen(0x%d) in: %s\n", handle_data_arg->sock, + strerror(errno)); goto handle_exit; }