Skip to content

Commit

Permalink
Merge pull request xbmc#7724 from ace20022/oob
Browse files Browse the repository at this point in the history
[coverity] Add an additional check to prevent an only theoretical out-of…
  • Loading branch information
MartijnKaijser committed Aug 12, 2015
2 parents 62ad21a + 296a0c9 commit 3f1ce3b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions xbmc/utils/StringUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,13 @@ std::string StringUtils::SizeToString(int64_t size)

if (!i)
strLabel = StringUtils::Format("%.0lf B", s);
else if (i == ARRAY_SIZE(prefixes))
{
if (s >= 1000.0)
strLabel = StringUtils::Format(">999.99 %cB", prefixes[i - 1]);
else
strLabel = StringUtils::Format("%.2lf %cB", s, prefixes[i - 1]);
}
else if (s >= 100.0)
strLabel = StringUtils::Format("%.1lf %cB", s, prefixes[i]);
else
Expand Down

0 comments on commit 3f1ce3b

Please sign in to comment.