[haiku-appserver] Re: BMessage AddData

  • From: Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>
  • To: haiku-appserver@xxxxxxxxxxxxx
  • Date: Tue, 12 Jul 2005 23:03:24 +0200

On 2005-07-12 at 22:10:37 [+0200], Axel Dörfler wrote:
> Korli <korli@xxxxxxxx> wrote:
>
> > As I don't understand fully this code, could someone have a look at
> > this
> > method ? It doesn't handle every type codes the same way which is
> > very
> > weird.
> 
> It can't treat every type in the same way, as all types have a special
> handling, ie. number types need to be endian-aware, same for entry_refs
> but even more complicated.

I don't think that's correct. At least in R5 all Add*() methods are merely 
thin wrappers that invoke AddData(). They don't do endianess conversion -- 
I believe it's only done when unflattening a message.

There're only a few of those methods that do more than directly invoking 
AddData() with a pointer to the data and its size. The complete list should 
be: AddRef(), AddMessage(), AddFlat(). And each of them renders the flat 
data into a temporary buffer and then calls AddData().

Personally I really don't understand why Erik unleashed his template 
madness when things could have been so much simpler.

CU, Ingo

Other related posts: