tree-wide: voidify unchecked snprintf calls
According to Coverity, 194 ouf of 227 times we check for snprintf return code. Voidify the rest. CID#1461512 CID#1461513 CID#1461514 CID#1461515 CID#1461516 CID#1461518 CID#1461519 CID#1461520 CID#1461522
This commit is contained in:
+12
-12
@@ -56,23 +56,23 @@ char *format_bytes_full(char *buf, size_t l, uint64_t t, FormatBytesFlag flag) {
|
||||
for (size_t i = 0; i < n; i++)
|
||||
if (t >= table[i].factor) {
|
||||
if (flag & FORMAT_BYTES_BELOW_POINT) {
|
||||
snprintf(buf, l,
|
||||
"%" PRIu64 ".%" PRIu64 "%s",
|
||||
t / table[i].factor,
|
||||
i != n - 1 ?
|
||||
(t / table[i + 1].factor * UINT64_C(10) / table[n - 1].factor) % UINT64_C(10):
|
||||
(t * UINT64_C(10) / table[i].factor) % UINT64_C(10),
|
||||
table[i].suffix);
|
||||
(void) snprintf(buf, l,
|
||||
"%" PRIu64 ".%" PRIu64 "%s",
|
||||
t / table[i].factor,
|
||||
i != n - 1 ?
|
||||
(t / table[i + 1].factor * UINT64_C(10) / table[n - 1].factor) % UINT64_C(10):
|
||||
(t * UINT64_C(10) / table[i].factor) % UINT64_C(10),
|
||||
table[i].suffix);
|
||||
} else
|
||||
snprintf(buf, l,
|
||||
"%" PRIu64 "%s",
|
||||
t / table[i].factor,
|
||||
table[i].suffix);
|
||||
(void) snprintf(buf, l,
|
||||
"%" PRIu64 "%s",
|
||||
t / table[i].factor,
|
||||
table[i].suffix);
|
||||
|
||||
goto finish;
|
||||
}
|
||||
|
||||
snprintf(buf, l, "%" PRIu64 "%s", t, flag & FORMAT_BYTES_TRAILING_B ? "B" : "");
|
||||
(void) snprintf(buf, l, "%" PRIu64 "%s", t, flag & FORMAT_BYTES_TRAILING_B ? "B" : "");
|
||||
|
||||
finish:
|
||||
buf[l-1] = 0;
|
||||
|
||||
Reference in New Issue
Block a user