* Added swapped endian type codes for the R5 and Dano message readers.

* when Unflatten() encounters an unknown message format, it will now return
  B_NOT_A_MESSAGE.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15050 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-11-20 17:28:24 +00:00
parent 51a16ce830
commit 8fe493128f

View File

@ -869,18 +869,21 @@ BMessage::Unflatten(const char *flatBuffer)
return convert_message(&message, this);
}
if (format == kMessageMagicR5)
if (format == kMessageMagicR5 || format == kMessageMagicR5Swapped)
return BPrivate::R5MessageUnflatten(this, flatBuffer);
if (format == kMessageMagicDano) {
if (format == kMessageMagicDano || format == kMessageMagicDanoSwapped) {
BMemoryIO stream(flatBuffer + sizeof(uint32),
BPrivate::dano_message_size(flatBuffer));
return BPrivate::unflatten_dano_message(format, stream, *this);
}
return B_NOT_A_MESSAGE;
}
// native message unflattening
free(fHeader);
fHeader = NULL;
fHeader = (MessageHeader *)malloc(sizeof(MessageHeader));
if (!fHeader)
return B_NO_MEMORY;
@ -934,13 +937,17 @@ BMessage::Unflatten(BDataIO *stream)
uint32 format = 0;
stream->Read(&format, sizeof(uint32));
if (format != kMessageMagic4) {
if (format == kMessageMagicR5)
if (format == kMessageMagicR5 || format == kMessageMagicR5Swapped)
return BPrivate::R5MessageUnflatten(this, stream);
if (format == kMessageMagicDano)
if (format == kMessageMagicDano || format == kMessageMagicDanoSwapped)
return BPrivate::unflatten_dano_message(format, *stream, *this);
return B_NOT_A_MESSAGE;
}
// native message unflattening
free(fHeader);
fHeader = (MessageHeader *)malloc(sizeof(MessageHeader));
if (!fHeader)