Author: kirilla Date: 2011-03-16 14:28:31 +0100 (Wed, 16 Mar 2011) New Revision: 40970 Changeset: http://dev.haiku-os.org/changeset/40970 Modified: haiku/trunk/src/apps/tv/MainWin.cpp Log: CID 6942, 6943. SECURE_CODING. Replacing sprintf() with BString::SetToFormat(). App name localization. Partially untested. I have no TV card. Modified: haiku/trunk/src/apps/tv/MainWin.cpp =================================================================== --- haiku/trunk/src/apps/tv/MainWin.cpp 2011-03-16 10:58:38 UTC (rev 40969) +++ haiku/trunk/src/apps/tv/MainWin.cpp 2011-03-16 13:28:31 UTC (rev 40970) @@ -85,7 +85,8 @@ 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 @@ 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 @@ 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); }