From b222c363913badd2fc4d0dcf24a5cfa2f5e2a12e Mon Sep 17 00:00:00 2001
From: dsizzle <dcieslak@yahoo.com>
Date: Mon, 24 Nov 2014 21:20:37 +0000
Subject: [PATCH] 3651: Enhancement 2 - rewrote C-style string code to use
BString
---
src/apps/charactermap/CharacterWindow.cpp | 24 +++++-------------------
1 file changed, 5 insertions(+), 19 deletions(-)
diff --git a/src/apps/charactermap/CharacterWindow.cpp b/src/apps/charactermap/CharacterWindow.cpp
index d159c0e..ff6d1cb 100644
a
|
b
|
CharacterWindow::CharacterWindow()
|
177 | 177 | |
178 | 178 | const char* family; |
179 | 179 | const char* style; |
180 | | char* displayName; |
| 180 | BString displayName; |
181 | 181 | |
182 | 182 | if (settings.FindString("font family", &family) == B_OK |
183 | 183 | && settings.FindString("font style", &style) == B_OK) { |
184 | 184 | _SetFont(family, style); |
185 | | displayName = new char[strlen(family) + strlen(style) + 4]; |
186 | | strcpy(displayName, family); |
187 | | strcat(displayName, " > "); |
188 | | strcat(displayName, style); |
| 185 | displayName << family << " " << style; |
189 | 186 | } else { |
190 | 187 | font_family currentFontFamily; |
191 | 188 | font_style currentFontStyle; |
192 | 189 | fCharacterView->CharacterFont().GetFamilyAndStyle(¤tFontFamily, |
193 | 190 | ¤tFontStyle); |
194 | | displayName = new char[strlen(currentFontFamily) |
195 | | + strlen(currentFontStyle) + 4]; |
196 | | strcpy(displayName, currentFontFamily); |
197 | | strcat(displayName, " > "); |
198 | | strcat(displayName, currentFontStyle); |
| 191 | displayName << currentFontFamily << " " << currentFontStyle; |
199 | 192 | } |
200 | 193 | |
201 | 194 | int32 fontSize; |
… |
… |
CharacterWindow::CharacterWindow()
|
219 | 212 | new BMessage(kMsgFontSizeChanged), kMinFontSize, kMaxFontSize); |
220 | 213 | fFontSizeSlider->SetValue(fontSize); |
221 | 214 | fFontSizeSlider->SetLabel(displayName); |
222 | | delete(displayName); |
223 | 215 | |
224 | 216 | fCodeView = new BStringView("code", "-"); |
225 | 217 | fCodeView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, |
… |
… |
CharacterWindow::MessageReceived(BMessage* message)
|
407 | 399 | |
408 | 400 | _SetFont(item->Menu()->Name(), item->Label()); |
409 | 401 | |
410 | | char* displayName; |
411 | | displayName = new char[strlen(item->Menu()->Name()) |
412 | | +strlen(item->Label()) + 4]; |
413 | | strcpy(displayName, item->Menu()->Name()); |
414 | | strcat(displayName, " > "); |
415 | | strcat(displayName, item->Label()); |
| 402 | BString displayName; |
| 403 | displayName << item->Menu()->Name() << " " << item->Label(); |
416 | 404 | |
417 | 405 | fFontSizeSlider->SetLabel(displayName); |
418 | 406 | |
419 | | delete(displayName); |
420 | | |
421 | 407 | item = item->Menu()->Superitem(); |
422 | 408 | item->SetMarked(true); |
423 | 409 | } |