Replaced delete[] by free() as noticed by Konrad on IRC
Better style git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10466 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
8e9afca70f
commit
8f8f6df533
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
// Standard Includes -----------------------------------------------------------
|
// Standard Includes -----------------------------------------------------------
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <posix/string.h>
|
#include <posix/string.h>
|
||||||
|
|
||||||
// System Includes -------------------------------------------------------------
|
// System Includes -------------------------------------------------------------
|
||||||
@ -57,13 +58,11 @@ BStringView::BStringView(BMessage* data)
|
|||||||
{
|
{
|
||||||
const char* text;
|
const char* text;
|
||||||
|
|
||||||
if (data->FindInt32("_aligne",(int32&)fAlign) != B_OK)
|
if (data->FindInt32("_aligne",(int32&)fAlign) != B_OK) {
|
||||||
{
|
|
||||||
fAlign = B_ALIGN_LEFT;
|
fAlign = B_ALIGN_LEFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->FindString("_text",&text) != B_OK)
|
if (data->FindString("_text",&text) != B_OK) {
|
||||||
{
|
|
||||||
text = NULL;
|
text = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,8 +71,7 @@ BStringView::BStringView(BMessage* data)
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
BArchivable* BStringView::Instantiate(BMessage* data)
|
BArchivable* BStringView::Instantiate(BMessage* data)
|
||||||
{
|
{
|
||||||
if (!validate_instantiation(data,"BStringView"))
|
if (!validate_instantiation(data,"BStringView")) {
|
||||||
{
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,8 +82,7 @@ status_t BStringView::Archive(BMessage* data, bool deep) const
|
|||||||
{
|
{
|
||||||
BView::Archive(data, deep);
|
BView::Archive(data, deep);
|
||||||
|
|
||||||
if (fText)
|
if (fText) {
|
||||||
{
|
|
||||||
data->AddString("_text",fText);
|
data->AddString("_text",fText);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,18 +93,12 @@ status_t BStringView::Archive(BMessage* data, bool deep) const
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
BStringView::~BStringView()
|
BStringView::~BStringView()
|
||||||
{
|
{
|
||||||
if (fText)
|
free(fText);
|
||||||
{
|
|
||||||
delete[] fText;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void BStringView::SetText(const char* text)
|
void BStringView::SetText(const char* text)
|
||||||
{
|
{
|
||||||
if (fText)
|
free(fText);
|
||||||
{
|
|
||||||
delete[] fText;
|
|
||||||
}
|
|
||||||
fText = strdup(text);
|
fText = strdup(text);
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
@ -130,8 +121,7 @@ alignment BStringView::Alignment() const
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void BStringView::AttachedToWindow()
|
void BStringView::AttachedToWindow()
|
||||||
{
|
{
|
||||||
if (Parent())
|
if (Parent()) {
|
||||||
{
|
|
||||||
SetViewColor(Parent()->ViewColor());
|
SetViewColor(Parent()->ViewColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -268,10 +258,3 @@ BStringView& BStringView::operator=(const BStringView&)
|
|||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
/*
|
|
||||||
* $Log $
|
|
||||||
*
|
|
||||||
* $Id $
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user