Renamed BAppServerLink to AppServerLink, BPortLink to PortLink, LinkMsgReader

to LinkReceiver, LinkMsgSender to LinkSender, and put everything into the
BPrivate namespace.
Made AppServerLink a cheap object - it will use the applications receiver/sender
and not create its own buffers.
Fixed broken communication stuff here and there (mostly Font.cpp).
Put the newly introduced set|get_system_colors() into the BPrivate namespace -
please don't introduce private functions into the public namespace!!!
Also fixed their broken communication use, as Darkwyrm obviously forgot about
it again: the sequence Flush(); GetNextMessage() without error checking is
purely wrong and can make the app hang and/or crash! :-)
Other minor cleanup.
The input_server used some test mode with the haiku build target which is
probably wrong.
Hopefully I did not forget anything this time.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13128 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-06-14 21:28:56 +00:00
parent e274da0fa5
commit dd10337fd0
52 changed files with 1102 additions and 1192 deletions
+15 -18
View File
@@ -1,5 +1,5 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, Haiku
// Copyright (c) 2001-2005, Haiku
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
@@ -41,20 +41,20 @@
ServerMemIO::ServerMemIO(size_t size)
: fLen(0),
fPhys(0),
fPos(0)
:
fLen(0),
fPhys(0),
fPos(0)
{
if (size == 0)
return;
BPrivate::BAppServerLink link;
BPrivate::AppServerLink 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
if (link.FlushWithReply(code) == B_OK
&& code == SERVER_TRUE) {
area_info info;
@@ -77,7 +77,7 @@ ServerMemIO::ServerMemIO(size_t size)
// Destruction
ServerMemIO::~ServerMemIO()
{
BPrivate::BAppServerLink link;
BPrivate::AppServerLink link;
link.StartMessage(AS_RELEASE_SERVERMEM);
link.Attach<area_id>(fSourceArea);
link.Attach<int32>(fOffset);
@@ -91,10 +91,9 @@ ServerMemIO::ReadAt(off_t pos, void *buffer, size_t size)
{
if (buffer == NULL || pos < 0)
return B_BAD_VALUE;
ssize_t sizeRead = 0;
if (pos < fLen)
{
if (pos < fLen) {
sizeRead = min_c(static_cast<off_t>(size), fLen - pos);
memcpy(buffer, fBuf + pos, sizeRead);
}
@@ -108,17 +107,16 @@ ServerMemIO::WriteAt(off_t pos, const void *buffer, size_t size)
{
if (buffer == NULL || pos < 0)
return B_BAD_VALUE;
ssize_t sizeWritten = 0;
if (pos < fPhys)
{
if (pos < fPhys) {
sizeWritten = min_c(static_cast<off_t>(size), fPhys - pos);
memcpy(fBuf + pos, buffer, sizeWritten);
}
if (pos + sizeWritten > fLen)
fLen = pos + sizeWritten;
return sizeWritten;
}
@@ -127,8 +125,7 @@ ServerMemIO::WriteAt(off_t pos, const void *buffer, size_t size)
off_t
ServerMemIO::Seek(off_t position, uint32 seek_mode)
{
switch (seek_mode)
{
switch (seek_mode) {
case SEEK_SET:
fPos = position;
break;