Got rid of Port::GetMessage[Size]().

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29564 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-03-17 00:46:40 +00:00
parent 60f4376e26
commit c1f05b2803
3 changed files with 9 additions and 21 deletions

View File

@ -36,9 +36,6 @@ public:
void* GetBuffer() const;
int32 GetCapacity() const;
void* GetMessage() const;
int32 GetMessageSize() const;
status_t Send(int32 size);
status_t Receive(void** _message, size_t* _size,
bigtime_t timeout = -1);
@ -49,7 +46,6 @@ private:
Info fInfo;
uint8* fBuffer;
int32 fCapacity;
int32 fMessageSize;
status_t fInitStatus;
bool fOwner;
};

View File

@ -77,7 +77,6 @@ KernelDebug::DebugPort(int argc, char** argv)
kprintf(" client port: %ld\n", port->fPort.fInfo.client_port);
kprintf(" size: %ld\n", port->fPort.fInfo.size);
kprintf(" capacity: %ld\n", port->fPort.fCapacity);
kprintf(" message size: %ld\n", port->fPort.fMessageSize);
kprintf(" buffer: %p\n", port->fPort.fBuffer);
return 0;
}

View File

@ -11,17 +11,18 @@
#include "Compatibility.h"
#include "Port.h"
using std::nothrow;
// minimal and maximal port size
static const int32 kMinPortSize = 1024; // 1 kB
static const int32 kMaxPortSize = 64 * 1024; // 64 kB
// constructor
Port::Port(int32 size)
: fBuffer(NULL),
fCapacity(0),
fMessageSize(0),
fInitStatus(B_NO_INIT),
fOwner(true)
{
@ -53,11 +54,11 @@ Port::Port(int32 size)
fInitStatus = B_OK;
}
// constructor
Port::Port(const Info* info)
: fBuffer(NULL),
fCapacity(0),
fMessageSize(0),
fInitStatus(B_NO_INIT),
fOwner(false)
{
@ -81,6 +82,7 @@ Port::Port(const Info* info)
fInitStatus = B_OK;
}
// destructor
Port::~Port()
{
@ -88,6 +90,7 @@ Port::~Port()
delete[] fBuffer;
}
// Close
void
Port::Close()
@ -106,6 +109,7 @@ Port::Close()
fInfo.client_port = -1;
}
// InitCheck
status_t
Port::InitCheck() const
@ -113,6 +117,7 @@ Port::InitCheck() const
return fInitStatus;
}
// GetInfo
const Port::Info*
Port::GetInfo() const
@ -120,6 +125,7 @@ Port::GetInfo() const
return &fInfo;
}
// GetBuffer
void*
Port::GetBuffer() const
@ -127,6 +133,7 @@ Port::GetBuffer() const
return fBuffer;
}
// GetCapacity
int32
Port::GetCapacity() const
@ -134,19 +141,6 @@ Port::GetCapacity() const
return fCapacity;
}
// GetMessage
void*
Port::GetMessage() const
{
return (fInitStatus == B_OK && fMessageSize > 0 ? fBuffer : NULL);
}
// GetMessageSize
int32
Port::GetMessageSize() const
{
return (fInitStatus == B_OK ? fMessageSize : 0);
}
// Send
status_t
@ -156,7 +150,6 @@ Port::Send(int32 size)
return fInitStatus;
if (size <= 0 || size > fCapacity)
return B_BAD_VALUE;
fMessageSize = 0;
port_id port = (fOwner ? fInfo.client_port : fInfo.owner_port);
status_t error;
do {