From: Alexey K. <akh...@us...> - 2006-10-16 21:41:59
|
Update of /cvsroot/aaf/AAF/ref-impl/src/OM In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv31135 Modified Files: OMCachedDiskRawStorage.cpp Log Message: Change OMCachedDiskRawStorage to inherit from OMBaseCachedDiskRawStorage. Index: OMCachedDiskRawStorage.cpp =================================================================== RCS file: /cvsroot/aaf/AAF/ref-impl/src/OM/OMCachedDiskRawStorage.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** OMCachedDiskRawStorage.cpp 16 Oct 2006 21:39:57 -0000 1.13 --- OMCachedDiskRawStorage.cpp 16 Oct 2006 21:41:53 -0000 1.14 *************** *** 288,344 **** } ! // @mfunc Read a page or partial page without using the cache. // @parm TBS // @parm TBS // @parm TBS ! void OMCachedDiskRawStorage::readPage(OMUInt64 position, ! OMUInt32 byteCount, ! OMByte* destination) { ! TRACE("OMCachedDiskRawStorage::readPage"); PRECONDITION("Valid destination", destination != 0); ! OMUInt64 streamSize = size(); ! if (position < streamSize) { ! OMUInt32 remaining = static_cast<OMUInt32>(streamSize - position); ! OMUInt32 readSize; ! if (remaining < byteCount) { ! readSize = remaining; ! } else { ! readSize = byteCount; ! } ! ASSERT("Valid read size", readSize != 0); ! OMUInt32 br; ! _file->setPosition(position); ! _file->read(destination, readSize, br); ! ASSERT("All bytes read", br == readSize); ! } } ! // @mfunc Write a page or partial page without using the cache. // @parm TBS // @parm TBS // @parm TBS ! void OMCachedDiskRawStorage::writePage(OMUInt64 position, ! OMUInt32 byteCount, ! const OMByte* source) { ! TRACE("OMCachedDiskRawStorage::writePage"); PRECONDITION("Valid source", source != 0); PRECONDITION("Stream is writable", isWritable()); - OMUInt64 streamSize = extent(); - OMUInt32 remaining = static_cast<OMUInt32>(streamSize - position); - OMUInt32 writeSize; - if (remaining < byteCount) { - writeSize = remaining; - } else { - writeSize = byteCount; - } - ASSERT("Valid write size", writeSize != 0); - OMUInt32 bw; _file->setPosition(position); ! _file->write(source, writeSize, bw); ! ASSERT("All bytes written", bw == writeSize); } --- 288,324 ---- } ! // @mfunc Read bytes without using the cache. // @parm TBS // @parm TBS // @parm TBS ! void OMCachedDiskRawStorage::rawReadAt(OMUInt64 position, ! OMUInt32 byteCount, ! OMByte* destination) { ! TRACE("OMCachedDiskRawStorage::rawReadAt"); PRECONDITION("Valid destination", destination != 0); ! _file->setPosition(position); ! OMUInt32 br; ! _file->read(destination, byteCount, br); ! ASSERT("All bytes read", br == byteCount); } ! // @mfunc Write bytes without using the cache. // @parm TBS // @parm TBS // @parm TBS ! void OMCachedDiskRawStorage::rawWriteAt(OMUInt64 position, ! OMUInt32 byteCount, ! const OMByte* source) { ! TRACE("OMCachedDiskRawStorage::rawWriteAt"); PRECONDITION("Valid source", source != 0); PRECONDITION("Stream is writable", isWritable()); _file->setPosition(position); ! OMUInt32 bw; ! _file->write(source, byteCount, bw); ! ASSERT("All bytes written", bw == byteCount); } *************** *** 348,352 **** OMUInt32 pageSize, OMUInt32 pageCount) ! : OMCachedRawStorage(pageSize, pageCount, file->size()), _file(file), _mode(accessMode) --- 328,332 ---- OMUInt32 pageSize, OMUInt32 pageCount) ! : OMBaseCachedDiskRawStorage(pageSize, pageCount, file->size()), _file(file), _mode(accessMode) |