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
+6 -6
View File
@@ -54,7 +54,7 @@ LinkMsgReader::SetPort(port_id port)
status_t
LinkMsgReader::GetNextMessage(int32 *code, bigtime_t timeout)
LinkMsgReader::GetNextMessage(int32 &code, bigtime_t timeout)
{
int32 remaining;
@@ -92,7 +92,7 @@ LinkMsgReader::GetNextMessage(int32 *code, bigtime_t timeout)
return B_ERROR;
}
*code = header->code;
code = header->code;
fRecvPosition += sizeof(message_header);
STRACE(("info: LinkMsgReader got header %s [%ld %ld %ld] from port %ld.\n",
@@ -247,8 +247,8 @@ LinkMsgReader::ReadString(char **_string)
if (status < B_OK)
return status;
if (length > 0) {
char *string = (char *)malloc(length);
if (length >= 0) {
char *string = (char *)malloc(length + 1);
if (string == NULL) {
fRecvPosition -= sizeof(int32); // rewind the transaction
return B_NO_MEMORY;
@@ -261,8 +261,8 @@ LinkMsgReader::ReadString(char **_string)
return status;
}
// make sure the string is null terminated (although it already should be)
string[length - 1] = '\0';
// make sure the string is null terminated
string[length] = '\0';
*_string = string;
return B_OK;