From 1e35cfaea26449d8f005c80f756a3981e1236191 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Mon, 9 Jun 2014 15:25:44 -0400 Subject: [PATCH] Expander: replace string manip with asprintf() --- src/apps/expander/DirectoryFilePanel.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/apps/expander/DirectoryFilePanel.cpp b/src/apps/expander/DirectoryFilePanel.cpp index 80dbd95562..1b87b030bc 100644 --- a/src/apps/expander/DirectoryFilePanel.cpp +++ b/src/apps/expander/DirectoryFilePanel.cpp @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -106,14 +107,6 @@ DirectoryFilePanel::SelectionChanged() { Window()->Lock(); - char label[64]; - entry_ref ref; - GetPanelDirectory(&ref); - if (snprintf(label, sizeof(label), - B_TRANSLATE("Select '%s'"), ref.name) >= (int)sizeof(label)) { - strcpy(label + sizeof(label) - 5, B_UTF8_ELLIPSIS "'"); - } - // Resize button so that the label fits // maximum width is dictated by the window's size limits @@ -123,7 +116,14 @@ DirectoryFilePanel::SelectionChanged() maxWidth -= Window()->Bounds().Width() + 8 - fCurrentButton->Frame().right; BRect oldBounds = fCurrentButton->Bounds(); + + char* label; + entry_ref ref; + GetPanelDirectory(&ref); + asprintf(&label, B_TRANSLATE("Select '%s'" B_UTF8_ELLIPSIS), ref.name); fCurrentButton->SetLabel(label); + free(label); + float width; float height; fCurrentButton->GetPreferredSize(&width, &height);