[interfacekit] Re: Broken BMessage
- From: Erik Jaesler <erik@xxxxxxxxxxxxxx>
- To: interfacekit@xxxxxxxxxxxxx
- Date: Fri, 20 Aug 2004 08:50:34 -0700
Pahtz wrote:
--- Pahtz <pahtz@xxxxxxxxxxxx> wrote:
BTW, the last time I looked, which was quite recently, I noticed two problems:
FindString() is supposed to return a pointer to a null terminated string that
exists as long as
the field is still in the BMessage (other words probably a pointer to the
actual field).
I am mistaken, that is a problem with the Cosmoe implementation. The Haiku
version, depending on
what the loader does, is calling the libbe.so version of ::AddString() or
calling itself
recursively which might explain a very unusual crash with a stack overflow.
I'm not sure what you're looking at, but in the BMessage.cpp that I just
updated two days ago, there are 4 versions of BMessage::FindString
(omitting trailing const to save space):
status_t FindString(const char* name, int32 index, const char** str);
status_t FindString(const char* name, const char** str);
status_t FindString(const char* name, BString* str);
status_t FindString(const char* name, int32 index, BString* str);
2, 3, and 4 basically call 1 to do their work (3 and 4 make a copy of
the data into the passed BString). 1 calls the version of
BMessage::FindData() which calls the raw data version of
BMessageBody::FindData(), which in turns calls a private version of
FindData() which returns a BMessageField* that contains the actual data.
There two flavors of AddString(), with the BString* version calling the
const char* version directly. The const char* version calls
BMessageBody::AddData<BString>, which finds or creates a BMessageField
and then adds the data to that.
Unless I'm overlooking something obscure, the code does not call
anything from libbe's BMessage and does not recurse. It's all pretty
straightforward delegation.
Theee are multiple implementations of ::Flatten() and ::Unflatten() both have
the exact same
prototype.
This is still true.
There is an almost total duplicate of BMessage code in Message.cpp.
Look for the define USING_TEMPLATE_MADNESS; it separates the two (not to
mention delineating a couple of other things). The
non-USING_TEMPLATE_MADNESS portion is based, if I remember correctly, on
an old version of Marc Flerackers' code. It may even be the version
which Stefano is refering to. It is, however, quite incomplete, and I
should have purged it some time ago.
In any case, I am actively looking at the code, and expect to have a fix
by Monday.
Thanks,
e
- References:
- [interfacekit] Re: Broken BMessage
- From: Pahtz
Other related posts:
- » [interfacekit] Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
- » [interfacekit] Re: Broken BMessage
--- Pahtz <pahtz@xxxxxxxxxxxx> wrote:
BTW, the last time I looked, which was quite recently, I noticed two problems:
FindString() is supposed to return a pointer to a null terminated string that exists as long as the field is still in the BMessage (other words probably a pointer to the actual field).
I am mistaken, that is a problem with the Cosmoe implementation. The Haiku version, depending on what the loader does, is calling the libbe.so version of ::AddString() or calling itself recursively which might explain a very unusual crash with a stack overflow.
Theee are multiple implementations of ::Flatten() and ::Unflatten() both have the exact same prototype.
This is still true.
- [interfacekit] Re: Broken BMessage
- From: Pahtz