From 5234dfe1df9cc71eff627d79b26261ca362233e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 1 Nov 2005 15:43:38 +0000 Subject: [PATCH] Added the alternate ReadString() method to ServerLink as well. Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14615 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/app/PortLink.h | 36 +++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/headers/private/app/PortLink.h b/headers/private/app/PortLink.h index e2943130f3..25800e328e 100644 --- a/headers/private/app/PortLink.h +++ b/headers/private/app/PortLink.h @@ -7,27 +7,24 @@ * Pahtz * Axel Dörfler, axeld@pinc-software.de */ -#ifndef _PORTLINK_H -#define _PORTLINK_H +#ifndef _SERVER_LINK_H +#define _SERVER_LINK_H + #include #include #include + /* - Error checking rules: (for if you don't want to check every return code) - - Calling EndMessage() is optional, implied by Flush() or StartMessage(). - - If you are sending just one message you only need to test Flush() == B_OK - - If you are buffering multiple messages without calling Flush() you must - check EndMessage() == B_OK, or the last Attach() for each message. Check - Flush() at the end. - - If you are reading, check the last Read() or ReadString() you perform. - -*/ + * Error checking rules: (for if you don't want to check every return code) + * - Calling EndMessage() is optional, implied by Flush() or StartMessage(). + * - If you are sending just one message you only need to test Flush() == B_OK + * - If you are buffering multiple messages without calling Flush() you must + * check EndMessage() == B_OK, or the last Attach() for each message. + * Check Flush() at the end. + * - If you are reading, check the last Read() or ReadString() you perform. + */ namespace BPrivate { @@ -60,6 +57,7 @@ class ServerLink { status_t GetNextMessage(int32 &code, bigtime_t timeout = B_INFINITE_TIMEOUT); bool NeedsReply() const; status_t Read(void *data, ssize_t size); + status_t ReadString(char *buffer, size_t bufferSize); status_t ReadString(char **string); status_t ReadRegion(BRegion *region); status_t ReadShape(BShape *shape); @@ -173,6 +171,12 @@ ServerLink::Read(void *data, ssize_t size) return fReceiver->Read(data, size); } +inline status_t +ServerLink::ReadString(char *buffer, size_t bufferSize) +{ + return fReceiver->ReadString(buffer, bufferSize); +} + inline status_t ServerLink::ReadString(char **string) { @@ -187,4 +191,4 @@ ServerLink::Read(Type *data) } // namespace BPrivate -#endif /* _PORTLINK_H */ +#endif /* _SERVER_LINK_H */