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:
Murai Takashi
2019-01-07 12:23:48 +00:00
committed by Barrett17
parent ae09eb30c5
commit 27a59a2fa4
+4 -5
View File
@@ -360,8 +360,7 @@ 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));
}
// -------------------------------------------------------- //
@@ -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;
}