summaryrefslogtreecommitdiffstats
path: root/listen/utils.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2021-07-28 12:10:06 +0200
committerRalf Baechle <ralf@linux-mips.org>2021-07-28 12:10:06 +0200
commitf2f7b4dde15c553627a85e2d13f2612552994188 (patch)
tree737317956d964d9dd4dc8f144240d0af62e9a678 /listen/utils.c
parent91a2475f102973ef999f7ee6eddc6b4b1631fc4f (diff)
listen: Fix overzealous GCC warnings.
GCC 11 has returned to the old tradition of overzealous warnings. Rewrite the conversion of time in seconds to hours, minutes and seconds to something that not only fixes the warnings but also is more readable. gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -MT listen.o -MD -MP -MF .deps/listen.Tpo -c -o listen.o listen.c listen.c: In function ‘display_timestamp’: listen.c:73:52: warning: ‘%06u’ directive output may be truncated writing 6 bytes into a region of size between 2 and 7 [-Wformat-truncation=] 73 | snprintf(buf, sizeof(buf), "%02d:%02d:%02d.%06u", | ^~~~ listen.c:73:36: note: directive argument in the range [0, 999999] 73 | snprintf(buf, sizeof(buf), "%02d:%02d:%02d.%06u", | ^~~~~~~~~~~~~~~~~~~~~ listen.c:73:9: note: ‘snprintf’ output between 16 and 21 bytes into a destination of size 16 73 | snprintf(buf, sizeof(buf), "%02d:%02d:%02d.%06u", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | hours, minutes, seconds, usec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ listen.c:73:52: warning: ‘%06u’ directive output may be truncated writing 6 bytes into a region of size between 2 and 7 [-Wformat-truncation=] 73 | snprintf(buf, sizeof(buf), "%02d:%02d:%02d.%06u", | ^~~~ listen.c:73:36: note: directive argument in the range [0, 999999] 73 | snprintf(buf, sizeof(buf), "%02d:%02d:%02d.%06u", | ^~~~~~~~~~~~~~~~~~~~~ listen.c:73:9: note: ‘snprintf’ output between 16 and 21 bytes into a destination of size 16 73 | snprintf(buf, sizeof(buf), "%02d:%02d:%02d.%06u", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | hours, minutes, seconds, usec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ listen.c:73:52: warning: ‘%06u’ directive output may be truncated writing 6 bytes into a region of size between 2 and 7 [-Wformat-truncation=] 73 | snprintf(buf, sizeof(buf), "%02d:%02d:%02d.%06u", | ^~~~ listen.c:73:36: note: directive argument in the range [0, 999999] 73 | snprintf(buf, sizeof(buf), "%02d:%02d:%02d.%06u", | ^~~~~~~~~~~~~~~~~~~~~ listen.c:73:9: note: ‘snprintf’ output between 16 and 21 bytes into a destination of size 16 73 | snprintf(buf, sizeof(buf), "%02d:%02d:%02d.%06u", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | hours, minutes, seconds, usec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'listen/utils.c')
0 files changed, 0 insertions, 0 deletions