munin-monitoring / contrib

Contributed stuff for munin (plugins, tools, etc...)
http://munin-monitoring.org
1.05k stars 679 forks source link

network: Fix sscanf format warnings #1415

Closed Philippe23 closed 4 months ago

Philippe23 commented 4 months ago

Compilers warn that "%llu" doesn't match the uint_fast64_t type for all machines.

These are just being sscanf()'ed to be sprintf()'ed a few lines later, there's no need for performance. These can just be vanilla unsigned long long's to match the existing format specifiers.

Example of compiler warning:

if1sec-c.c: In function 'acquire':
if1sec-c.c:189:38: warning: format '%llu' expects argument of type 'long long unsigned int *', but argument 4 has type 'uint_fast64_t *' {aka 'long unsigned int *'} [-Wformat=]
  189 |                         sscanf(line, "%s"
      |                                      ^~~~
......
  195 |                                 , &r_bytes, &r_packets, &r_errs, &r_drop, &r_fifo, &r_frame, &r_compressed, &r_multicast
      |                                   ~~~~~~~~
      |                                   |
      |                                   uint_fast64_t * {aka long unsigned int *}