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,8 +213,10 @@ BMessage::GetInfo(type_code typeRequested, int32 index, char **nameFound,
|
|||||||
if (index >= fHeader->fieldCount)
|
if (index >= fHeader->fieldCount)
|
||||||
return B_BAD_INDEX;
|
return B_BAD_INDEX;
|
||||||
|
|
||||||
*nameFound = (char *)fData + fFields[index].offset;
|
if (nameFound)
|
||||||
*typeFound = fFields[index].type;
|
*nameFound = (char *)fData + fFields[index].offset;
|
||||||
|
if (typeFound)
|
||||||
|
*typeFound = fFields[index].type;
|
||||||
if (countFound)
|
if (countFound)
|
||||||
*countFound = fFields[index].count;
|
*countFound = fFields[index].count;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@ -227,8 +229,10 @@ BMessage::GetInfo(type_code typeRequested, int32 index, char **nameFound,
|
|||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
if (counter == index) {
|
if (counter == index) {
|
||||||
*nameFound = (char *)fData + field->offset;
|
if (nameFound)
|
||||||
*typeFound = field->type;
|
*nameFound = (char *)fData + field->offset;
|
||||||
|
if (typeFound)
|
||||||
|
*typeFound = field->type;
|
||||||
if (countFound)
|
if (countFound)
|
||||||
*countFound = field->count;
|
*countFound = field->count;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@ -255,7 +259,8 @@ BMessage::GetInfo(const char *name, type_code *typeFound, int32 *countFound)
|
|||||||
if (result < B_OK || !field)
|
if (result < B_OK || !field)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
*typeFound = field->type;
|
if (typeFound)
|
||||||
|
*typeFound = field->type;
|
||||||
if (countFound)
|
if (countFound)
|
||||||
*countFound = field->count;
|
*countFound = field->count;
|
||||||
|
|
||||||
@ -273,8 +278,10 @@ BMessage::GetInfo(const char *name, type_code *typeFound, bool *fixedSize)
|
|||||||
if (result < B_OK || !field)
|
if (result < B_OK || !field)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
*typeFound = field->type;
|
if (typeFound)
|
||||||
*fixedSize = field->flags & FIELD_FLAG_FIXED_SIZE;
|
*typeFound = field->type;
|
||||||
|
if (fixedSize)
|
||||||
|
*fixedSize = field->flags & FIELD_FLAG_FIXED_SIZE;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
@ -128,21 +128,13 @@ status_t BMessageBody::GetInfo(const char* name, type_code* type,
|
|||||||
{
|
{
|
||||||
status_t err;
|
status_t err;
|
||||||
BMessageField* BMF = FindData(name, B_ANY_TYPE, err);
|
BMessageField* BMF = FindData(name, B_ANY_TYPE, err);
|
||||||
if (BMF)
|
if (BMF) {
|
||||||
{
|
if (type)
|
||||||
*type = BMF->Type();
|
*type = BMF->Type();
|
||||||
if (c)
|
if (c)
|
||||||
{
|
|
||||||
*c = BMF->CountItems();
|
*c = BMF->CountItems();
|
||||||
}
|
} else if (c)
|
||||||
}
|
*c = 0;
|
||||||
else
|
|
||||||
{
|
|
||||||
if (c)
|
|
||||||
{
|
|
||||||
*c = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user