[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
|
Re: [mosquitto-dev] 2.1.0rc3 available
|
I looked more carefully at the printf format warnings. I think 3 out
of 4 are 32/64 confusion and serious. I have annotated with suggested changes.
{build on NetBSD 9 i386}
[67/760] Building C object src/CMakeFiles/mosquitto.dir/conf.c.o
/tmp/work/net/mosquitto/work/mosquitto-2.1.0rc3/src/conf.c: In function 'config__read_file_core':
/tmp/work/net/mosquitto/work/mosquitto-2.1.0rc3/src/conf.c:2277:79: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'ssize_t {aka int}' [-Wformat=]
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid 'memory_limit' value (%ld).", lim);
~~^
%d
Use %zd for printing ssize_t instead. Should be fine everywhere.
[153/760] Building C object src/CMakeFiles/mosquitto.dir/sys_tree.c.o
In file included from /usr/include/stdio.h:597:0,
from /tmp/work/net/mosquitto/work/mosquitto-2.1.0rc3/src/sys_tree.c:24:
/tmp/work/net/mosquitto/work/mosquitto-2.1.0rc3/src/sys_tree.c: In function 'sys_tree__update':
/tmp/work/net/mosquitto/work/mosquitto-2.1.0rc3/src/sys_tree.c:274:43: warning: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'int64_t {aka long long int}' [-Wformat=]
len = (uint32_t)snprintf(buf, BUFLEN, "%lu", metrics[i].current);
^ ~~~~~~~~~~~~
Suggest {{ "%" PRI64_t "d" }} to align with int64_t.
[174/760] Building C object client/CMakeFiles/mosquitto_rr.dir/rr_client.c.o
/tmp/work/net/mosquitto/work/mosquitto-2.1.0rc3/client/rr_client.c: In function 'report_latency':
/tmp/work/net/mosquitto/work/mosquitto-2.1.0rc3/client/rr_client.c:298:23: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'time_t {aka long long int}' [-Wformat=]
printf("Latency: %ld.%09ld\n", s, ns);
~~^
%lld
Suggest %jd and casting s to (intmax_t).
[224/760] Building C object plugins/examples/add-properties/CMakeFiles/mosquitto_add_properties.dir/mosquitto_add_properties.c.o
In file included from /usr/include/stdio.h:597:0,
from /tmp/work/net/mosquitto/work/mosquitto-2.1.0rc3/plugins/examples/add-properties/mosquitto_add_properties.c:37:
/tmp/work/net/mosquitto/work/mosquitto-2.1.0rc3/plugins/examples/add-properties/mosquitto_add_properties.c: In function 'callback_message_in':
/tmp/work/net/mosquitto/work/mosquitto-2.1.0rc3/plugins/examples/add-properties/mosquitto_add_properties.c:63:31: warning: format '%li' expects argument of type 'long int', but argument 6 has type 'time_t {aka long long int}' [-Wformat=]
snprintf(ts_buf, TS_BUF_LEN, "%li%03lu", ts.tv_sec, ts.tv_nsec / 1000 / 1000);
^ ~~~~
Suggest %jd and casting ts.tv_sec to (intmax_t).