PVS V568: strange uses of sizeof

Change-Id: I4c4e0395f579cf3b5ec4db2c30bbe2dc2d866de7
Reviewed-on: https://review.haiku-os.org/c/1608
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
This commit is contained in:
Adrien Destugues 2019-07-16 20:45:26 +02:00 committed by waddlesplash
parent 994c85678d
commit ff38df48cf
5 changed files with 6 additions and 6 deletions

View File

@ -1101,7 +1101,7 @@ cd_register_device(device_node* node)
// get inquiry data
if (sDeviceManager->get_attr_raw(node, SCSI_DEVICE_INQUIRY_ITEM,
(const void**)&deviceInquiry, &inquiryLength, true) != B_OK
|| inquiryLength < sizeof(deviceInquiry))
|| inquiryLength < sizeof(scsi_res_inquiry))
return B_ERROR;
// get block limit of underlying hardware to lower it (if necessary)

View File

@ -541,7 +541,7 @@ das_register_device(device_node *node)
// get inquiry data
if (sDeviceManager->get_attr_raw(node, SCSI_DEVICE_INQUIRY_ITEM,
(const void **)&deviceInquiry, &inquiryLength, true) != B_OK
|| inquiryLength < sizeof(deviceInquiry))
|| inquiryLength < sizeof(scsi_res_inquiry))
return B_ERROR;
// get block limit of underlying hardware to lower it (if necessary)

View File

@ -779,7 +779,7 @@ struct ext2_xattr_entry {
}
void Dump(bool full=false) const {
for (unsigned int i = 0; i < (full ? sizeof(this) : MinimumSize()); i++)
for (unsigned int i = 0; i < (full ? sizeof(*this) : MinimumSize()); i++)
dprintf("%02x ", ((uint8 *)this)[i]);
dprintf("\n");
}

View File

@ -710,10 +710,10 @@ RequestBuilder::_GenerateClientId(XDR::WriteStream& stream,
PeerAddress local = server->LocalID();
memcpy(id + pos, server->ID().InAddr(), server->ID().InAddrSize());
pos += sizeof(server->ID().InAddrSize());
pos += server->ID().InAddrSize();
memcpy(id + pos, local.InAddr(), local.InAddrSize());
pos += sizeof(local.InAddrSize());
pos += local.InAddrSize();
*(uint16*)(id + pos) = server->ID().Port();
pos += sizeof(uint16);

View File

@ -124,7 +124,7 @@ ColorPreview::MessageReceived(BMessage* message)
(const void**)&color, &size) == B_OK) {
BMessage setColorMessage(SET_CURRENT_COLOR);
setColorMessage.AddData(kRGBColor, B_RGB_COLOR_TYPE, color,
sizeof(color));
sizeof(rgb_color));
Invoke(&setColorMessage);
}
} else if ((int32)message->what == kMsgMessageRunner) {