Author: mmlr Date: 2010-01-30 00:29:51 +0100 (Sat, 30 Jan 2010) New Revision: 35336 Changeset: http://dev.haiku-os.org/changeset/35336/haiku Modified: haiku/trunk/src/kits/app/Message.cpp Log: 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. Modified: haiku/trunk/src/kits/app/Message.cpp =================================================================== --- haiku/trunk/src/kits/app/Message.cpp 2010-01-29 20:27:08 UTC (rev 35335) +++ haiku/trunk/src/kits/app/Message.cpp 2010-01-29 23:29:51 UTC (rev 35336) @@ -575,6 +575,11 @@ (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 @@ 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 @@ 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 @@ 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));