Fix warnings during compilation time on ARM (32 bits) (#13681)
thiagoftsm committed
Sep 26, 2022 at 13:49 UTC
71cb1ad68707718671ef57c901dfa2041f15bbe6
18 files changed
+40
-34
cli/cli.c
+1
-1
@@ -78,7 +78,7 @@ static void pipe_read_cb(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf
78
} else if (nread) {
79
size_t to_copy;
80
81
- to_copy = MIN(nread, MAX_COMMAND_LENGTH - 1 - response_string_size);
81
+ to_copy = MIN((unsigned int) nread, MAX_COMMAND_LENGTH - 1 - response_string_size);
82
memcpy(response_string + response_string_size, buf->base, to_copy);
83
response_string_size += to_copy;
84
response_string[response_string_size] = '\0';
collectors/proc.plugin/proc_pagetypeinfo.c
+7
-4
@@ -79,7 +79,7 @@ int do_proc_pagetypeinfo(int update_every, usec_t dt) {
79
static RRDSET **st_nodezonetype = NULL;
80
81
// Local temp variables
82
- size_t l, o, p;
82
+ long unsigned int l, o, p;
83
struct pageline *pgl = NULL;
84
85
// --------------------------------------------------------------------
@@ -149,7 +149,8 @@ int do_proc_pagetypeinfo(int update_every, usec_t dt) {
149
pageorders_cnt -= 9;
150
151
if (pageorders_cnt > MAX_PAGETYPE_ORDER) {
152
- error("PLUGIN: PROC_PAGETYPEINFO: pageorder found (%lu) is higher than max %d", pageorders_cnt, MAX_PAGETYPE_ORDER);
152
+ error("PLUGIN: PROC_PAGETYPEINFO: pageorder found (%lu) is higher than max %d",
153
+ (long unsigned int) pageorders_cnt, MAX_PAGETYPE_ORDER);
154
return 1;
155
}
156
@@ -157,7 +158,8 @@ int do_proc_pagetypeinfo(int update_every, usec_t dt) {
158
if (!pagelines) {
159
pagelines = callocz(pagelines_cnt, sizeof(struct pageline));
160
if (!pagelines) {
160
- error("PLUGIN: PROC_PAGETYPEINFO: Cannot allocate %lu pagelines of %lu B", pagelines_cnt, sizeof(struct pageline));
161
+ error("PLUGIN: PROC_PAGETYPEINFO: Cannot allocate %lu pagelines of %lu B",
162
+ (long unsigned int) pagelines_cnt, (long unsigned int) sizeof(struct pageline));
163
return 1;
164
}
165
}
@@ -289,7 +291,8 @@ int do_proc_pagetypeinfo(int update_every, usec_t dt) {
291
size_t words = procfile_linewords(ff, l);
292
293
if (words != 7+pageorders_cnt) {
292
- error("PLUGIN: PROC_PAGETYPEINFO: Unable to read line %lu, %lu words found instead of %lu", l+1, words, 7+pageorders_cnt);
294
+ error("PLUGIN: PROC_PAGETYPEINFO: Unable to read line %lu, %lu words found instead of %lu",
295
+ l+1, (long unsigned int) words, (long unsigned int) 7+pageorders_cnt);
296
break;
297
}
298
daemon/commands.c
+1
-1
@@ -515,7 +515,7 @@ static void pipe_read_cb(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf
515
} else if (nread) {
516
size_t to_copy;
517
518
- to_copy = MIN(nread, MAX_COMMAND_LENGTH - 1 - cmd_ctx->command_string_size);
518
+ to_copy = MIN((size_t) nread, MAX_COMMAND_LENGTH - 1 - cmd_ctx->command_string_size);
519
memcpy(cmd_ctx->command_string + cmd_ctx->command_string_size, buf->base, to_copy);
520
cmd_ctx->command_string_size += to_copy;
521
cmd_ctx->command_string[cmd_ctx->command_string_size] = '\0';
daemon/unit_test.c
+8
-8
@@ -1636,28 +1636,28 @@ int unit_test_bitmap256(void) {
1636
if (test_bitmap.data[0] == 0xffffffffffffffff)
1637
fprintf(stderr, "%s() INDEX 0 is fully set OK\n", __FUNCTION__);
1638
else {
1639
- fprintf(stderr, "%s() INDEX 0 is %lx expected 0xffffffffffffffff\n", __FUNCTION__, test_bitmap.data[0]);
1639
+ fprintf(stderr, "%s() INDEX 0 is %"PRIu64" expected 0xffffffffffffffff\n", __FUNCTION__, test_bitmap.data[0]);
1640
return 1;
1641
}
1642
1643
if (test_bitmap.data[1] == 0xffffffffffffffff)
1644
fprintf(stderr, "%s() INDEX 1 is fully set OK\n", __FUNCTION__);
1645
else {
1646
- fprintf(stderr, "%s() INDEX 1 is %lx expected 0xffffffffffffffff\n", __FUNCTION__, test_bitmap.data[0]);
1646
+ fprintf(stderr, "%s() INDEX 1 is %"PRIu64" expected 0xffffffffffffffff\n", __FUNCTION__, test_bitmap.data[0]);
1647
return 1;
1648
}
1649
1650
if (test_bitmap.data[2] == 0xffffffffffffffff)
1651
fprintf(stderr, "%s() INDEX 2 is fully set OK\n", __FUNCTION__);
1652
else {
1653
- fprintf(stderr, "%s() INDEX 2 is %lx expected 0xffffffffffffffff\n", __FUNCTION__, test_bitmap.data[0]);
1653
+ fprintf(stderr, "%s() INDEX 2 is %"PRIu64" expected 0xffffffffffffffff\n", __FUNCTION__, test_bitmap.data[0]);
1654
return 1;
1655
}
1656
1657
if (test_bitmap.data[3] == 0xffffffffffffffff)
1658
fprintf(stderr, "%s() INDEX 3 is fully set OK\n", __FUNCTION__);
1659
else {
1660
- fprintf(stderr, "%s() INDEX 3 is %lx expected 0xffffffffffffffff\n", __FUNCTION__, test_bitmap.data[0]);
1660
+ fprintf(stderr, "%s() INDEX 3 is %"PRIu64" expected 0xffffffffffffffff\n", __FUNCTION__, test_bitmap.data[0]);
1661
return 1;
1662
}
1663
@@ -1706,28 +1706,28 @@ int unit_test_bitmap256(void) {
1706
if (test_bitmap.data[0] == 0x1111111111111111)
1707
fprintf(stderr, "%s() INDEX 0 is 0x1111111111111111 set OK\n", __FUNCTION__);
1708
else {
1709
- fprintf(stderr, "%s() INDEX 0 is %lx expected 0x1111111111111111\n", __FUNCTION__, test_bitmap.data[0]);
1709
+ fprintf(stderr, "%s() INDEX 0 is %"PRIu64" expected 0x1111111111111111\n", __FUNCTION__, test_bitmap.data[0]);
1710
return 1;
1711
}
1712
1713
if (test_bitmap.data[1] == 0x1111111111111111)
1714
fprintf(stderr, "%s() INDEX 1 is 0x1111111111111111 set OK\n", __FUNCTION__);
1715
else {
1716
- fprintf(stderr, "%s() INDEX 1 is %lx expected 0x1111111111111111\n", __FUNCTION__, test_bitmap.data[1]);
1716
+ fprintf(stderr, "%s() INDEX 1 is %"PRIu64" expected 0x1111111111111111\n", __FUNCTION__, test_bitmap.data[1]);
1717
return 1;
1718
}
1719
1720
if (test_bitmap.data[2] == 0x1111111111111111)
1721
fprintf(stderr, "%s() INDEX 2 is 0x1111111111111111 set OK\n", __FUNCTION__);
1722
else {
1723
- fprintf(stderr, "%s() INDEX 2 is %lx expected 0x1111111111111111\n", __FUNCTION__, test_bitmap.data[2]);
1723
+ fprintf(stderr, "%s() INDEX 2 is %"PRIu64" expected 0x1111111111111111\n", __FUNCTION__, test_bitmap.data[2]);
1724
return 1;
1725
}
1726
1727
if (test_bitmap.data[3] == 0x1111111111111111)
1728
fprintf(stderr, "%s() INDEX 3 is 0x1111111111111111 set OK\n", __FUNCTION__);
1729
else {
1730
- fprintf(stderr, "%s() INDEX 3 is %lx expected 0x1111111111111111\n", __FUNCTION__, test_bitmap.data[3]);
1730
+ fprintf(stderr, "%s() INDEX 3 is %"PRIu64" expected 0x1111111111111111\n", __FUNCTION__, test_bitmap.data[3]);
1731
return 1;
1732
}
1733
database/engine/journalfile.c
+2
-2
@@ -315,14 +315,14 @@ static void restore_extent_metadata(struct rrdengine_instance *ctx, struct rrden
315
uint64_t end_time = jf_metric_data->descr[i].end_time;
316
317
if (unlikely(start_time > end_time)) {
318
- error("Invalid page encountered, start time %lu > end time %lu", start_time , end_time );
318
+ error("Invalid page encountered, start time %"PRIu64" > end time %"PRIu64"", start_time , end_time);
319
continue;
320
}
321
322
if (unlikely(start_time == end_time)) {
323
size_t entries = jf_metric_data->descr[i].page_length / page_type_size[page_type];
324
if (unlikely(entries > 1)) {
325
- error("Invalid page encountered, start time %lu = end time but %zu entries were found", start_time, entries);
325
+ error("Invalid page encountered, start time %"PRIu64" = end time but %zu entries were found", start_time, entries);
326
continue;
327
}
328
}
database/rrdcontext.c
+1
-1
@@ -857,7 +857,7 @@ static void rrdinstance_trigger_updates(RRDINSTANCE *ri, const char *function) {
857
RRDSET *st = ri->rrdset;
858
859
if(likely(st)) {
860
- if(unlikely(st->priority != ri->priority)) {
860
+ if(unlikely((unsigned int) st->priority != ri->priority)) {
861
ri->priority = st->priority;
862
rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_PRIORITY);
863
}
database/rrddim.c
+1
-1
@@ -700,7 +700,7 @@ bool rrddim_memory_load_or_create_map_save(RRDSET *st, RRDDIM *rd, RRD_MEMORY_MO
700
reset = 1;
701
}
702
else if(rd_on_file->memsize != size) {
703
- error("File %s does not have the desired size, expected %lu but found %lu. Clearing it.", fullfilename, size, rd_on_file->memsize);
703
+ error("File %s does not have the desired size, expected %lu but found %lu. Clearing it.", fullfilename, size, (unsigned long int) rd_on_file->memsize);
704
memset(rd_on_file, 0, size);
705
reset = 1;
706
}
database/sqlite/sqlite_aclk.c
+1
-1
@@ -565,7 +565,7 @@ void aclk_database_worker(void *arg)
565
// wc->retry_count = 0;
566
wc->node_info_send = 1;
567
// aclk_add_worker_thread(wc);
568
- info("Starting ACLK sync thread for host %s -- scratch area %lu bytes", wc->host_guid, sizeof(*wc));
568
+ info("Starting ACLK sync thread for host %s -- scratch area %lu bytes", wc->host_guid, (unsigned long int) sizeof(*wc));
569
570
memset(&cmd, 0, sizeof(cmd));
571
#ifdef ENABLE_ACLK
database/sqlite/sqlite_aclk_alert.c
+1
-1
@@ -877,7 +877,7 @@ static int have_recent_alarm(RRDHOST *host, uint32_t alarm_id, time_t mark)
877
ALARM_ENTRY *ae = host->health_log.alarms;
878
879
while (ae) {
880
- if (ae->alarm_id == alarm_id && ae->unique_id > mark &&
880
+ if (ae->alarm_id == alarm_id && ae->unique_id > (uint32_t)mark &&
881
(ae->new_status != RRDCALC_STATUS_WARNING && ae->new_status != RRDCALC_STATUS_CRITICAL))
882
return 1;
883
ae = ae->next;
database/sqlite/sqlite_aclk_chart.c
+1
-1
@@ -928,7 +928,7 @@ void aclk_update_retention(struct aclk_database_worker_config *wc)
928
start_time = MIN(start_time, first_entry_t);
929
930
if (memory_mode == RRD_MEMORY_MODE_DBENGINE && wc->chart_updates && (dimension_update_count < ACLK_MAX_DIMENSION_CLEANUP)) {
931
- int live = ((now - last_entry_t) < (RRDSET_MINIMUM_DIM_LIVE_MULTIPLIER * update_every));
931
+ int live = ((uint32_t)(now - last_entry_t) < (RRDSET_MINIMUM_DIM_LIVE_MULTIPLIER * update_every));
932
if (rc) {
933
first_entry_t = 0;
934
last_entry_t = 0;
database/sqlite/sqlite_health.c
+2
-2
@@ -382,7 +382,7 @@ void sql_health_alarm_log_cleanup(RRDHOST *host) {
382
char uuid_str[GUID_LEN + 1];
383
uuid_unparse_lower_fix(&host->host_uuid, uuid_str);
384
385
- snprintfz(command, MAX_HEALTH_SQL_SIZE, SQL_CLEANUP_HEALTH_LOG(uuid_str, uuid_str, host->health_log_entries_written - rotate_every));
385
+ snprintfz(command, MAX_HEALTH_SQL_SIZE, SQL_CLEANUP_HEALTH_LOG(uuid_str, uuid_str, (unsigned long int) (host->health_log_entries_written - rotate_every)));
386
387
rc = sqlite3_prepare_v2(db_meta, command, -1, &res, 0);
388
if (unlikely(rc != SQLITE_OK)) {
@@ -437,7 +437,7 @@ void sql_health_alarm_log_count(RRDHOST *host) {
437
if (unlikely(rc != SQLITE_OK))
438
error_report("Failed to finalize the prepared statement to count health log entries from db");
439
440
- info("HEALTH [%s]: Table health_log_%s, contains %lu entries.", rrdhost_hostname(host), uuid_str, host->health_log_entries_written);
440
+ info("HEALTH [%s]: Table health_log_%s, contains %lu entries.", rrdhost_hostname(host), uuid_str, (unsigned long int) host->health_log_entries_written);
441
}
442
443
#define SQL_INJECT_REMOVED(guid, guid2) "insert into health_log_%s (hostname, unique_id, alarm_id, alarm_event_id, config_hash_id, updated_by_id, updates_id, when_key, duration, non_clear_duration, flags, exec_run_timestamp, " \
exporting/graphite/graphite.c
+1
-1
@@ -214,7 +214,7 @@ void graphite_http_prepare_header(struct instance *instance)
214
"\r\n",
215
instance->config.destination,
216
simple_connector_data->auth_string ? simple_connector_data->auth_string : "",
217
- buffer_strlen(simple_connector_data->last_buffer->buffer));
217
+ (unsigned long int) buffer_strlen(simple_connector_data->last_buffer->buffer));
218
219
return;
220
}
exporting/json/json.c
+1
-1
@@ -344,7 +344,7 @@ void json_http_prepare_header(struct instance *instance)
344
"\r\n",
345
instance->config.destination,
346
simple_connector_data->auth_string ? simple_connector_data->auth_string : "",
347
- buffer_strlen(simple_connector_data->last_buffer->buffer));
347
+ (unsigned long int) buffer_strlen(simple_connector_data->last_buffer->buffer));
348
349
return;
350
}
exporting/opentsdb/opentsdb.c
+1
-1
@@ -268,7 +268,7 @@ void opentsdb_http_prepare_header(struct instance *instance)
268
"\r\n",
269
instance->config.destination,
270
simple_connector_data->auth_string ? simple_connector_data->auth_string : "",
271
- buffer_strlen(simple_connector_data->last_buffer->buffer));
271
+ (unsigned long int) buffer_strlen(simple_connector_data->last_buffer->buffer));
272
273
return;
274
}
health/health_json.c
+1
-1
@@ -402,7 +402,7 @@ static int have_recent_alarm(RRDHOST *host, uint32_t alarm_id, time_t mark)
402
ALARM_ENTRY *ae = host->health_log.alarms;
403
404
while(ae) {
405
- if (ae->alarm_id == alarm_id && ae->unique_id > mark &&
405
+ if (ae->alarm_id == alarm_id && ae->unique_id > (unsigned int) mark &&
406
(ae->new_status != RRDCALC_STATUS_WARNING && ae->new_status != RRDCALC_STATUS_CRITICAL))
407
return 1;
408
ae = ae->next;
libnetdata/dictionary/dictionary.c
+2
-2
@@ -1684,7 +1684,7 @@ static bool api_is_name_good_with_trace(DICTIONARY *dict __maybe_unused, const c
1684
function,
1685
name,
1686
strlen(name) + 1,
1687
- name_len,
1687
+ (long int) name_len,
1688
dict?dict->creation_function:"unknown",
1689
dict?dict->creation_line:0,
1690
dict?dict->creation_file:"unknown");
@@ -1695,7 +1695,7 @@ static bool api_is_name_good_with_trace(DICTIONARY *dict __maybe_unused, const c
1695
function,
1696
name,
1697
strlen(name) + 1,
1698
- name_len,
1698
+ (long int) name_len,
1699
dict?dict->creation_function:"unknown",
1700
dict?dict->creation_line:0,
1701
dict?dict->creation_file:"unknown");
libnetdata/json/json.c
+3
-2
@@ -102,7 +102,7 @@ int json_callback_print(JSON_ENTRY *e)
102
103
case JSON_ARRAY:
104
e->callback_function = json_callback_print;
105
- sprintf(txt,"ARRAY[%lu]", e->data.items);
105
+ sprintf(txt,"ARRAY[%lu]", (long unsigned int) e->data.items);
106
buffer_strcat(wb, txt);
107
break;
108
@@ -553,4 +553,5 @@ int json_test(char *str)
553
{
554
return json_parse(str, NULL, json_callback_print);
555
}
556
- */
\ No newline at end of file
556
+ */
557
+
streaming/compression.c
+5
-3
@@ -67,7 +67,7 @@ static size_t lz4_compressor_compress(struct compressor_state *state, const char
67
return 0;
68
69
if(unlikely(size > LZ4_MAX_MSG_SIZE)) {
70
- error("%s: Compression Failed - Message size %lu above compression buffer limit: %d", STREAM_COMPRESSION_MSG, size, LZ4_MAX_MSG_SIZE);
70
+ error("%s: Compression Failed - Message size %lu above compression buffer limit: %d", STREAM_COMPRESSION_MSG, (long unsigned int) size, LZ4_MAX_MSG_SIZE);
71
return 0;
72
}
73
@@ -239,7 +239,8 @@ static size_t lz4_decompressor_put(struct decompressor_state *state, const char
239
240
if (state->buffer_pos + size > state->buffer_len) {
241
error("STREAM: Decompressor buffer overflow %lu + %lu > %lu",
242
- state->buffer_pos, size, state->buffer_len);
242
+ (long unsigned int) state->buffer_pos, (long unsigned int) size,
243
+ (long unsigned int) state->buffer_len);
244
size = state->buffer_len - state->buffer_pos;
245
}
246
memcpy(state->buffer + state->buffer_pos, data, size);
@@ -299,7 +300,8 @@ static size_t lz4_decompressor_decompress(struct decompressor_state *state)
300
(void)saving;
301
302
if (old_avg_saving != avg_saving || old_avg_size != avg_size){
302
- debug(D_STREAM, "%s: Saving: %lu%% (avg. %lu%%), avg.size: %lu", STREAM_COMPRESSION_MSG, saving, avg_saving, avg_size);
303
+ debug(D_STREAM, "%s: Saving: %lu%% (avg. %lu%%), avg.size: %lu", STREAM_COMPRESSION_MSG,
304
+ (long unsigned int) saving, (long unsigned int) avg_saving, (long unsigned int) avg_size);
305
}
306
return decompressed_size;
307
}