Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: make sure fprintf uses an unsigned marker when an unsigned value is given #1872

Merged
merged 1 commit into from
Nov 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/bitbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void bitbuffer_add_bit(bitbuffer_t *bits, int bit)
return;
}
if (bits->bits_per_row[bits->num_rows - 1] == UINT16_MAX - 1) {
fprintf(stderr, "%s: Warning: row length limit (%d bits) reached\n", __func__, UINT16_MAX);
fprintf(stderr, "%s: Warning: row length limit (%u bits) reached\n", __func__, UINT16_MAX);
}

uint16_t col_index = bits->bits_per_row[bits->num_rows - 1] / 8;
Expand Down Expand Up @@ -330,7 +330,7 @@ static void print_bitbuffer(const bitbuffer_t *bits, int always_binary)
highest_indent = indent_this_row;
}

fprintf(stderr, "bitbuffer:: Number of rows: %d \n", bits->num_rows);
fprintf(stderr, "bitbuffer:: Number of rows: %u \n", bits->num_rows);
for (row = 0; row < bits->num_rows; ++row) {
fprintf(stderr, "[%02u] ", row);
print_bitrow(bits->bb[row], bits->bits_per_row[row], highest_indent, always_binary);
Expand Down
4 changes: 2 additions & 2 deletions src/devices/acurite.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ static int acurite_txr_decode(r_device *decoder, bitbuffer_t *bitbuffer)
bb = bitbuffer->bb[brow];

if (decoder->verbose > 1)
fprintf(stderr, "%s: row %d bits %d, bytes %d \n", __func__, brow, bitbuffer->bits_per_row[brow], browlen);
fprintf(stderr, "%s: row %u bits %u, bytes %d \n", __func__, brow, bitbuffer->bits_per_row[brow], browlen);

if ((bitbuffer->bits_per_row[brow] < ACURITE_TXR_BITLEN ||
bitbuffer->bits_per_row[brow] > ACURITE_5N1_BITLEN + 1)
Expand Down Expand Up @@ -1014,7 +1014,7 @@ static int acurite_986_decode(r_device *decoder, bitbuffer_t *bitbuffer)
for (uint16_t brow = 0; brow < bitbuffer->num_rows; ++brow) {

if (decoder->verbose > 1)
fprintf(stderr, "%s: row %d bits %d, bytes %d \n", __func__, brow, bitbuffer->bits_per_row[brow], browlen);
fprintf(stderr, "%s: row %u bits %u, bytes %d \n", __func__, brow, bitbuffer->bits_per_row[brow], browlen);

if (bitbuffer->bits_per_row[brow] < 39 ||
bitbuffer->bits_per_row[brow] > 43 ) {
Expand Down
2 changes: 1 addition & 1 deletion src/devices/ambientweather_tx8300.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static int ambientweather_tx8300_callback(r_device *decoder, bitbuffer_t *bitbuf
/* length check */
if (74 != bitbuffer->bits_per_row[0]) {
if (decoder->verbose > 1)
fprintf(stderr, "AmbientWeather-TX8300: wrong size (%i bits)\n", bitbuffer->bits_per_row[0]);
fprintf(stderr, "AmbientWeather-TX8300: wrong size (%u bits)\n", bitbuffer->bits_per_row[0]);
return DECODE_ABORT_LENGTH;
}

Expand Down
2 changes: 1 addition & 1 deletion src/devices/ambientweather_wh31e.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ static int ambientweather_whx_decode(r_device *decoder, bitbuffer_t *bitbuffer)
if (start_pos == bitbuffer->bits_per_row[row])
continue; // DECODE_ABORT_EARLY
if (decoder->verbose)
fprintf(stderr, "%s: WH31E/WH31B/WH40 detected, buffer is %d bits length\n", __func__, bitbuffer->bits_per_row[row]);
fprintf(stderr, "%s: WH31E/WH31B/WH40 detected, buffer is %u bits length\n", __func__, bitbuffer->bits_per_row[row]);

// remove preamble, keep whole payload
bitbuffer_extract_bytes(bitbuffer, row, start_pos + 24, b, 18 * 8);
Expand Down
2 changes: 1 addition & 1 deletion src/http_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ static void handle_cmd_rpc(struct mg_connection *nc, struct http_message *hm)
}
char *endptr = NULL;
rpc.val = strtol(val, &endptr, 10);
fprintf(stderr, "POST Got %s, arg %s, val %s (%d)\n", cmd, arg, val, rpc.val);
fprintf(stderr, "POST Got %s, arg %s, val %s (%u)\n", cmd, arg, val, rpc.val);

rpc_exec(&rpc, ctx->cfg);
}
Expand Down
4 changes: 2 additions & 2 deletions src/output_mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ static void mqtt_client_event(struct mg_connection *nc, int ev, void *ev_data)
}
case MG_EV_MQTT_CONNACK:
if (msg->connack_ret_code != MG_EV_MQTT_CONNACK_ACCEPTED) {
fprintf(stderr, "MQTT Connection error: %d\n", msg->connack_ret_code);
fprintf(stderr, "MQTT Connection error: %u\n", msg->connack_ret_code);
}
else {
fprintf(stderr, "MQTT Connection established.\n");
}
break;
case MG_EV_MQTT_PUBACK:
fprintf(stderr, "MQTT Message publishing acknowledged (msg_id: %d)\n", msg->message_id);
fprintf(stderr, "MQTT Message publishing acknowledged (msg_id: %u)\n", msg->message_id);
break;
case MG_EV_MQTT_SUBACK:
fprintf(stderr, "MQTT Subscription acknowledged.\n");
Expand Down
2 changes: 1 addition & 1 deletion src/rtl_433.c
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,7 @@ int main(int argc, char **argv) {
}
abuf_printf(&p, " ]");
}
fprintf(stderr, "Registered %zu out of %d device decoding protocols%s\n",
fprintf(stderr, "Registered %zu out of %u device decoding protocols%s\n",
demod->r_devs.len, cfg->num_r_devices, decoders_str);
}

Expand Down