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++) {
|
||||
bool wrappingChanged = false;
|
||||
_InfoTextField *field = static_cast<_InfoTextField *>(m_fields->ItemAt(i));
|
||||
field->updateLineWrapping(&wrappingChanged,
|
||||
field->updateLineWrapping(&wrappingChanged,
|
||||
heightChanged ? 0 : &heightChanged);
|
||||
float fieldHeight = field->getHeight() + M_V_MARGIN;
|
||||
if (heightChanged) {
|
||||
@@ -360,13 +360,12 @@ void InfoView::addField(
|
||||
BString text) {
|
||||
D_METHOD(("InfoView::addField()\n"));
|
||||
|
||||
m_fields->AddItem(reinterpret_cast<void *>
|
||||
(new _InfoTextField(label, text, this)));
|
||||
m_fields->AddItem(new _InfoTextField(label, text, this));
|
||||
}
|
||||
|
||||
// -------------------------------------------------------- //
|
||||
// *** internal class: _InfoTextField
|
||||
//
|
||||
//
|
||||
// *** ctor/dtor
|
||||
// -------------------------------------------------------- //
|
||||
|
||||
@@ -404,7 +403,7 @@ _InfoTextField::~_InfoTextField() {
|
||||
|
||||
// -------------------------------------------------------- //
|
||||
// *** internal class: _InfoTextField
|
||||
//
|
||||
//
|
||||
// *** operations (public)
|
||||
// -------------------------------------------------------- //
|
||||
|
||||
@@ -479,7 +478,7 @@ void _InfoTextField::updateLineWrapping(
|
||||
currentLine->Remove(i, 1);
|
||||
currentLine->MoveInto(*newLine, i,
|
||||
currentLine->CountChars() - i);
|
||||
m_textLines->AddItem(reinterpret_cast<void *>(currentLine));
|
||||
m_textLines->AddItem(currentLine);
|
||||
currentLine = newLine;
|
||||
break;
|
||||
}
|
||||
@@ -488,7 +487,7 @@ void _InfoTextField::updateLineWrapping(
|
||||
{
|
||||
if (i == currentLine->CountChars() - 1) // the last char in the text
|
||||
{
|
||||
m_textLines->AddItem(reinterpret_cast<void *>(currentLine));
|
||||
m_textLines->AddItem(currentLine);
|
||||
currentLine = 0;
|
||||
break;
|
||||
}
|
||||
@@ -505,7 +504,7 @@ void _InfoTextField::updateLineWrapping(
|
||||
BString *newLine = new BString();
|
||||
currentLine->MoveInto(*newLine, lastBreak,
|
||||
currentLine->CountChars() - lastBreak);
|
||||
m_textLines->AddItem(reinterpret_cast<void *>(currentLine));
|
||||
m_textLines->AddItem(currentLine);
|
||||
currentLine = newLine;
|
||||
break;
|
||||
}
|
||||
@@ -539,7 +538,7 @@ void _InfoTextField::updateLineWrapping(
|
||||
|
||||
// -------------------------------------------------------- //
|
||||
// *** internal class: _InfoTextField
|
||||
//
|
||||
//
|
||||
// *** accessors (public)
|
||||
// -------------------------------------------------------- //
|
||||
|
||||
@@ -580,12 +579,12 @@ bool
|
||||
_InfoTextField::isWrapped() const {
|
||||
D_ACCESS(("_InfoTextField::isWrapped()\n"));
|
||||
|
||||
return (m_textLines->CountItems() > 1);
|
||||
return (m_textLines->CountItems() > 1);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------- //
|
||||
// *** internal class: _InfoTextField
|
||||
//
|
||||
//
|
||||
// *** static internal methods (private)
|
||||
// -------------------------------------------------------- //
|
||||
|
||||
|
||||
Reference in New Issue
Block a user