[haiku-appserver] Re: BMessage AddData

  • From: Korli <korli@xxxxxxxx>
  • To: haiku-appserver@xxxxxxxxxxxxx
  • Date: Tue, 12 Jul 2005 22:52:19 +0200

Axel Dörfler a écrit :

Korli <korli@xxxxxxxx> wrote:


I'm having problems with BMessage::AddData(), typically when used with a B_UINT8_TYPE and with a size.



Is it used in the same way in BeOS? To me, using B_UINT8_TYPE with a size different of sizeof(uint8) looks wrong. And obviously, Eric (who wrote BMessage) thought in the same way.
Of course, maybe AddData() shouldn't care about this, but B_RAW_TYPE looks more appropriate here.


This code works on R5. This is a bad assumption.



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'm not sure about this.



I didn't find unit tests for this method. Having one would also be great.



As every type adder uses this method, there are indirect unit tests for it - but that's obviously not enough :-)


A bad functional assumption leads to incorrect tests :)



The problem appears in input_server : no key_states is found in input messages, applications depending on these key states can't work as expected.



See above.


Input addons and input_server work as is on R5, that's the reason why I believe this implementation is wrong.

Bye,
Jérôme


Other related posts: