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
This commit is contained in:
Axel Dörfler
2005-11-01 15:43:38 +00:00
parent 297cd250fa
commit 5234dfe1df
+20 -16
View File
@@ -7,27 +7,24 @@
* Pahtz <[email protected]> * Pahtz <[email protected]>
* Axel Dörfler, [email protected] * Axel Dörfler, [email protected]
*/ */
#ifndef _PORTLINK_H #ifndef _SERVER_LINK_H
#define _PORTLINK_H #define _SERVER_LINK_H
#include <OS.h> #include <OS.h>
#include <LinkMsgReader.h> #include <LinkMsgReader.h>
#include <LinkMsgSender.h> #include <LinkMsgSender.h>
/* /*
Error checking rules: (for if you don't want to check every return code) * Error checking rules: (for if you don't want to check every return code)
* - Calling EndMessage() is optional, implied by Flush() or StartMessage().
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
If you are sending just one message you only need to test Flush() == B_OK * check EndMessage() == B_OK, or the last Attach() for each message.
* Check Flush() at the end.
If you are buffering multiple messages without calling Flush() you must * - If you are reading, check the last Read() or ReadString() you perform.
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 { namespace BPrivate {
@@ -60,6 +57,7 @@ class ServerLink {
status_t GetNextMessage(int32 &code, bigtime_t timeout = B_INFINITE_TIMEOUT); status_t GetNextMessage(int32 &code, bigtime_t timeout = B_INFINITE_TIMEOUT);
bool NeedsReply() const; bool NeedsReply() const;
status_t Read(void *data, ssize_t size); status_t Read(void *data, ssize_t size);
status_t ReadString(char *buffer, size_t bufferSize);
status_t ReadString(char **string); status_t ReadString(char **string);
status_t ReadRegion(BRegion *region); status_t ReadRegion(BRegion *region);
status_t ReadShape(BShape *shape); status_t ReadShape(BShape *shape);
@@ -173,6 +171,12 @@ ServerLink::Read(void *data, ssize_t size)
return fReceiver->Read(data, size); return fReceiver->Read(data, size);
} }
inline status_t
ServerLink::ReadString(char *buffer, size_t bufferSize)
{
return fReceiver->ReadString(buffer, bufferSize);
}
inline status_t inline status_t
ServerLink::ReadString(char **string) ServerLink::ReadString(char **string)
{ {
@@ -187,4 +191,4 @@ ServerLink::Read(Type *data)
} // namespace BPrivate } // namespace BPrivate
#endif /* _PORTLINK_H */ #endif /* _SERVER_LINK_H */