Skip to content

Commit

Permalink
Nebula: Convert fixed length char array to BString
Browse files Browse the repository at this point in the history
  • Loading branch information
jscipione committed Jul 8, 2015
1 parent d1c13fd commit 3ad91dc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/add-ons/screen_savers/nebula/Nebula.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <LayoutBuilder.h>
#include <Window.h>
#include <ScreenSaver.h>
#include <String.h>
#include <SupportDefs.h>

#include <math.h>
Expand Down Expand Up @@ -465,15 +466,16 @@ SettingsView::SettingsView(BRect frame)

popMenu = new BPopUpMenu("");
for (int32 i = 0; i < widthsLength; i++) {
BMessage* message = new BMessage(kMsgWidth);
char label[64];
BString label;
if (widths[i] == 0)
sprintf(label, "screen resolution");
label.SetTo("screen resolution");
else
sprintf(label, "%ld pixels", widths[i]);
label.SetToFormat("%ld pixels", widths[i]);

BMessage* message = new BMessage(kMsgWidth);
message->AddInt32("width", widths[i]);
popMenu->AddItem(item = new BMenuItem(label, message));

popMenu->AddItem(item = new BMenuItem(label.String(), message));

if (gSettingsWidth == widths[i])
item->SetMarked(true);
Expand Down

0 comments on commit 3ad91dc

Please sign in to comment.