Localized some still missed strings pointed out by Diver. Thanks!

Use more safe snprintf calls instead of sprintf ones.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40746 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Siarzhuk Zharski
2011-02-28 21:59:23 +00:00
parent 89da0f8f9b
commit 0a1ce0a8a4
6 changed files with 25 additions and 11 deletions
+2
View File
@@ -28,6 +28,8 @@ DoCatalogs ProcessController :
x-vnd.Haiku-ProcessController
:
KernelMemoryBarMenuItem.cpp
MemoryBarMenu.cpp
MemoryBarMenuItem.cpp
NoiseBarMenuItem.cpp
PCWorld.cpp
Preferences.cpp
@@ -152,11 +152,13 @@ KernelMemoryBarMenuItem::DrawBar(bool force)
menu->SetHighColor(kBlack);
char infos[128];
sprintf(infos, B_TRANSLATE("%.1f MB"), fCachedMemory / 1024.f);
snprintf(infos, sizeof(infos),
B_TRANSLATE("%.1f MB"), fCachedMemory / 1024.f);
BPoint loc(cadre.left, cadre.bottom + 1);
loc.x -= kMargin + gMemoryTextWidth / 2 + menu->StringWidth(infos);
menu->DrawString(infos, loc);
sprintf(infos, B_TRANSLATE("%.1f MB"), fCommittedMemory / 1024.f);
snprintf(infos, sizeof(infos),
B_TRANSLATE("%.1f MB"), fCommittedMemory / 1024.f);
loc.x = cadre.left - kMargin - menu->StringWidth(infos);
menu->DrawString(infos, loc);
fLastSum = sum;
+5 -1
View File
@@ -24,6 +24,7 @@
#include "ProcessController.h"
#include <Bitmap.h>
#include <Catalog.h>
#include <Roster.h>
#include <Window.h>
@@ -34,6 +35,9 @@
float gMemoryTextWidth;
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MemoryBarMenu"
MemoryBarMenu::MemoryBarMenu(const char* name, info_pack* infos, system_info& systemInfo)
: BMenu(name),
@@ -53,7 +57,7 @@ MemoryBarMenu::MemoryBarMenu(const char* name, info_pack* infos, system_info& sy
fTeamList[k++] = -1;
}
gMemoryTextWidth = 2 * StringWidth("99999 KB") + 20;
gMemoryTextWidth = 2 * StringWidth(B_TRANSLATE("99999 KB")) + 20;
fRecycleCount = EXTRA;
fRecycleList = (MRecycleItem*)malloc(sizeof(MRecycleItem) * fRecycleCount);
@@ -25,9 +25,13 @@
#include "ProcessController.h"
#include <Bitmap.h>
#include <Catalog.h>
#include <stdio.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MemoryBarMenu"
MemoryBarMenuItem::MemoryBarMenuItem(const char *label, team_id team,
BBitmap* icon, bool deleteIcon, BMessage* message)
@@ -210,13 +214,13 @@ MemoryBarMenuItem::DrawBar(bool force)
menu->SetHighColor(kBlack);
char infos[128];
sprintf(infos, "%d KB", fWriteMemory);
snprintf(infos, sizeof(infos), B_TRANSLATE("%d KB"), fWriteMemory);
BPoint loc(rect.left - kMargin - gMemoryTextWidth / 2 - menu->StringWidth(infos),
rect.bottom + 1);
menu->DrawString(infos, loc);
sprintf(infos, "%d KB", fAllMemory);
snprintf(infos, sizeof(infos), B_TRANSLATE("%d KB"), fAllMemory);
loc.x = rect.left - kMargin - menu->StringWidth(infos);
menu->DrawString(infos, loc);
}
+1 -1
View File
@@ -68,7 +68,7 @@ static PriorityRec priorities[] = {
{ "", -1 }
};
PriorityRec customPriority = {"Custom", 0 };
PriorityRec customPriority = { B_TRANSLATE("Custom priority"), 0 };
void
@@ -265,7 +265,7 @@ ProcessController::MessageReceived(BMessage *message)
info_pack infos;
if (get_team_info(team, &infos.team_info) == B_OK) {
get_team_name_and_icon(infos);
sprintf(question,
snprintf(question, sizeof(question),
B_TRANSLATE("Do you really want to kill the team \"%s\"?"),
infos.team_name);
alert = new BAlert("", question,
@@ -289,16 +289,18 @@ ProcessController::MessageReceived(BMessage *message)
thread_info thinfo;
if (get_thread_info(thread, &thinfo) == B_OK) {
#if DEBUG_THREADS
sprintf(question, B_TRANSLATE("What do you want to do "
"with the thread \"%s\"?"), thinfo.name);
snprintf(question, sizeof(question),
B_TRANSLATE("What do you want to do "
"with the thread \"%s\"?"), thinfo.name);
alert = new BAlert("", question, B_TRANSLATE("Cancel"),
B_TRANSLATE("Debug this thread!"),
B_TRANSLATE("Kill this thread!"), B_WIDTH_AS_USUAL,
B_STOP_ALERT);
#define KILL 2
#else
sprintf(question, B_TRANSLATE("Are you sure you want "
"to kill the thread \"%s\"?"), thinfo.name);
snprintf(question, sizeof(question),
B_TRANSLATE("Are you sure you want "
"to kill the thread \"%s\"?"), thinfo.name);
alert = new BAlert("", question, B_TRANSLATE("Cancel"),
B_TRANSLATE("Kill this thread!"), NULL, B_WIDTH_AS_USUAL,
B_STOP_ALERT);