CID 6942, 6943. SECURE_CODING. Replacing sprintf() with BString::SetToFormat(). App name localization. Partially untested. I have no TV card.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40970 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jonas Sundström 2011-03-16 13:28:31 +00:00
parent 31db75d0ae
commit 8f8e1924c9

View File

@ -85,7 +85,8 @@ enum
MainWin::MainWin(BRect frame_rect) MainWin::MainWin(BRect frame_rect)
: BWindow(frame_rect, B_TRANSLATE(NAME), B_TITLED_WINDOW, :
BWindow(frame_rect, B_TRANSLATE_APP_NAME(NAME), B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS /* | B_WILL_ACCEPT_FIRST_CLICK */) B_ASYNCHRONOUS_CONTROLS /* | B_WILL_ACCEPT_FIRST_CLICK */)
, fController(new Controller) , fController(new Controller)
, fIsFullscreen(false) , fIsFullscreen(false)
@ -299,10 +300,12 @@ MainWin::SetupChannelMenu()
fChannelMenu->AddSeparatorItem(); fChannelMenu->AddSeparatorItem();
} }
char s[100];
for (int i = 0; i < channels; i++) { for (int i = 0; i < channels; i++) {
sprintf(s, "%s%d %s", (i < 9) ? " " : "", i + 1, fController->ChannelName(i)); BString string;
fChannelMenu->AddItem(new BMenuItem(s, new BMessage(M_SELECT_CHANNEL + i))); string.SetToFormat("%s%d %s", (i < 9) ? " " : "", i + 1,
fController->ChannelName(i));
fChannelMenu->AddItem(new BMenuItem(string,
new BMessage(M_SELECT_CHANNEL + i)));
} }
} }
@ -703,11 +706,12 @@ MainWin::FrameResized(float new_width, float new_height)
void void
MainWin::UpdateWindowTitle() MainWin::UpdateWindowTitle()
{ {
char buf[100]; BString title;
sprintf(buf, "%s - %d x %d, %.3f:%.3f => %.0f x %.0f", B_TRANSLATE(NAME), title.SetToFormat("%s - %d x %d, %.3f:%.3f => %.0f x %.0f",
B_TRANSLATE_APP_NAME(NAME),
fSourceWidth, fSourceHeight, fWidthScale, fHeightScale, fSourceWidth, fSourceHeight, fWidthScale, fHeightScale,
fVideoView->Bounds().Width() + 1, fVideoView->Bounds().Height() + 1); fVideoView->Bounds().Width() + 1, fVideoView->Bounds().Height() + 1);
SetTitle(buf); SetTitle(title);
} }