cortex: Fix PVS 1206
* Remove cast to void* in AddItem() at line 363, so that avoid that the object which was created using 'new' operator is immediately cast to another type. * Also remove other casts in AddItem(). Change-Id: Ia20ab39ef50dce12b9d06ca5b1736a8a8e3e9cdd Reviewed-on: https://review.haiku-os.org/c/856 Reviewed-by: Barrett17 <[email protected]>
This commit is contained in:
@@ -292,7 +292,7 @@ void InfoView::FrameResized(
|
|||||||
for (int32 i = 0; i < m_fields->CountItems(); i++) {
|
for (int32 i = 0; i < m_fields->CountItems(); i++) {
|
||||||
bool wrappingChanged = false;
|
bool wrappingChanged = false;
|
||||||
_InfoTextField *field = static_cast<_InfoTextField *>(m_fields->ItemAt(i));
|
_InfoTextField *field = static_cast<_InfoTextField *>(m_fields->ItemAt(i));
|
||||||
field->updateLineWrapping(&wrappingChanged,
|
field->updateLineWrapping(&wrappingChanged,
|
||||||
heightChanged ? 0 : &heightChanged);
|
heightChanged ? 0 : &heightChanged);
|
||||||
float fieldHeight = field->getHeight() + M_V_MARGIN;
|
float fieldHeight = field->getHeight() + M_V_MARGIN;
|
||||||
if (heightChanged) {
|
if (heightChanged) {
|
||||||
@@ -360,13 +360,12 @@ void InfoView::addField(
|
|||||||
BString text) {
|
BString text) {
|
||||||
D_METHOD(("InfoView::addField()\n"));
|
D_METHOD(("InfoView::addField()\n"));
|
||||||
|
|
||||||
m_fields->AddItem(reinterpret_cast<void *>
|
m_fields->AddItem(new _InfoTextField(label, text, this));
|
||||||
(new _InfoTextField(label, text, this)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------- //
|
// -------------------------------------------------------- //
|
||||||
// *** internal class: _InfoTextField
|
// *** internal class: _InfoTextField
|
||||||
//
|
//
|
||||||
// *** ctor/dtor
|
// *** ctor/dtor
|
||||||
// -------------------------------------------------------- //
|
// -------------------------------------------------------- //
|
||||||
|
|
||||||
@@ -404,7 +403,7 @@ _InfoTextField::~_InfoTextField() {
|
|||||||
|
|
||||||
// -------------------------------------------------------- //
|
// -------------------------------------------------------- //
|
||||||
// *** internal class: _InfoTextField
|
// *** internal class: _InfoTextField
|
||||||
//
|
//
|
||||||
// *** operations (public)
|
// *** operations (public)
|
||||||
// -------------------------------------------------------- //
|
// -------------------------------------------------------- //
|
||||||
|
|
||||||
@@ -479,7 +478,7 @@ void _InfoTextField::updateLineWrapping(
|
|||||||
currentLine->Remove(i, 1);
|
currentLine->Remove(i, 1);
|
||||||
currentLine->MoveInto(*newLine, i,
|
currentLine->MoveInto(*newLine, i,
|
||||||
currentLine->CountChars() - i);
|
currentLine->CountChars() - i);
|
||||||
m_textLines->AddItem(reinterpret_cast<void *>(currentLine));
|
m_textLines->AddItem(currentLine);
|
||||||
currentLine = newLine;
|
currentLine = newLine;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -488,7 +487,7 @@ void _InfoTextField::updateLineWrapping(
|
|||||||
{
|
{
|
||||||
if (i == currentLine->CountChars() - 1) // the last char in the text
|
if (i == currentLine->CountChars() - 1) // the last char in the text
|
||||||
{
|
{
|
||||||
m_textLines->AddItem(reinterpret_cast<void *>(currentLine));
|
m_textLines->AddItem(currentLine);
|
||||||
currentLine = 0;
|
currentLine = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -505,7 +504,7 @@ void _InfoTextField::updateLineWrapping(
|
|||||||
BString *newLine = new BString();
|
BString *newLine = new BString();
|
||||||
currentLine->MoveInto(*newLine, lastBreak,
|
currentLine->MoveInto(*newLine, lastBreak,
|
||||||
currentLine->CountChars() - lastBreak);
|
currentLine->CountChars() - lastBreak);
|
||||||
m_textLines->AddItem(reinterpret_cast<void *>(currentLine));
|
m_textLines->AddItem(currentLine);
|
||||||
currentLine = newLine;
|
currentLine = newLine;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -539,7 +538,7 @@ void _InfoTextField::updateLineWrapping(
|
|||||||
|
|
||||||
// -------------------------------------------------------- //
|
// -------------------------------------------------------- //
|
||||||
// *** internal class: _InfoTextField
|
// *** internal class: _InfoTextField
|
||||||
//
|
//
|
||||||
// *** accessors (public)
|
// *** accessors (public)
|
||||||
// -------------------------------------------------------- //
|
// -------------------------------------------------------- //
|
||||||
|
|
||||||
@@ -580,12 +579,12 @@ bool
|
|||||||
_InfoTextField::isWrapped() const {
|
_InfoTextField::isWrapped() const {
|
||||||
D_ACCESS(("_InfoTextField::isWrapped()\n"));
|
D_ACCESS(("_InfoTextField::isWrapped()\n"));
|
||||||
|
|
||||||
return (m_textLines->CountItems() > 1);
|
return (m_textLines->CountItems() > 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------- //
|
// -------------------------------------------------------- //
|
||||||
// *** internal class: _InfoTextField
|
// *** internal class: _InfoTextField
|
||||||
//
|
//
|
||||||
// *** static internal methods (private)
|
// *** static internal methods (private)
|
||||||
// -------------------------------------------------------- //
|
// -------------------------------------------------------- //
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user