Skip to content

Commit 7123bb4

Browse files
committed
Change rmode_t to uint64_t and remove unneeded casts
1 parent e15b255 commit 7123bb4

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

dummy/netrigctl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static int netrigctl_open(RIG *rig)
116116
ret = num_sscanf(buf, "%"SCNfreq"%"SCNfreq"%"SCNXll"%d%d%x%x",
117117
&rs->rx_range_list[i].start,
118118
&rs->rx_range_list[i].end,
119-
(uint64_t*)&rs->rx_range_list[i].modes,
119+
&rs->rx_range_list[i].modes,
120120
&rs->rx_range_list[i].low_power,
121121
&rs->rx_range_list[i].high_power,
122122
&rs->rx_range_list[i].vfo,
@@ -135,7 +135,7 @@ static int netrigctl_open(RIG *rig)
135135
ret = num_sscanf(buf, "%"SCNfreq"%"SCNfreq"%"SCNXll"%d%d%x%x",
136136
&rs->tx_range_list[i].start,
137137
&rs->tx_range_list[i].end,
138-
(uint64_t*)&rs->tx_range_list[i].modes,
138+
&rs->tx_range_list[i].modes,
139139
&rs->tx_range_list[i].low_power,
140140
&rs->tx_range_list[i].high_power,
141141
&rs->tx_range_list[i].vfo,
@@ -152,7 +152,7 @@ static int netrigctl_open(RIG *rig)
152152
return (ret < 0) ? ret : -RIG_EPROTO;
153153

154154
ret = sscanf(buf, "%"SCNXll"%ld",
155-
(uint64_t*)&rs->tuning_steps[i].modes,
155+
&rs->tuning_steps[i].modes,
156156
&rs->tuning_steps[i].ts);
157157
if (ret != 2)
158158
return -RIG_EPROTO;
@@ -166,7 +166,7 @@ static int netrigctl_open(RIG *rig)
166166
return (ret < 0) ? ret : -RIG_EPROTO;
167167

168168
ret = sscanf(buf, "%"SCNXll"%ld",
169-
(uint64_t*)&rs->filters[i].modes,
169+
&rs->filters[i].modes,
170170
&rs->filters[i].width);
171171
if (ret != 2)
172172
return -RIG_EPROTO;

include/hamlib/rig.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include <stdio.h>
2828
#include <stdarg.h>
29+
#include <inttypes.h>
2930

3031
/* Rig list is in a separate file so as not to mess up w/ this one */
3132
#include <hamlib/riglist.h>
@@ -760,7 +761,7 @@ enum rig_parm_e {
760761
* This can be a func, a level or a parm.
761762
* Each bit designates one of them.
762763
*/
763-
typedef unsigned long long setting_t;
764+
typedef uint64_t setting_t;
764765

765766
/**
766767
* \brief Tranceive mode
@@ -877,8 +878,9 @@ typedef unsigned long long setting_t;
877878
* \sa rig_parse_mode(), rig_strrmode()
878879
* TODO: Add new 8600 modes to rig2icom_mode() and icom2rig_mode() in frame.c
879880
*/
880-
#define ULL (unsigned long long)
881-
typedef unsigned long long rmode_t;
881+
#define ULL (uint64_t)
882+
typedef uint64_t rmode_t;
883+
882884
#define RIG_MODE_NONE 0 /*!< '' -- None */
883885
#define RIG_MODE_AM (1ULL << 0) /*!< \c AM -- Amplitude Modulation */
884886
#define RIG_MODE_CW (1ULL << 1) /*!< \c CW -- CW "normal" sideband */

tests/memcsv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ int dump_csv_chan(RIG *rig,
669669

670670
if (mem_caps->funcs)
671671
{
672-
fprintf(f, "%"PRXll"%c", (uint64_t)chan.funcs, csv_sep);
672+
fprintf(f, "%"PRXll"%c", chan.funcs, csv_sep);
673673
}
674674

675675
if (mem_caps->ctcss_tone)
@@ -940,7 +940,7 @@ int set_channel_data(RIG *rig,
940940

941941
if (i >= 0)
942942
{
943-
sscanf(line_data_list[i], "%"SCNXll, (uint64_t*)&chan->funcs);
943+
sscanf(line_data_list[i], "%"SCNXll, &chan->funcs);
944944
}
945945
}
946946

tests/rigctl_parse.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3791,7 +3791,7 @@ declare_proto_rig(dump_state)
37913791
"%"FREQFMT" %"FREQFMT" 0x%"PRXll" %d %d 0x%x 0x%x\n",
37923792
rs->rx_range_list[i].start,
37933793
rs->rx_range_list[i].end,
3794-
(uint64_t)rs->rx_range_list[i].modes,
3794+
rs->rx_range_list[i].modes,
37953795
rs->rx_range_list[i].low_power,
37963796
rs->rx_range_list[i].high_power,
37973797
rs->rx_range_list[i].vfo,
@@ -3806,7 +3806,7 @@ declare_proto_rig(dump_state)
38063806
"%"FREQFMT" %"FREQFMT" 0x%"PRXll" %d %d 0x%x 0x%x\n",
38073807
rs->tx_range_list[i].start,
38083808
rs->tx_range_list[i].end,
3809-
(uint64_t)rs->tx_range_list[i].modes,
3809+
rs->tx_range_list[i].modes,
38103810
rs->tx_range_list[i].low_power,
38113811
rs->tx_range_list[i].high_power,
38123812
rs->tx_range_list[i].vfo,
@@ -3819,7 +3819,7 @@ declare_proto_rig(dump_state)
38193819
{
38203820
fprintf(fout,
38213821
"0x%"PRXll" %ld\n",
3822-
(uint64_t)rs->tuning_steps[i].modes,
3822+
rs->tuning_steps[i].modes,
38233823
rs->tuning_steps[i].ts);
38243824
}
38253825

@@ -3829,7 +3829,7 @@ declare_proto_rig(dump_state)
38293829
{
38303830
fprintf(fout,
38313831
"0x%"PRXll" %ld\n",
3832-
(uint64_t)rs->filters[i].modes,
3832+
rs->filters[i].modes,
38333833
rs->filters[i].width);
38343834
}
38353835

@@ -3858,12 +3858,12 @@ declare_proto_rig(dump_state)
38583858

38593859
fprintf(fout, "\n");
38603860

3861-
fprintf(fout, "0x%"PRXll"\n", (uint64_t)rs->has_get_func);
3862-
fprintf(fout, "0x%"PRXll"\n", (uint64_t)rs->has_set_func);
3863-
fprintf(fout, "0x%"PRXll"\n", (uint64_t)rs->has_get_level);
3864-
fprintf(fout, "0x%"PRXll"\n", (uint64_t)rs->has_set_level);
3865-
fprintf(fout, "0x%"PRXll"\n", (uint64_t)rs->has_get_parm);
3866-
fprintf(fout, "0x%"PRXll"\n", (uint64_t)rs->has_set_parm);
3861+
fprintf(fout, "0x%"PRXll"\n", rs->has_get_func);
3862+
fprintf(fout, "0x%"PRXll"\n", rs->has_set_func);
3863+
fprintf(fout, "0x%"PRXll"\n", rs->has_get_level);
3864+
fprintf(fout, "0x%"PRXll"\n", rs->has_set_level);
3865+
fprintf(fout, "0x%"PRXll"\n", rs->has_get_parm);
3866+
fprintf(fout, "0x%"PRXll"\n", rs->has_set_parm);
38673867

38683868
#if 0
38693869
gran_t level_gran[RIG_SETTING_MAX]; /*!< level granularity */

0 commit comments

Comments
 (0)