Made BMessage::GetInfo() pointer arguments optional (ie. passing NULL doesn't
cause a crash anymore). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15022 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
63ea9a2870
commit
4ad46aa954
@ -213,7 +213,9 @@ BMessage::GetInfo(type_code typeRequested, int32 index, char **nameFound,
|
||||
if (index >= fHeader->fieldCount)
|
||||
return B_BAD_INDEX;
|
||||
|
||||
if (nameFound)
|
||||
*nameFound = (char *)fData + fFields[index].offset;
|
||||
if (typeFound)
|
||||
*typeFound = fFields[index].type;
|
||||
if (countFound)
|
||||
*countFound = fFields[index].count;
|
||||
@ -227,7 +229,9 @@ BMessage::GetInfo(type_code typeRequested, int32 index, char **nameFound,
|
||||
counter++;
|
||||
|
||||
if (counter == index) {
|
||||
if (nameFound)
|
||||
*nameFound = (char *)fData + field->offset;
|
||||
if (typeFound)
|
||||
*typeFound = field->type;
|
||||
if (countFound)
|
||||
*countFound = field->count;
|
||||
@ -255,6 +259,7 @@ BMessage::GetInfo(const char *name, type_code *typeFound, int32 *countFound)
|
||||
if (result < B_OK || !field)
|
||||
return result;
|
||||
|
||||
if (typeFound)
|
||||
*typeFound = field->type;
|
||||
if (countFound)
|
||||
*countFound = field->count;
|
||||
@ -273,7 +278,9 @@ BMessage::GetInfo(const char *name, type_code *typeFound, bool *fixedSize)
|
||||
if (result < B_OK || !field)
|
||||
return result;
|
||||
|
||||
if (typeFound)
|
||||
*typeFound = field->type;
|
||||
if (fixedSize)
|
||||
*fixedSize = field->flags & FIELD_FLAG_FIXED_SIZE;
|
||||
|
||||
return B_OK;
|
||||
|
@ -128,21 +128,13 @@ status_t BMessageBody::GetInfo(const char* name, type_code* type,
|
||||
{
|
||||
status_t err;
|
||||
BMessageField* BMF = FindData(name, B_ANY_TYPE, err);
|
||||
if (BMF)
|
||||
{
|
||||
if (BMF) {
|
||||
if (type)
|
||||
*type = BMF->Type();
|
||||
if (c)
|
||||
{
|
||||
*c = BMF->CountItems();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (c)
|
||||
{
|
||||
} else if (c)
|
||||
*c = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user