From 6c8af75c757712bd58b169317795484a72e9a16c Mon Sep 17 00:00:00 2001 From: "Christian W. Zuckschwerdt" <christian@zuckschwerdt.org> Date: Sat, 13 Nov 2021 13:23:36 +0100 Subject: [PATCH] minor: Fix stricter compiler warnings --- CMakeLists.txt | 7 +++++++ include/baseband.h | 2 +- src/CMakeLists.txt | 8 +++----- src/compat_alarm.c | 1 + src/data_tag.c | 2 +- src/devices/alecto.c | 4 +++- src/devices/burnhardbbq.c | 31 ++++++++++++++++--------------- src/devices/directv.c | 6 +++--- src/devices/flex.c | 9 ++++++--- src/devices/ge_coloreffects.c | 2 +- src/devices/m_bus.c | 19 ++++++++++--------- src/devices/rubicson.c | 2 ++ src/devices/secplus_v2.c | 2 +- src/fileformat.c | 30 +++++++++++++++--------------- src/http_server.c | 16 ++++++++-------- src/optparse.c | 5 ++++- src/pulse_analyzer.c | 6 +++--- src/sdr.c | 4 ++-- tests/baseband-test.c | 4 ++-- 19 files changed, 89 insertions(+), 71 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e65dfb5..b6bb9d59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,13 @@ if(("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" MATCHES ADD_DEFINITIONS(-Wsign-compare) ADD_DEFINITIONS(-std=c99) ADD_DEFINITIONS(-pedantic) + ADD_DEFINITIONS(-Wshadow) + ADD_DEFINITIONS(-Wmissing-prototypes) + ADD_DEFINITIONS(-Wimplicit-fallthrough) + #ADD_DEFINITIONS(-Wfloat-equal) + #ADD_DEFINITIONS(-Wbad-function-cast) + #ADD_DEFINITIONS(-Wdocumentation) + # for strdup, setenv, use either #ADD_DEFINITIONS(-D_POSIX_C_SOURCE=200809) # does not work with uClibc ADD_DEFINITIONS(-D_GNU_SOURCE) diff --git a/include/baseband.h b/include/baseband.h index 2a361ec8..08304589 100644 --- a/include/baseband.h +++ b/include/baseband.h @@ -122,8 +122,8 @@ void baseband_low_pass_filter(uint16_t const *x_buf, int16_t *y_buf, uint32_t le @param x_buf input samples (I/Q samples in interleaved uint8) @param[out] y_buf output from FM demodulator @param num_samples number of samples to process + @param low_pass Low-pass filter frequency or ratio @param[in,out] state State to store between chunk processing - @param fpdm Index of filter setting to use */ void baseband_demod_FM(uint8_t const *x_buf, int16_t *y_buf, unsigned long num_samples, uint32_t samp_rate, float low_pass, demodfm_state_t *state); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fc5b9db6..ac43990b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -211,11 +211,9 @@ add_library(r_433 STATIC devices/x10_sec.c ) -if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") - set_source_files_properties(mongoose.c PROPERTIES COMPILE_FLAGS "-Wno-format -Wno-format-security") -endif() -if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") - set_source_files_properties(mongoose.c PROPERTIES COMPILE_FLAGS "-Wno-format-pedantic -Wno-format-security -Wno-large-by-value-copy") +if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang") + # untouched upstream code, disable all warnings + set_source_files_properties(mongoose.c PROPERTIES COMPILE_FLAGS "-w") endif() add_executable(rtl_433 rtl_433.c) diff --git a/src/compat_alarm.c b/src/compat_alarm.c index a1e96323..f8a47176 100644 --- a/src/compat_alarm.c +++ b/src/compat_alarm.c @@ -76,6 +76,7 @@ int win_alarm(unsigned seconds) /* * Just so this compilation unit isn't empty. */ +int win_alarm(unsigned seconds); int win_alarm(unsigned seconds) { (void) seconds; diff --git a/src/data_tag.c b/src/data_tag.c index bff8263e..4ebf44cf 100644 --- a/src/data_tag.c +++ b/src/data_tag.c @@ -254,7 +254,7 @@ static data_t *append_filtered_json(data_t *data, char const *json, char const * { jsmn_parser parser = {0}; jsmn_init(&parser); - jsmntok_t tok[MAX_JSON_TOKENS] = {0}; + jsmntok_t tok[MAX_JSON_TOKENS] = {{0}}; // make the compiler happy, should be {0} int toks = jsmn_parse(&parser, json, strlen(json), tok, MAX_JSON_TOKENS); if (toks < 1 || tok[0].type != JSMN_OBJECT) { diff --git a/src/devices/alecto.c b/src/devices/alecto.c index 6d7d2ae8..da01c05b 100644 --- a/src/devices/alecto.c +++ b/src/devices/alecto.c @@ -75,7 +75,9 @@ Format for Winddirection & Windgust: #include "decoder.h" -/* return 1 if the checksum passes and 0 if it fails */ +// NOTE: this is used in prologue.c, springfield.c, and thermopro_tx2.c +int alecto_checksum(uint8_t *b); +// return 1 if the checksum passes and 0 if it fails int alecto_checksum(uint8_t *b) { int csum = 0; diff --git a/src/devices/burnhardbbq.c b/src/devices/burnhardbbq.c index b9eea9df..51731f62 100644 --- a/src/devices/burnhardbbq.c +++ b/src/devices/burnhardbbq.c @@ -36,11 +36,6 @@ static int burnhardbbq_decode(r_device *decoder, bitbuffer_t *bitbuffer) uint8_t *b; data_t *data; - uint8_t id, channel, temperature_alarm, timer_alarm, timer_active; - float temperature, temperature_setpoint; - char timer_str[6]; - char *meat, *taste; - bitbuffer_invert(bitbuffer); // All three rows contain the same information. Return on first decoded row. @@ -65,15 +60,20 @@ static int burnhardbbq_decode(r_device *decoder, bitbuffer_t *bitbuffer) continue; } - id = b[0]; - channel = b[1] & 0x07; - temperature_alarm = (b[1] & 0x80) > 0; - timer_alarm = (b[1] & 0x40) > 0; - timer_active = (b[1] & 0x10) > 0; - temperature_setpoint = ((b[6] | (b[7] & 0x0f) << 8) - 500) * 0.1f; - temperature = ((b[8] | (b[7] & 0xf0) << 4) - 500) * 0.1f; + int id = (b[0]); + int channel = (b[1] & 0x07); + int temp_alarm = (b[1] & 0x80) > 7; + int timer_alarm = (b[1] & 0x40) > 6; + int timer_active = (b[1] & 0x10) > 4; + int setpoint_raw = ((b[7] & 0x0f) << 8) | b[6]; + int temp_raw = ((b[7] & 0xf0) << 4) | b[8]; + float setpoint_c = (setpoint_raw - 500) * 0.1f; + float temp_c = (temp_raw - 500) * 0.1f; + + char timer_str[6]; sprintf(timer_str, "%02x:%02x", b[3], b[4] & 0x7f); + char *meat; switch(b[5] >> 4) { case 0: meat = "free"; break; case 1: meat = "beef"; break; @@ -86,6 +86,7 @@ static int burnhardbbq_decode(r_device *decoder, bitbuffer_t *bitbuffer) default: meat = ""; } + char *taste; switch(b[5] & 0x0f) { case 0: taste = "rare"; break; case 1: taste = "medium rare"; break; @@ -100,9 +101,9 @@ static int burnhardbbq_decode(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "BurnhardBBQ", "id", "ID", DATA_INT, id, "channel", "Channel", DATA_INT, channel, - "temperature_C", "Temperature", DATA_COND, temperature != -50.0f, DATA_FORMAT, "%.01f C", DATA_DOUBLE, temperature, - "setpoint_C", "Temperature setpoint", DATA_FORMAT, "%.0f C", DATA_DOUBLE, temperature_setpoint, - "temperature_alarm", "Temperature alarm", DATA_INT, temperature_alarm, + "temperature_C", "Temperature", DATA_COND, temp_raw != 0, DATA_FORMAT, "%.01f C", DATA_DOUBLE, temp_c, + "setpoint_C", "Temperature setpoint", DATA_FORMAT, "%.0f C", DATA_DOUBLE, setpoint_c, + "temperature_alarm", "Temperature alarm", DATA_INT, temp_alarm, "timer", "Timer", DATA_STRING, timer_str, "timer_active", "Timer active", DATA_INT, timer_active, "timer_alarm", "Timer alarm", DATA_INT, timer_alarm, diff --git a/src/devices/directv.c b/src/devices/directv.c index 00fe72e2..aec78a4b 100644 --- a/src/devices/directv.c +++ b/src/devices/directv.c @@ -175,7 +175,7 @@ static const char *dtv_button_label[] = { [0x100] = "unknown", }; -const char *get_dtv_button_label(uint8_t button_id) +static const char *get_dtv_button_label(uint8_t button_id) { const char *label = dtv_button_label[button_id]; if (!label) { @@ -186,7 +186,7 @@ const char *get_dtv_button_label(uint8_t button_id) /// Set a single bit in a bitrow at bit_idx position. Assume success, no bounds checking, so be careful! /// Maybe this can graduate to bitbuffer.c someday? -void bitrow_set_bit(uint8_t *bitrow, unsigned bit_idx, unsigned bit_val) +static void bitrow_set_bit(uint8_t *bitrow, unsigned bit_idx, unsigned bit_val) { if (bit_val == 0) { bitrow[bit_idx >> 3] &= ~(1 << (7 - (bit_idx & 7))); @@ -222,7 +222,7 @@ void bitrow_set_bit(uint8_t *bitrow, unsigned bit_idx, unsigned bit_val) /// sync_pos. If desired, call again with bit_len = sync_pos to find this data. /// /// Maybe this can graduate to bitbuffer.c someday? -unsigned bitrow_dpwm_decode(uint8_t const *bitrow, unsigned bit_len, unsigned start, +static unsigned bitrow_dpwm_decode(uint8_t const *bitrow, unsigned bit_len, unsigned start, uint8_t *bitrow_buf, unsigned *sync_pos, unsigned *sync_len) { unsigned bitrow_pos; diff --git a/src/devices/flex.c b/src/devices/flex.c index b0cc9b1c..218b10e7 100644 --- a/src/devices/flex.c +++ b/src/devices/flex.c @@ -20,7 +20,7 @@ static inline int bit(const uint8_t *bytes, unsigned bit) } /// extract all mask bits skipping unmasked bits of a number up to 32/64 bits -unsigned long compact_number(uint8_t *data, unsigned bit_offset, unsigned long mask) +static unsigned long compact_number(uint8_t *data, unsigned bit_offset, unsigned long mask) { // clz (fls) is not worth the trouble int top_bit = 0; @@ -38,7 +38,7 @@ unsigned long compact_number(uint8_t *data, unsigned bit_offset, unsigned long m } /// extract a number up to 32/64 bits from given offset with given bit length -unsigned long extract_number(uint8_t *data, unsigned bit_offset, unsigned bit_count) +static unsigned long extract_number(uint8_t *data, unsigned bit_offset, unsigned bit_count) { unsigned pos = bit_offset / 8; // the first byte we need unsigned shl = bit_offset - pos * 8; // shift left we need to align @@ -429,7 +429,7 @@ static unsigned parse_bits(const char *code, uint8_t *bitrow) return len; } -const char *parse_map(const char *arg, struct flex_get *getter) +static const char *parse_map(const char *arg, struct flex_get *getter) { const char *c = arg; int i = 0; @@ -511,6 +511,9 @@ static void parse_getter(const char *arg, struct flex_get *getter) */ } +// NOTE: this is declared in rtl_433.c also. +r_device *flex_create_device(char *spec); + r_device *flex_create_device(char *spec) { if (!spec || !*spec || *spec == '?' || !strncasecmp(spec, "help", strlen(spec))) { diff --git a/src/devices/ge_coloreffects.c b/src/devices/ge_coloreffects.c index 9fa5525f..2b9bd011 100644 --- a/src/devices/ge_coloreffects.c +++ b/src/devices/ge_coloreffects.c @@ -33,7 +33,7 @@ static inline int bit(const uint8_t *bytes, unsigned bit) * 10 = 0 * 1100 = 1 */ -unsigned ge_decode(bitbuffer_t *inbuf, unsigned row, unsigned start, bitbuffer_t *outbuf) +static unsigned ge_decode(bitbuffer_t *inbuf, unsigned row, unsigned start, bitbuffer_t *outbuf) { uint8_t *bits = inbuf->bb[row]; unsigned int len = inbuf->bits_per_row[row]; diff --git a/src/devices/m_bus.c b/src/devices/m_bus.c index 570a7105..f7d27b72 100644 --- a/src/devices/m_bus.c +++ b/src/devices/m_bus.c @@ -86,7 +86,7 @@ static int m_bus_crc_valid(r_device *decoder, const uint8_t *bytes, unsigned crc // Decode two bytes into three letters of five bits -static void m_bus_manuf_decode(uint16_t m_field, char* three_letter_code) +static void m_bus_manuf_decode(uint16_t m_field, char *three_letter_code) { three_letter_code[0] = (m_field >> 10 & 0x1F) + 0x40; three_letter_code[1] = (m_field >> 5 & 0x1F) + 0x40; @@ -96,7 +96,7 @@ static void m_bus_manuf_decode(uint16_t m_field, char* three_letter_code) // Decode device type string -const char* m_bus_device_type_str(uint8_t devType) +static char const *m_bus_device_type_str(uint8_t devType) { char *str = ""; switch(devType) { @@ -179,14 +179,14 @@ typedef struct { static float humidity_factor[2] = { 0.1, 1 }; -static char* oms_hum[4][4] = { +static char *oms_hum[4][4] = { {"humidity","average_humidity_1h","average_humidity_24h","error_04", }, {"maximum_humidity_1h","maximum_humidity_24h","error_13","error_14",}, {"minimum_humidity_1h","minimum_humidity_24h","error_23","error_24",}, {"error_31","error_32","error_33","error_34",} }; -static char* oms_hum_el[4][4] = { +static char *oms_hum_el[4][4] = { {"Humidity","Average Humidity 1h","Average Humidity 24h","Error [0][4]", }, {"Maximum Humidity 1h","Maximum Humidity 24h","Error [1][3]","Error [1][4]",}, {"Minimum Humidity 1h","Minimum Humidity 24h","Error [2][3]","Error [2][4]",}, @@ -282,7 +282,7 @@ static char *unit_names[][3] = { static double pow10_table[8] = { 0.001, 0.01, 0.1, 1, 10, 100, 1000, 10000 }; -static data_t *append_str(data_t *data, enum UnitType unit_type, uint8_t value_type, uint8_t sn, const char* extra, const char* value) +static data_t *append_str(data_t *data, enum UnitType unit_type, uint8_t value_type, uint8_t sn, char const *extra, char const *value) { char key[100] = {0}; char pretty[100] = {0}; @@ -301,9 +301,9 @@ static data_t *append_str(data_t *data, enum UnitType unit_type, uint8_t value_t } -static data_t *append_val(data_t *data, enum UnitType unit_type, uint8_t value_type, uint8_t sn, const char* extra, int64_t val, int exp) +static data_t *append_val(data_t *data, enum UnitType unit_type, uint8_t value_type, uint8_t sn, char const *extra, int64_t val, int exp) { - const char *prefix = ""; + char const *prefix = ""; char buffer_val[256] = {0}; if (exp < -6) { @@ -337,7 +337,7 @@ static data_t *append_val(data_t *data, enum UnitType unit_type, uint8_t value_t return append_str(data, unit_type, value_type, sn, extra, buffer_val); } -size_t m_bus_tm_decode(const uint8_t *data, size_t data_size, char *output, size_t output_size) +static size_t m_bus_tm_decode(const uint8_t *data, size_t data_size, char *output, size_t output_size) { size_t out_len = 0; @@ -657,6 +657,7 @@ static int m_bus_decode_records(data_t *data, const uint8_t *b, uint8_t dif_codi default: break; } + break; default: break; } @@ -863,7 +864,7 @@ static int m_bus_decode_format_b(r_device *decoder, const m_bus_data_t *in, m_bu return 1; } -static int m_bus_output_data(r_device *decoder, bitbuffer_t *bitbuffer, const m_bus_data_t *out, const m_bus_block1_t *block1, const char *mode) +static int m_bus_output_data(r_device *decoder, bitbuffer_t *bitbuffer, const m_bus_data_t *out, const m_bus_block1_t *block1, char const *mode) { (void)bitbuffer; // note: to match the common decoder function signature diff --git a/src/devices/rubicson.c b/src/devices/rubicson.c index 65b4fed3..0ac62700 100644 --- a/src/devices/rubicson.c +++ b/src/devices/rubicson.c @@ -32,6 +32,8 @@ The sensor can be bought at Kjell&Co #include "decoder.h" // NOTE: this is used in nexus.c and solight_te44.c +int rubicson_crc_check(uint8_t *b); + int rubicson_crc_check(uint8_t *b) { uint8_t tmp[5]; diff --git a/src/devices/secplus_v2.c b/src/devices/secplus_v2.c index 3ddbe154..7e9b0fc3 100644 --- a/src/devices/secplus_v2.c +++ b/src/devices/secplus_v2.c @@ -68,7 +68,7 @@ Once the above has been run twice the two are merged */ -int _decode_v2_half(bitbuffer_t *bits, uint8_t roll_array[], bitbuffer_t *fixed_p, int verbose) +static int _decode_v2_half(bitbuffer_t *bits, uint8_t roll_array[], bitbuffer_t *fixed_p, int verbose) { uint8_t invert = 0; uint8_t order = 0; diff --git a/src/fileformat.c b/src/fileformat.c index 58c9f7b8..af1f0738 100644 --- a/src/fileformat.c +++ b/src/fileformat.c @@ -70,19 +70,19 @@ void check_write_file_info(file_info_t *info) char const *file_info_string(file_info_t *info) { switch (info->format) { - case CU8_IQ: return "CU8 IQ (2ch uint8)"; break; - case S16_AM: return "S16 AM (1ch int16)"; break; - case S16_FM: return "S16 FM (1ch int16)"; break; - case CF32_IQ: return "CF32 IQ (2ch float32)"; break; - case CS16_IQ: return "CS16 IQ (2ch int16)"; break; - case F32_AM: return "F32 AM (1ch float32)"; break; - case F32_FM: return "F32 FM (1ch float32)"; break; - case F32_I: return "F32 I (1ch float32)"; break; - case F32_Q: return "F32 Q (1ch float32)"; break; - case VCD_LOGIC: return "VCD logic (text)"; break; - case U8_LOGIC: return "U8 logic (1ch uint8)"; break; - case PULSE_OOK: return "OOK pulse data (text)"; break; - default: return "Unknown"; break; + case CU8_IQ: return "CU8 IQ (2ch uint8)"; + case S16_AM: return "S16 AM (1ch int16)"; + case S16_FM: return "S16 FM (1ch int16)"; + case CF32_IQ: return "CF32 IQ (2ch float32)"; + case CS16_IQ: return "CS16 IQ (2ch int16)"; + case F32_AM: return "F32 AM (1ch float32)"; + case F32_FM: return "F32 FM (1ch float32)"; + case F32_I: return "F32 I (1ch float32)"; + case F32_Q: return "F32 Q (1ch float32)"; + case VCD_LOGIC: return "VCD logic (text)"; + case U8_LOGIC: return "U8 logic (1ch uint8)"; + case PULSE_OOK: return "OOK pulse data (text)"; + default: return "Unknown"; } } @@ -270,7 +270,7 @@ int parse_file_info(char const *filename, file_info_t *info) // Unit testing #ifdef _TEST -void assert_file_type(int check, char const *spec) +static void assert_file_type(int check, char const *spec) { file_info_t info = {0}; int ret = parse_file_info(spec, &info); @@ -281,7 +281,7 @@ void assert_file_type(int check, char const *spec) } } -void assert_str_equal(char const *a, char const *b) +static void assert_str_equal(char const *a, char const *b) { if (a != b && (!a || !b || strcmp(a, b))) { fprintf(stderr, "\nTEST failed: \"%s\" == \"%s\"\n", a, b); diff --git a/src/http_server.c b/src/http_server.c index c22ac66f..bf30db43 100644 --- a/src/http_server.c +++ b/src/http_server.c @@ -138,7 +138,7 @@ typedef struct { void **tail; } ring_list_t; -ring_list_t *ring_list_new(unsigned size) +static ring_list_t *ring_list_new(unsigned size) { ring_list_t *ring = calloc(1, sizeof(ring_list_t)); if (!ring) { @@ -160,7 +160,7 @@ ring_list_t *ring_list_new(unsigned size) } // the ring needs to be empty before calling this -void ring_list_free(ring_list_t *ring) +static void ring_list_free(ring_list_t *ring) { if (ring) { if (ring->data) @@ -170,7 +170,7 @@ void ring_list_free(ring_list_t *ring) } // free the data returned -void *ring_list_shift(ring_list_t *ring) +static void *ring_list_shift(ring_list_t *ring) { if (!ring->head) return NULL; @@ -187,7 +187,7 @@ void *ring_list_shift(ring_list_t *ring) } // retain data before passing in and free the data returned. -void *ring_list_push(ring_list_t *ring, void *data) +static void *ring_list_push(ring_list_t *ring, void *data) { *ring->tail = data; @@ -204,12 +204,12 @@ void *ring_list_push(ring_list_t *ring, void *data) return NULL; } -void **ring_list_iter(ring_list_t *ring) +static void **ring_list_iter(ring_list_t *ring) { return ring->head; } -void **ring_list_next(ring_list_t *ring, void **iter) +static void **ring_list_next(ring_list_t *ring, void **iter) { if (!iter) return NULL; @@ -293,7 +293,7 @@ static data_t *protocols_data(r_cfg_t *cfg) continue; } int fields_len = 0; - for (char **iter = dev->fields; iter && *iter; ++iter) { + for (char **iter2 = dev->fields; iter2 && *iter2; ++iter2) { fields_len++; } data_t *data = data_make( @@ -512,7 +512,7 @@ static int jsonrpc_parse(rpc_t *rpc, struct mg_str const *json) return 0; } -void rpc_exec(rpc_t *rpc, r_cfg_t *cfg) +static void rpc_exec(rpc_t *rpc, r_cfg_t *cfg) { if (!rpc || !rpc->method || !*rpc->method) { rpc->response(rpc, -1, "Method invalid", 0); diff --git a/src/optparse.c b/src/optparse.c index b9f89b4b..a92cb1fe 100644 --- a/src/optparse.c +++ b/src/optparse.c @@ -231,6 +231,9 @@ int atoi_time(char const *str, char const *error_hint) break; } // intentional fallthrough +#if (defined(__GNUC__) || defined(__clang__)) && __has_attribute(fallthrough) + __attribute__((fallthrough)); +#endif case ':': ++colons; if (colons == 1) @@ -306,7 +309,7 @@ char *asepc(char **stringp, char delim) return p; } -static char *achrb(char const *s, int c, int b) +static char *achrb(char *s, int c, int b) { for (; s && *s && *s != b; ++s) if (*s == c) return (char *)s; diff --git a/src/pulse_analyzer.c b/src/pulse_analyzer.c index 697b7e18..12524d42 100644 --- a/src/pulse_analyzer.c +++ b/src/pulse_analyzer.c @@ -404,10 +404,10 @@ void pulse_analyzer(pulse_data_t *data, int package_type) } fprintf(stderr, "view at https://triq.org/pdv/#"); - for (unsigned i = 0; i < hexstr_cnt; ++i) { - if (i > 0) + for (unsigned j = 0; j < hexstr_cnt; ++j) { + if (j > 0) fprintf(stderr, "+"); - hexstr_print(&hexstrs[i], stderr); + hexstr_print(&hexstrs[j], stderr); } fprintf(stderr, "\n"); if (hexstr_cnt >= HEXSTR_MAX_COUNT) { diff --git a/src/sdr.c b/src/sdr.c index 6514a6ab..d3f1cec7 100644 --- a/src/sdr.c +++ b/src/sdr.c @@ -1138,7 +1138,7 @@ uint32_t sdr_get_center_freq(sdr_dev_t *dev) #ifdef SOAPYSDR if (dev->soapy_dev) - return (int)SoapySDRDevice_getFrequency(dev->soapy_dev, SOAPY_SDR_RX, 0); + return (uint32_t)SoapySDRDevice_getFrequency(dev->soapy_dev, SOAPY_SDR_RX, 0); #endif #ifdef RTLSDR @@ -1384,7 +1384,7 @@ uint32_t sdr_get_sample_rate(sdr_dev_t *dev) #ifdef SOAPYSDR if (dev->soapy_dev) - return (int)SoapySDRDevice_getSampleRate(dev->soapy_dev, SOAPY_SDR_RX, 0); + return (uint32_t)SoapySDRDevice_getSampleRate(dev->soapy_dev, SOAPY_SDR_RX, 0); #endif #ifdef RTLSDR diff --git a/tests/baseband-test.c b/tests/baseband-test.c index c78602fe..55806cf5 100644 --- a/tests/baseband-test.c +++ b/tests/baseband-test.c @@ -45,7 +45,7 @@ typedef SSIZE_T ssize_t; printf("Time elapsed in ms: %f for: %s\n", elapsed, label); \ } while (0) -int read_buf(const char *filename, void *buf, size_t nbyte) +static int read_buf(const char *filename, void *buf, size_t nbyte) { int fd = open(filename, O_RDONLY); if (fd < 0) { @@ -57,7 +57,7 @@ int read_buf(const char *filename, void *buf, size_t nbyte) return ret; } -int write_buf(const char *filename, const void *buf, size_t nbyte) +static int write_buf(const char *filename, const void *buf, size_t nbyte) { int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd < 0) {