From 8f8e1924c9935cba95458434890ec482bbd03661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sundstr=C3=B6m?= Date: Wed, 16 Mar 2011 13:28:31 +0000 Subject: [PATCH] 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 --- src/apps/tv/MainWin.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/apps/tv/MainWin.cpp b/src/apps/tv/MainWin.cpp index afd03a95df..5817b71c79 100644 --- a/src/apps/tv/MainWin.cpp +++ b/src/apps/tv/MainWin.cpp @@ -85,7 +85,8 @@ enum 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 */) , fController(new Controller) , fIsFullscreen(false) @@ -299,10 +300,12 @@ MainWin::SetupChannelMenu() fChannelMenu->AddSeparatorItem(); } - char s[100]; for (int i = 0; i < channels; i++) { - sprintf(s, "%s%d %s", (i < 9) ? " " : "", i + 1, fController->ChannelName(i)); - fChannelMenu->AddItem(new BMenuItem(s, new BMessage(M_SELECT_CHANNEL + i))); + BString string; + 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 MainWin::UpdateWindowTitle() { - char buf[100]; - sprintf(buf, "%s - %d x %d, %.3f:%.3f => %.0f x %.0f", B_TRANSLATE(NAME), - fSourceWidth, fSourceHeight, fWidthScale, fHeightScale, + BString title; + title.SetToFormat("%s - %d x %d, %.3f:%.3f => %.0f x %.0f", + B_TRANSLATE_APP_NAME(NAME), + fSourceWidth, fSourceHeight, fWidthScale, fHeightScale, fVideoView->Bounds().Width() + 1, fVideoView->Bounds().Height() + 1); - SetTitle(buf); + SetTitle(title); }