* Got rid of the casting in Read, motivated by a patch sent by Fredrik Ekdahl,

should also fix GCC4 build.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24074 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2008-02-23 11:03:37 +00:00
parent 50baebaf5f
commit 9640a42e77
@@ -8,6 +8,7 @@
*/
#include <stdio.h>
#include <string.h>
#include "StreamBuffer.h"
#ifndef min
@@ -115,17 +116,20 @@ StreamBuffer::InitCheck()
// error code returned by BPositionIO::Read()
// ---------------------------------------------------------------
ssize_t
StreamBuffer::Read(void *pinto, size_t nbytes)
StreamBuffer::Read(void *_pinto, size_t nbytes)
{
if (_pinto == NULL)
return B_BAD_VALUE;
if (nbytes == 0)
return 0;
ssize_t result = B_ERROR;
uint8 *pinto = (uint8 *)_pinto;
size_t totalRead = min(nbytes, fLen - fPos);
memcpy(pinto, fBuffer + fPos, totalRead);
fPos += totalRead;
(uint8 *)pinto += totalRead;
pinto += totalRead;
nbytes -= totalRead;
while (nbytes > 0) {
@@ -136,7 +140,7 @@ StreamBuffer::Read(void *pinto, size_t nbytes)
size_t left = min(nbytes, fLen - fPos);
memcpy(pinto, fBuffer + fPos, left);
fPos += left;
(uint8 *)pinto += left;
pinto += left;
nbytes -= left;
totalRead += left;
}