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:
@@ -22,7 +22,7 @@ class LinkMsgReader {
|
||||
void SetPort(port_id port);
|
||||
port_id Port(void) { return fReceivePort; }
|
||||
|
||||
status_t GetNextMessage(int32 *code, bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||
status_t GetNextMessage(int32 &code, bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||
status_t Read(void *data, ssize_t size);
|
||||
status_t ReadString(char **string);
|
||||
template <class Type> status_t Read(Type *data)
|
||||
|
||||
@@ -34,7 +34,7 @@ class LinkMsgSender {
|
||||
//status_t FlushWithReply(int32 *code);
|
||||
|
||||
status_t Attach(const void *data, size_t size);
|
||||
status_t AttachString(const char *string);
|
||||
status_t AttachString(const char *string, int32 length = -1);
|
||||
template <class Type> status_t Attach(const Type& data)
|
||||
{
|
||||
return Attach(&data, sizeof(Type));
|
||||
|
||||
@@ -51,7 +51,7 @@ class BPortLink {
|
||||
|
||||
status_t Flush(bigtime_t timeout = B_INFINITE_TIMEOUT, bool needsReply = false);
|
||||
status_t Attach(const void *data, ssize_t size);
|
||||
status_t AttachString(const char *string);
|
||||
status_t AttachString(const char *string, int32 length = -1);
|
||||
status_t AttachRegion(const BRegion ®ion);
|
||||
status_t AttachShape(BShape &shape);
|
||||
template <class Type> status_t Attach(const Type& data);
|
||||
@@ -61,13 +61,17 @@ class BPortLink {
|
||||
void SetReplyPort(port_id port);
|
||||
port_id ReplyPort();
|
||||
|
||||
status_t GetNextReply(int32 *code, bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||
status_t GetNextReply(int32 &code, bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||
status_t Read(void *data, ssize_t size);
|
||||
status_t ReadString(char **string);
|
||||
status_t ReadRegion(BRegion *region);
|
||||
status_t ReadShape(BShape *shape);
|
||||
template <class Type> status_t Read(Type *data);
|
||||
|
||||
// convenience methods
|
||||
|
||||
status_t FlushWithReply(int32 &code);
|
||||
|
||||
protected:
|
||||
LinkMsgReader *fReader;
|
||||
LinkMsgSender *fSender;
|
||||
@@ -118,9 +122,9 @@ BPortLink::Attach(const void *data, ssize_t size)
|
||||
}
|
||||
|
||||
inline status_t
|
||||
BPortLink::AttachString(const char *string)
|
||||
BPortLink::AttachString(const char *string, int32 length)
|
||||
{
|
||||
return fSender->AttachString(string);
|
||||
return fSender->AttachString(string, length);
|
||||
}
|
||||
|
||||
template<class Type> status_t
|
||||
@@ -144,7 +148,7 @@ BPortLink::ReplyPort()
|
||||
}
|
||||
|
||||
inline status_t
|
||||
BPortLink::GetNextReply(int32 *code, bigtime_t timeout)
|
||||
BPortLink::GetNextReply(int32 &code, bigtime_t timeout)
|
||||
{
|
||||
return fReader->GetNextMessage(code, timeout);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user