[Coverity] Fixed some uninit fields and return values checks

* Fixed CID2398, CID9945, CID9943, CID4215
This commit is contained in:
Siarzhuk Zharski 2012-02-02 22:02:53 +01:00
parent 1acd796b6b
commit a2f89c5843
5 changed files with 26 additions and 6 deletions

View File

@ -492,7 +492,9 @@ AppearancePrefView::_MakeMenu(uint32 msg, const char** items,
i++;
}
menu->FindItem(defaultItemName)->SetMarked(true);
BMenuItem* defaultItem = menu->FindItem(defaultItemName);
if (defaultItem)
defaultItem->SetMarked(true);
return menu;
}

View File

@ -98,9 +98,20 @@ BasicTerminalBuffer::_CursorChanged()
BasicTerminalBuffer::BasicTerminalBuffer()
:
fWidth(0),
fHeight(0),
fScrollTop(0),
fScrollBottom(0),
fScreen(NULL),
fScreenOffset(0),
fHistory(NULL),
fTabStops(NULL)
fSoftWrappedCursor(false),
fOverwriteMode(false),
fAlternateScreenActive(false),
fOriginMode(false),
fSavedOriginMode(false),
fTabStops(NULL),
fEncoding(M_UTF8)
{
}

View File

@ -45,6 +45,11 @@ struct TerminalBufferDirtyInfo {
invalidateAll = false;
messageSent = false;
}
TerminalBufferDirtyInfo()
{
Reset();
}
};

View File

@ -83,6 +83,8 @@ TermParse::TermParse(int fd)
fBuffer(NULL),
fQuitting(true)
{
memset(fReadBuffer, 0, READ_BUF_SIZE);
memset(fParserBuffer, 0, ESC_PARSER_BUFFER_SIZE);
}

View File

@ -1858,8 +1858,8 @@ TermView::MessageReceived(BMessage *msg)
int32 i;
int32 encodingID;
BMessage specifier;
msg->GetCurrentSpecifier(&i, &specifier);
if (!strcmp("encoding", specifier.FindString("property", i))){
if (msg->GetCurrentSpecifier(&i, &specifier) == B_OK
&& !strcmp("encoding", specifier.FindString("property", i))) {
msg->FindInt32 ("data", &encodingID);
SetEncoding(encodingID);
msg->SendReply(B_REPLY);
@ -1873,8 +1873,8 @@ TermView::MessageReceived(BMessage *msg)
{
int32 i;
BMessage specifier;
msg->GetCurrentSpecifier(&i, &specifier);
if (!strcmp("encoding", specifier.FindString("property", i))){
if (msg->GetCurrentSpecifier(&i, &specifier) == B_OK
&& !strcmp("encoding", specifier.FindString("property", i))) {
BMessage reply(B_REPLY);
reply.AddInt32("result", Encoding());
msg->SendReply(&reply);