Fixes for bugs in BFlattenable convenience functions (revealed by the new
unit tests). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3404 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
c5d8f91d81
commit
df1b8782c7
@ -787,8 +787,12 @@ status_t BMessage::AddFlat(const char* name, BFlattenable* obj, int32 count)
|
|||||||
char* buffer = new(nothrow) char[size];
|
char* buffer = new(nothrow) char[size];
|
||||||
if (buffer)
|
if (buffer)
|
||||||
{
|
{
|
||||||
err = AddData(name, obj->TypeCode(), (void*)buffer, size,
|
err = obj->Flatten((void*)buffer, size);
|
||||||
obj->IsFixedSize(), count);
|
if (!err)
|
||||||
|
{
|
||||||
|
err = AddData(name, obj->TypeCode(), (void*)buffer, size,
|
||||||
|
obj->IsFixedSize(), count);
|
||||||
|
}
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1147,7 +1151,11 @@ status_t BMessage::ReplaceFlat(const char* name, int32 index, BFlattenable* obj)
|
|||||||
char* buffer = new(nothrow) char[size];
|
char* buffer = new(nothrow) char[size];
|
||||||
if (buffer)
|
if (buffer)
|
||||||
{
|
{
|
||||||
err = ReplaceData(name, obj->TypeCode(), index, (void*)buffer, size);
|
err = obj->Flatten(buffer, size);
|
||||||
|
if (!err)
|
||||||
|
{
|
||||||
|
err = ReplaceData(name, obj->TypeCode(), index, (void*)buffer, size);
|
||||||
|
}
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user