fixed spelling and changed casting from C-Style to new C++ style

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1569 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matthew Wilber
2002-10-18 03:26:18 +00:00
parent 8da2aed831
commit e9651c05a1
+10 -9
View File
@@ -1,8 +1,8 @@
/*****************************************************************************/ /*****************************************************************************/
// File: BitmapStream.cpp // File: BitmapStream.cpp
// Class: BBitmapStream // Class: BBitmapStream
// Reimplimented by: Travis Smith, Michael Wilber, Translation Kit Team // Reimplemented by: Travis Smith, Michael Wilber, Translation Kit Team
// Reimplimentation: 2002-04 // Reimplementation: 2002-04
// //
// Description: BPositionIO based object to read/write bitmap format to/from // Description: BPositionIO based object to read/write bitmap format to/from
// a BBitmap object. // a BBitmap object.
@@ -71,8 +71,8 @@ BBitmapStream::BBitmapStream(BBitmap *bitmap)
fHeader.bounds = fBitmap->Bounds(); fHeader.bounds = fBitmap->Bounds();
fHeader.rowBytes = fBitmap->BytesPerRow(); fHeader.rowBytes = fBitmap->BytesPerRow();
fHeader.colors = fBitmap->ColorSpace(); fHeader.colors = fBitmap->ColorSpace();
fHeader.dataSize = (uint32) fHeader.dataSize = static_cast<uint32>
(fHeader.bounds.Height() + 1) * fHeader.rowBytes; ((fHeader.bounds.Height() + 1) * fHeader.rowBytes);
fSize = sizeof(TranslatorBitmap) + fHeader.dataSize; fSize = sizeof(TranslatorBitmap) + fHeader.dataSize;
SetBigEndianHeader(); SetBigEndianHeader();
@@ -139,10 +139,10 @@ BBitmapStream::ReadAt(off_t pos, void *buffer, size_t size)
if (pos < sizeof(TranslatorBitmap)) { if (pos < sizeof(TranslatorBitmap)) {
toRead = sizeof(TranslatorBitmap) - pos; toRead = sizeof(TranslatorBitmap) - pos;
source = ((uint8 *) fpBigEndianHeader) + pos; source = (reinterpret_cast<uint8 *> (fpBigEndianHeader)) + pos;
} else { } else {
toRead = fSize - pos; toRead = fSize - pos;
source = ((uint8 *) fBitmap->Bits()) + pos - source = (reinterpret_cast<uint8 *> (fBitmap->Bits())) + pos -
sizeof(TranslatorBitmap); sizeof(TranslatorBitmap);
} }
if (toRead > size) if (toRead > size)
@@ -191,10 +191,11 @@ BBitmapStream::WriteAt(off_t pos, const void *data, size_t size)
// changes to it // changes to it
if (pos < sizeof(TranslatorBitmap)) { if (pos < sizeof(TranslatorBitmap)) {
toWrite = sizeof(TranslatorBitmap) - pos; toWrite = sizeof(TranslatorBitmap) - pos;
dest = ((uint8 *) &fHeader) + pos; dest = (reinterpret_cast<uint8 *> (&fHeader)) + pos;
} else { } else {
toWrite = fHeader.dataSize - pos + sizeof(TranslatorBitmap); toWrite = fHeader.dataSize - pos + sizeof(TranslatorBitmap);
dest = ((uint8 *) fBitmap->Bits()) + pos - sizeof(TranslatorBitmap); dest = (reinterpret_cast<uint8 *> (fBitmap->Bits())) +
pos - sizeof(TranslatorBitmap);
} }
if (toWrite > size) if (toWrite > size)
toWrite = size; toWrite = size;
@@ -205,7 +206,7 @@ BBitmapStream::WriteAt(off_t pos, const void *data, size_t size)
memcpy(dest, data, toWrite); memcpy(dest, data, toWrite);
pos += toWrite; pos += toWrite;
written += toWrite; written += toWrite;
data = ((uint8 *) data) + toWrite; data = (reinterpret_cast<const uint8 *> (data)) + toWrite;
size -= toWrite; size -= toWrite;
if (pos > fSize) if (pos > fSize)
fSize = pos; fSize = pos;