this to smart_ptr
git-svn-id: https://profuse.googlecode.com/svn/branches/profuse_interim@343 aa027e90-d47c-11dd-86d7-074df07e0730
This commit is contained in:
parent
3f8e7ad7ae
commit
c44145f551
|
@ -53,7 +53,7 @@ BlockCachePointer BlockCache::Create(BlockDevicePointer device)
|
|||
{
|
||||
if (!device.get()) return BlockCachePointer();
|
||||
|
||||
return device->createBlockCache(device);
|
||||
return device->createBlockCache();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -233,9 +233,9 @@ void BlockDevice::sync(TrackSector ts)
|
|||
}
|
||||
*/
|
||||
|
||||
BlockCachePointer BlockDevice::createBlockCache(BlockDevicePointer device)
|
||||
BlockCachePointer BlockDevice::createBlockCache()
|
||||
{
|
||||
unsigned b = blocks();
|
||||
unsigned size = std::max(16u, b / 16);
|
||||
return BlockCachePointer(new ConcreteBlockCache(device, size));
|
||||
return BlockCachePointer(new ConcreteBlockCache(shared_from_this(), size));
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
namespace Device {
|
||||
|
||||
class BlockDevice {
|
||||
class BlockDevice : public std::tr1::enable_shared_from_this<BlockDevice> {
|
||||
public:
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
virtual ~BlockDevice();
|
||||
|
||||
virtual BlockCachePointer createBlockCache(BlockDevicePointer device);
|
||||
virtual BlockCachePointer createBlockCache();
|
||||
|
||||
|
||||
virtual void read(unsigned block, void *bp) = 0;
|
||||
|
|
|
@ -158,9 +158,9 @@ DavexDiskImage *DavexDiskImage::Create(const char *name, size_t blocks, const ch
|
|||
}
|
||||
|
||||
|
||||
BlockCachePointer DavexDiskImage::createBlockCache(BlockDevicePointer device)
|
||||
BlockCachePointer DavexDiskImage::createBlockCache()
|
||||
{
|
||||
// need a smart pointer, but only have this....
|
||||
return BlockCachePointer(new MappedBlockCache(device, 512 + (uint8_t *)address()));
|
||||
return BlockCachePointer(new MappedBlockCache(shared_from_this(), 512 + (uint8_t *)address()));
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
static DavexDiskImage *Create(const char *name, size_t blocks, const char *vname);
|
||||
static DavexDiskImage *Open(MappedFile *);
|
||||
|
||||
virtual BlockCachePointer createBlockCache(BlockDevicePointer device);
|
||||
virtual BlockCachePointer createBlockCache();
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -218,11 +218,11 @@ void DiskCopy42Image::write(unsigned block, const void *bp)
|
|||
}
|
||||
|
||||
|
||||
BlockCachePointer DiskCopy42Image::createBlockCache(BlockDevicePointer device)
|
||||
BlockCachePointer DiskCopy42Image::createBlockCache()
|
||||
{
|
||||
// if not readonly, mark changed so crc will be updated at close.
|
||||
|
||||
if (!readOnly()) _changed = true;
|
||||
|
||||
return BlockCachePointer(new MappedBlockCache(device, address()));
|
||||
return BlockCachePointer(new MappedBlockCache(shared_from_this(), address()));
|
||||
}
|
|
@ -22,7 +22,7 @@ public:
|
|||
virtual void write(unsigned block, const void *bp);
|
||||
|
||||
|
||||
virtual BlockCachePointer createBlockCache(BlockDevicePointer device);
|
||||
virtual BlockCachePointer createBlockCache();
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -138,9 +138,9 @@ void ProDOSOrderDiskImage::Validate(MappedFile *f)
|
|||
|
||||
}
|
||||
|
||||
BlockCachePointer ProDOSOrderDiskImage::createBlockCache(BlockDevicePointer device)
|
||||
BlockCachePointer ProDOSOrderDiskImage::createBlockCache()
|
||||
{
|
||||
return BlockCachePointer(new MappedBlockCache(device, address()));
|
||||
return BlockCachePointer(new MappedBlockCache(shared_from_this(), address()));
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
static ProDOSOrderDiskImage *Open(MappedFile *);
|
||||
|
||||
|
||||
virtual BlockCachePointer createBlockCache(BlockDevicePointer device);
|
||||
virtual BlockCachePointer createBlockCache();
|
||||
|
||||
private:
|
||||
ProDOSOrderDiskImage();
|
||||
|
|
|
@ -141,14 +141,14 @@ bool UniversalDiskImage::readOnly()
|
|||
}
|
||||
|
||||
|
||||
BlockCachePointer UniversalDiskImage::createBlockCache(BlockDevicePointer device)
|
||||
BlockCachePointer UniversalDiskImage::createBlockCache()
|
||||
{
|
||||
if (_format == 1)
|
||||
{
|
||||
return BlockCachePointer(new MappedBlockCache(device, _dataOffset + (uint8_t *)address()));
|
||||
return BlockCachePointer(new MappedBlockCache(shared_from_this(), _dataOffset + (uint8_t *)address()));
|
||||
}
|
||||
|
||||
return DiskImage::createBlockCache(device);
|
||||
return DiskImage::createBlockCache();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
|
||||
virtual bool readOnly();
|
||||
|
||||
virtual BlockCachePointer createBlockCache(BlockDevicePointer device);
|
||||
virtual BlockCachePointer createBlockCache();
|
||||
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue