cosmetics: remove unused variables and function params or comment them

This results in a lot less noise when -Wunused and -Wunused-parameter
are enabled, and cleans up the code base from old prototyping code.

Some unused variables are commented out because they appear to be
values that might be of value someday, but there were a lot of values
that could just be removed because they did not appear to be of any
value.
This commit is contained in:
Rick van Schijndel 2020-08-05 20:56:45 +02:00
parent 19f6f89243
commit e02d80a7ac
13 changed files with 12 additions and 23 deletions

View file

@ -667,8 +667,6 @@ static void print_kv_data(data_output_t *output, data_t *data, char const *forma
static void print_kv_array(data_output_t *output, data_array_t *array, char const *format)
{
data_output_kv_t *kv = (data_output_kv_t *)output;
//fprintf(output->file, "[ ");
for (int c = 0; c < array->num_values; ++c) {
if (c)
@ -1040,7 +1038,6 @@ static int datagram_client_open(datagram_client_t *client, const char *host, con
struct addrinfo hints, *res, *res0;
int error;
SOCKET sock;
const char *cause = NULL;
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC;

View file

@ -334,7 +334,7 @@ static int acurite_6045_decode(r_device *decoder, bitbuffer_t *bitbuffer, unsign
char raw_str[31], *rawp;
uint16_t sensor_id;
uint8_t strike_count, strike_distance;
int battery_low, active, rfi_detect, ussb1;
int battery_low, active, rfi_detect;
int exception = 0;
data_t *data;

View file

@ -133,10 +133,10 @@ static int alectov1_callback(r_device *decoder, bitbuffer_t *bitbuffer)
int battery_low = (b[1] & 0x80) >> 7;
int msg_type = (b[1] & 0x60) >> 5;
int button = (b[1] & 0x10) >> 4;
//int button = (b[1] & 0x10) >> 4;
int msg_rain = (b[1] & 0x0f) == 0x0c;
int msg_wind = (b[1] & 0x0f) == 0x08 && b[2] == 0;
int msg_gust = (b[1] & 0x0e) == 0x0e;
//int msg_wind = (b[1] & 0x0f) == 0x08 && b[2] == 0;
//int msg_gust = (b[1] & 0x0e) == 0x0e;
int channel = (b[0] & 0xc) >> 2;
int sensor_id = reverse8(b[0]);

View file

@ -39,9 +39,7 @@ static unsigned char pkt_hdr_inverted[3] = { 0xd2, 0x2d, 0xc0 };
static unsigned char pkt_hdr[3] = { 0x2d, 0xd2, 0x00 };
static int emontx_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
bitrow_t *bb = bitbuffer->bb;
unsigned bitpos = 0;
unsigned bits = bitbuffer->bits_per_row[0];
int events = 0;
// Search for only 22 bits to cope with inverted frames and

View file

@ -47,7 +47,8 @@ https://web.archive.org/web/20090828043201/http://www.openamr.org/wiki/ItronERTM
static int ert_decode(r_device *decoder, bitbuffer_t *bitbuffer)
{
static const uint8_t ERT_PREAMBLE[] = {/*0xF*/ 0x2A, 0x60};
// TODO: Verify preamble
//static const uint8_t ERT_PREAMBLE[] = {/*0xF*/ 0x2A, 0x60};
uint8_t *b;
uint8_t physical_tamper, ert_type, encoder_tamper;
uint32_t consumption_data, ert_id;

View file

@ -485,7 +485,7 @@ static int fineoffset_WH25_callback(r_device *decoder, bitbuffer_t *bitbuffer)
// Decode data
uint8_t id = ((b[0]&0x0f) << 4) | (b[1] >> 4);
int low_battery = (b[1] & 0x08) >> 3;
int invalid_flag = (b[1] & 0x04) >> 2;
//int invalid_flag = (b[1] & 0x04) >> 2;
int temp_raw = (b[1] & 0x03) << 8 | b[2]; // 0x7ff if invalid
float temperature = (temp_raw - 400) * 0.1f; // range -40.0-60.0 C
uint8_t humidity = b[3];

View file

@ -510,7 +510,6 @@ r_device *flex_create_device(char *spec)
return NULL; // NOTE: returns NULL on alloc failure.
}
dev->decode_ctx = params;
char *c, *o;
int get_count = 0;
spec = strdup(spec);

View file

@ -33,7 +33,7 @@ static inline int bit(const uint8_t *bytes, unsigned bit)
* 10 = 0
* 1100 = 1
*/
unsigned ge_decode(r_device *decoder, bitbuffer_t *inbuf, unsigned row, unsigned start, bitbuffer_t *outbuf)
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];
@ -71,7 +71,7 @@ static int ge_coloreffects_decode(r_device *decoder, bitbuffer_t *bitbuffer, uns
uint8_t device_id;
uint8_t command;
ge_decode(decoder, bitbuffer, row, start_pos, &packet_bits);
ge_decode(bitbuffer, row, start_pos, &packet_bits);
//bitbuffer_print(&packet_bits);
/* From http://www.deepdarc.com/2010/11/27/hacking-christmas-lights/

View file

@ -136,13 +136,12 @@ static int lacrossetx_decode(r_device *decoder, bitbuffer_t *bitbuffer)
continue; // DECODE_ABORT_EARLY
}
uint8_t msg_len = msg_nybbles[1];
// TODO: check if message length is a valid value
//uint8_t msg_len = msg_nybbles[1];
uint8_t msg_type = msg_nybbles[2];
uint8_t sensor_id = (msg_nybbles[3] << 3) + (msg_nybbles[4] >> 1);
uint8_t msg_parity = msg_nybbles[4] & 0x01;
float msg_value = msg_nybbles[5] * 10 + msg_nybbles[6] + msg_nybbles[7] / 10.0;
int msg_value_int = msg_nybbles[8] * 10 + msg_nybbles[9];
uint8_t msg_checksum = msg_nybbles[10];
// Check Repeated data values as another way of verifying
// message integrity.

View file

@ -42,8 +42,6 @@ static int philips_aj7010_decode(r_device *decoder, bitbuffer_t *bitbuffer)
{
uint8_t *b;
data_t *data;
uint8_t c_crc = 0;
uint8_t r_crc = 0;
int channel;
int temp_raw;
float temp_c;

View file

@ -31,7 +31,6 @@ Packet nibbles:
static int tpms_citroen_decode(r_device *decoder, bitbuffer_t *bitbuffer, unsigned row, unsigned bitpos)
{
data_t *data;
unsigned int start_pos;
bitbuffer_t packet_bits = {0};
uint8_t *b;
int state;
@ -45,7 +44,7 @@ static int tpms_citroen_decode(r_device *decoder, bitbuffer_t *bitbuffer, unsign
int maybe_battery;
int crc;
start_pos = bitbuffer_manchester_decode(bitbuffer, row, bitpos, &packet_bits, 88);
bitbuffer_manchester_decode(bitbuffer, row, bitpos, &packet_bits, 88);
b = packet_bits.bb[0];
if (b[6] == 0 || b[7] == 0) {

View file

@ -48,7 +48,6 @@ Protocol cribbed from:
static int visonic_powercode_decode(r_device *decoder, bitbuffer_t *bitbuffer)
{
uint8_t *b; // bits of a row
uint8_t msg[32];
data_t *data;
char id[7];

View file

@ -59,7 +59,6 @@ Based on code provided by Willi 'wherzig' in issue #30 (2014-04-21)
static int x10_sec_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
data_t *data;
uint16_t r; /* a row index */
uint8_t *b; /* bits of a row */
char *event_str = "UNKNOWN"; /* human-readable event */
char x10_id_str[12] = ""; /* string showing hex value */