Fix templates for PortLink & PortMessage

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3960 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
shadow303
2003-07-11 23:16:15 +00:00
parent 78cc8d1a5a
commit 5c54c7191a
2 changed files with 58 additions and 3 deletions
+17 -1
View File
@@ -48,7 +48,23 @@ public:
ssize_t BufferSize(void) { return _buffersize; }
status_t Read(void *data, ssize_t size);
template <class Type> status_t Read(Type *data);
template <class Type> status_t Read(Type *data)
{
int32 size = sizeof(Type);
if(!data)
return B_BAD_VALUE;
if( !_buffer ||
(_buffersize < size) ||
(_index+size > _buffer+_buffersize) )
return B_NO_MEMORY;
*data=*((Type*)_index);
_index+=size;
return B_OK;
}
void Rewind(void);