Printing of basic types was broken when they were part of non fixed size fields.

The size instead of the data would be printed. The fixed/non-fixed handling is
generic though, so no need to special case the always non fixed elements.
Since adding of basic types through their Add*() function always generates fixed
size fields, this would only be visible if the data was added through AddData()
with isFixedSize == false. This is the case in compiled resources for example,
hence you would see it when printing the returned messages of BMimeType::Get*()
functions for pre-installed types.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35336 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2010-01-29 23:29:51 +00:00
parent e65c400299
commit 17ec4668b2

View File

@ -575,6 +575,11 @@ BMessage::_PrintToStream(const char* indent) const
(char *)(fData + field->offset), j);
}
if ((field->flags & FIELD_FLAG_FIXED_SIZE) == 0) {
size = *(uint32 *)pointer;
pointer += sizeof(uint32);
}
switch (field->type) {
case B_RECT_TYPE:
print_to_stream_type<BRect>(pointer);
@ -586,8 +591,6 @@ BMessage::_PrintToStream(const char* indent) const
case B_STRING_TYPE:
{
size = *(uint32 *)pointer;
pointer += sizeof(uint32);
printf("string(\"%s\", %ld bytes)\n", (char *)pointer,
(long)size);
break;
@ -641,8 +644,6 @@ BMessage::_PrintToStream(const char* indent) const
case B_REF_TYPE:
{
size = *(uint32 *)pointer;
pointer += sizeof(uint32);
entry_ref ref;
BPrivate::entry_ref_unflatten(&ref, (char *)pointer, size);
@ -661,8 +662,6 @@ BMessage::_PrintToStream(const char* indent) const
sprintf(buffer, "%s ", indent);
BMessage message;
size = *(uint32 *)pointer;
pointer += sizeof(uint32);
status_t result = message.Unflatten((const char *)pointer);
if (result != B_OK) {
printf("failed unflatten: %s\n", strerror(result));