* As pointed out by Rene the buffer size in snprintf

includes the 0-terminator.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39995 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Pfeiffer 2010-12-28 21:24:58 +00:00
parent fdee209b00
commit 737e45854e
2 changed files with 7 additions and 7 deletions

View File

@ -216,7 +216,7 @@ JobItem::Update()
off_t size;
if (node.GetSize(&size) == B_OK) {
char buffer[80];
snprintf(buffer, sizeof(buffer) - 1, B_TRANSLATE("%.2f KB"),
snprintf(buffer, sizeof(buffer), B_TRANSLATE("%.2f KB"),
size / 1024.0);
fSize = buffer;
}

View File

@ -524,23 +524,23 @@ ConfigWindow::UpdateUI()
== B_OK && copies > 1) {
if (printRange) {
job = B_TRANSLATE("Page %1 to %2, %3 copies");
snprintf(number, sizeof(number) - 1, "%d", (int)first);
snprintf(number, sizeof(number), "%d", (int)first);
job.ReplaceFirst("%1", number);
snprintf(number, sizeof(number) - 1, "%d", (int)last);
snprintf(number, sizeof(number), "%d", (int)last);
job.ReplaceFirst("%2", number);
snprintf(number, sizeof(number) - 1, "%d", (int)copies);
snprintf(number, sizeof(number), "%d", (int)copies);
job.ReplaceFirst("%3", number);
} else {
job = B_TRANSLATE("All pages, %1 copies");
snprintf(number, sizeof(number) - 1, "%d", (int)copies);
snprintf(number, sizeof(number), "%d", (int)copies);
job.ReplaceFirst("%1", number);
}
} else {
if (printRange) {
job = B_TRANSLATE("Page %1 to %2");
snprintf(number, sizeof(number) - 1, "%d", (int)first);
snprintf(number, sizeof(number), "%d", (int)first);
job.ReplaceFirst("%1", number);
snprintf(number, sizeof(number) - 1, "%d", (int)last);
snprintf(number, sizeof(number), "%d", (int)last);
job.ReplaceFirst("%2", number);
} else
job = B_TRANSLATE("All pages");