BPortLink now has a FlushWithReply() method itself.

BPortLink::AttachString() now accepts a length argument, and will no longer
send a terminating null byte; LinkMsgReader::ReadString(), however, will
make sure the string read is null terminated.
Changed client communication code to use FlushWithReply() instead of Flush()
and GetNextReply() - there were many bugs and shortcomings in the code, I
hope I've fixed them all.
Converted ClientFontList.cpp to our coding style (but not completely, the
class members are missing).
Some more cleanup - I hope Adi will adopt our coding style one day!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12998 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-06-08 00:36:26 +00:00
parent 750b92faf3
commit 75936a02e4
16 changed files with 865 additions and 1011 deletions
+25 -31
View File
@@ -39,42 +39,36 @@
#include <ServerProtocol.h>
#include "ServerMemIO.h"
ServerMemIO::ServerMemIO(size_t size)
: fLen(0),
fPhys(0),
fPos(0)
{
if(size>0)
{
BPrivate::BAppServerLink link;
link.StartMessage(AS_ACQUIRE_SERVERMEM);
link.Attach<size_t>(size);
link.Attach<port_id>(link.ReplyPort());
link.Flush();
int32 code;
link.GetNextReply(&code);
if(code==SERVER_TRUE)
{
area_info ai;
link.Read<area_id>(&fSourceArea);
link.Read<size_t>(&fOffset);
if(fSourceArea>0 && get_area_info(fSourceArea,&ai)==B_OK)
{
fPhys=size;
fArea=clone_area("ServerMemIO area",(void**)&fBuf,B_CLONE_ADDRESS,
B_READ_AREA|B_WRITE_AREA,fSourceArea);
fBuf+=fOffset;
}
else
{
debugger("PANIC: bad data or something in ServerMemIO constructor");
}
if (size == 0)
return;
BPrivate::BAppServerLink link;
link.StartMessage(AS_ACQUIRE_SERVERMEM);
link.Attach<size_t>(size);
link.Attach<port_id>(link.ReplyPort());
int32 code;
if (link.FlushWithReply(&code) == B_OK
&& code == SERVER_TRUE) {
area_info info;
link.Read<area_id>(&fSourceArea);
link.Read<size_t>(&fOffset);
if (fSourceArea >= B_OK && get_area_info(fSourceArea, &info) == B_OK) {
fPhys = size;
fArea = clone_area("ServerMemIO area", (void **)&fBuf, B_CLONE_ADDRESS,
B_READ_AREA|B_WRITE_AREA, fSourceArea);
fBuf += fOffset;
} else {
debugger("PANIC: bad data or something in ServerMemIO constructor");
}
}
}