From 8fe493128f757fe91783f865e9149815e347eac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 20 Nov 2005 17:28:24 +0000 Subject: [PATCH] * 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 --- src/kits/app/Message4.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/kits/app/Message4.cpp b/src/kits/app/Message4.cpp index 5e9cde2332..8890348f46 100644 --- a/src/kits/app/Message4.cpp +++ b/src/kits/app/Message4.cpp @@ -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)