From 9640a42e77b248ec52424f076968bf5e3f985889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 23 Feb 2008 11:03:37 +0000 Subject: [PATCH] * 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 --- src/add-ons/translators/shared/StreamBuffer.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/add-ons/translators/shared/StreamBuffer.cpp b/src/add-ons/translators/shared/StreamBuffer.cpp index 3d710a3eb8..9184d1cb2e 100644 --- a/src/add-ons/translators/shared/StreamBuffer.cpp +++ b/src/add-ons/translators/shared/StreamBuffer.cpp @@ -8,6 +8,7 @@ */ #include +#include #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; }