mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Cleanup: Converted all sprintf to snprintf
This commit is contained in:
parent
9e5a0f0e61
commit
48167f53eb
8 changed files with 24 additions and 32 deletions
|
@ -155,10 +155,10 @@ std::string formatBytes (size_t bytes)
|
|||
{
|
||||
char formatted[24];
|
||||
|
||||
if (bytes >= 995000000) sprintf (formatted, "%.1f %s", (bytes / 1000000000.0), STRING_UTIL_GIBIBYTES);
|
||||
else if (bytes >= 995000) sprintf (formatted, "%.1f %s", (bytes / 1000000.0), STRING_UTIL_MEBIBYTES);
|
||||
else if (bytes >= 995) sprintf (formatted, "%.1f %s", (bytes / 1000.0), STRING_UTIL_KIBIBYTES);
|
||||
else sprintf (formatted, "%d %s", (int)bytes, STRING_UTIL_BYTES);
|
||||
if (bytes >= 995000000) snprintf (formatted, 24, "%.1f %s", (bytes / 1000000000.0), STRING_UTIL_GIBIBYTES);
|
||||
else if (bytes >= 995000) snprintf (formatted, 24, "%.1f %s", (bytes / 1000000.0), STRING_UTIL_MEBIBYTES);
|
||||
else if (bytes >= 995) snprintf (formatted, 24, "%.1f %s", (bytes / 1000.0), STRING_UTIL_KIBIBYTES);
|
||||
else snprintf (formatted, 24, "%d %s", (int)bytes, STRING_UTIL_BYTES);
|
||||
|
||||
return Lexer::commify (formatted);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue