Fixed Volume sizes unit in info window, using string_for_size().

This fix #6395.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37764 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Houdoin 2010-07-27 08:40:13 +00:00
parent c090a0fd84
commit b599c219a3

View File

@ -1546,16 +1546,11 @@ AttributeView::CheckAndSetSize()
fFreeBytes = freeBytes; fFreeBytes = freeBytes;
char capacityStr[16], usedStr[16], freeStr[16]; char capacityStr[16], usedStr[16], freeStr[16];
sprintf(usedStr, "%.1f", (float)(capacity - fFreeBytes) / kMBSize); string_for_size(capacity, capacityStr, sizeof(capacityStr));
sprintf(freeStr, "%.1f", (float)fFreeBytes / kMBSize); string_for_size(capacity - fFreeBytes, usedStr, sizeof(usedStr));
string_for_size(fFreeBytes, freeStr, sizeof(freeStr));
if (capacity >= kGBSize) { fSizeStr.SetTo(B_TRANSLATE("%capacity (%used used -- %free free)"));
fSizeStr.SetTo(B_TRANSLATE("%capacity GB (%used MB used -- %free MB free)"));
sprintf(capacityStr, "%.1f", (float)capacity / kGBSize);
} else {
fSizeStr.SetTo(B_TRANSLATE("%capacity MB (%used MB used -- %free MB free)"));
sprintf(capacityStr, "%.1f", (float)capacity / kMBSize);
}
fSizeStr.ReplaceFirst("%capacity", capacityStr); fSizeStr.ReplaceFirst("%capacity", capacityStr);
fSizeStr.ReplaceFirst("%used", usedStr); fSizeStr.ReplaceFirst("%used", usedStr);
fSizeStr.ReplaceFirst("%free", freeStr); fSizeStr.ReplaceFirst("%free", freeStr);