BugFix 2: fix errors found by cppcheck

Change-Id: I262af4dcf3ad1dca9d7e7d88838ae90323303c1d
Reviewed-on: https://review.haiku-os.org/c/1294
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Lee Mon 2019-03-13 21:17:28 +03:00 committed by waddlesplash
parent 446dc38f89
commit d04d9b2519
8 changed files with 11 additions and 8 deletions

View File

@ -47,6 +47,7 @@ FileSystemVisitor::Next()
while (true) {
const char* name = NULL;
char treeName[B_FILE_NAME_LENGTH];
Inode* inode;
Vnode vnode;
@ -97,7 +98,6 @@ FileSystemVisitor::Next()
vnode.Keep();
}
} else {
char treeName[B_FILE_NAME_LENGTH];
uint16 length;
ino_t id;

View File

@ -91,7 +91,7 @@ atari_identify_partition(int fd, partition_data *partition, void **_cookie)
if (arb->Checksum() == 0x55aa)
weight -= 0.1; /* possible but likely a PC sector */
if (arb->_reserved_1[1] != 0x00)
if (arb->_reserved_1[0] != 0x00)
weight -= 10;
/* hope so */
if (arb->MaxPartitionSize() < 10)

View File

@ -504,7 +504,7 @@ int mapname(__G__ renamed)
!= (RO_extra_block *)NULL)
{
/* file *must* have a RISC OS extra field */
long ft = (long)makelong((ef_spark->loadaddr);
long ft = (long)makelong(ef_spark->loadaddr);
/*32-bit*/
if (lastcomma) {
pp = lastcomma + 1;

View File

@ -464,6 +464,8 @@ ShelfContainerViewFilter::_ObjectDropFilter(BMessage *msg, BHandler **_handler)
BDragger *dragger = NULL;
if (handler)
dragger = dynamic_cast<BDragger*>(handler);
else
return B_SKIP_MESSAGE;
BRect rect;
if (dragger->fRelation == BDragger::TARGET_IS_CHILD)

View File

@ -522,7 +522,7 @@ BDeskWindow::AddWindowContextMenus(BMenu* menu)
#ifdef CUT_COPY_PASTE_IN_CONTEXT_MENU
BMenuItem* pasteItem = new BMenuItem(B_TRANSLATE("Paste"),
new BMessage(B_PASTE), 'V'));
new BMessage(B_PASTE), 'V');
menu->AddItem(pasteItem);
menu->AddSeparatorItem();
#endif

View File

@ -606,7 +606,7 @@ BNavMenu::NewModelItem(Model* model, const BMessage* invokeMessage,
if (newResolvedModel->InitCheck() != B_OK) {
// broken link, still can show though, bail
delete newResolvedModel;
result = 0;
result = NULL;
} else
result = newResolvedModel;
}

View File

@ -178,7 +178,7 @@ scan_char (char *cp, char *valp)
}
/* Scan a string delimited by white-space. Fails on empty string or
if string is doesn't fit in the specified buffer. */
if string doesn't fit in the specified buffer. */
static inline char *
scan_string (char *cp, char *valp, size_t buf_size)
{
@ -195,7 +195,8 @@ scan_string (char *cp, char *valp, size_t buf_size)
}
if (i == 0 || i >= buf_size)
return NULL;
valp[i] = '\0';
if (valp != NULL)
valp[i] = '\0';
return cp;
}

View File

@ -614,8 +614,8 @@ getaddrinfo(const char *hostname, const char *servname,
cur = cur->ai_next;
}
}
}
#endif
}
/* XXX */
if (sentinel.ai_next)