dehydra fixes (mostly copy-ctor warnings)
This was SVN commit r6239.
This commit is contained in:
parent
d1cb55d701
commit
8e86d29301
@ -79,7 +79,7 @@ void CModel::ReleaseData()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// InitModel: setup model from given geometry
|
||||
bool CModel::InitModel(CModelDefPtr modeldef)
|
||||
bool CModel::InitModel(const CModelDefPtr& modeldef)
|
||||
{
|
||||
// clean up any existing data first
|
||||
ReleaseData();
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
~CModel();
|
||||
|
||||
// setup model from given geometry
|
||||
bool InitModel(CModelDefPtr modeldef);
|
||||
bool InitModel(const CModelDefPtr& modeldef);
|
||||
// calculate the world space bounds of this model
|
||||
void CalcBounds();
|
||||
// update this model's state; 'time' is the time since the last update, in MS
|
||||
|
@ -41,16 +41,16 @@ Manager is a template parameterized on typename Key and class Entry.
|
||||
bool empty() const;
|
||||
|
||||
// add (key, entry) to cache.
|
||||
void add(Key key, const Entry& entry);
|
||||
void add(const Key& key, const Entry& entry);
|
||||
|
||||
// if the entry identified by <key> is not in cache, return false;
|
||||
// otherwise return true and pass back a pointer to it.
|
||||
bool find(Key key, const Entry** pentry) const;
|
||||
bool find(const Key& key, const Entry** pentry) const;
|
||||
|
||||
// remove an entry from cache, which is assumed to exist!
|
||||
// this makes sense because callers will typically first use find() to
|
||||
// return info about the entry; this also checks if present.
|
||||
void remove(Key key);
|
||||
void remove(const Key& key);
|
||||
|
||||
// mark <entry> as just accessed for purpose of cache management.
|
||||
// it will tend to be kept in cache longer.
|
||||
@ -215,13 +215,13 @@ public:
|
||||
return map.empty();
|
||||
}
|
||||
|
||||
void add(Key key, const Entry& entry)
|
||||
void add(const Key& key, const Entry& entry)
|
||||
{
|
||||
// adapter for add_ (which returns an iterator)
|
||||
(void)add_(key, entry);
|
||||
}
|
||||
|
||||
bool find(Key key, const Entry** pentry) const
|
||||
bool find(const Key& key, const Entry** pentry) const
|
||||
{
|
||||
MapCIt it = map.find(key);
|
||||
if(it == map.end())
|
||||
@ -230,7 +230,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
void remove(Key key)
|
||||
void remove(const Key& key)
|
||||
{
|
||||
MapIt it = map.find(key);
|
||||
// note: don't complain if not in the cache: this happens after
|
||||
@ -304,7 +304,7 @@ protected:
|
||||
Map map;
|
||||
|
||||
// add entry and return iterator pointing to it.
|
||||
MapIt add_(Key key, const Entry& entry)
|
||||
MapIt add_(const Key& key, const Entry& entry)
|
||||
{
|
||||
typedef std::pair<MapIt, bool> PairIB;
|
||||
typename Map::value_type val = std::make_pair(key, entry);
|
||||
@ -379,7 +379,7 @@ class Landlord_Lazy : public Landlord_Naive<Key, Entry>
|
||||
public:
|
||||
Landlord_Lazy() { pending_delta = 0.0f; }
|
||||
|
||||
void add(Key key, const Entry& entry)
|
||||
void add(const Key& key, const Entry& entry)
|
||||
{
|
||||
// we must apply pending_delta now - otherwise, the existing delta
|
||||
// would later be applied to this newly added item (incorrect).
|
||||
@ -389,7 +389,7 @@ public:
|
||||
pri_q.push(it);
|
||||
}
|
||||
|
||||
void remove(Key key)
|
||||
void remove(const Key& key)
|
||||
{
|
||||
Parent::remove(key);
|
||||
|
||||
@ -531,12 +531,12 @@ public:
|
||||
return lru.empty();
|
||||
}
|
||||
|
||||
void add(Key key, const Entry& entry)
|
||||
void add(const Key& key, const Entry& entry)
|
||||
{
|
||||
lru.push_back(KeyAndEntry(key, entry));
|
||||
}
|
||||
|
||||
bool find(Key key, const Entry** pentry) const
|
||||
bool find(const Key& key, const Entry** pentry) const
|
||||
{
|
||||
CIt it = std::find_if(lru.begin(), lru.end(), KeyEq(key));
|
||||
if(it == lru.end())
|
||||
@ -545,7 +545,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
void remove(Key key)
|
||||
void remove(const Key& key)
|
||||
{
|
||||
std::remove_if(lru.begin(), lru.end(), KeyEq(key));
|
||||
}
|
||||
@ -575,14 +575,14 @@ private:
|
||||
{
|
||||
Key key;
|
||||
Entry entry;
|
||||
KeyAndEntry(Key key_, const Entry& entry_)
|
||||
KeyAndEntry(const Key& key_, const Entry& entry_)
|
||||
: key(key_), entry(entry_) {}
|
||||
};
|
||||
class KeyEq
|
||||
{
|
||||
Key key;
|
||||
public:
|
||||
KeyEq(Key key_) : key(key_) {}
|
||||
KeyEq(const Key& key_) : key(key_) {}
|
||||
bool operator()(const KeyAndEntry& ke) const
|
||||
{
|
||||
return ke.key == key;
|
||||
@ -613,7 +613,7 @@ template<class Item, class Divider> struct CacheEntry
|
||||
{
|
||||
}
|
||||
|
||||
CacheEntry(Item item_, size_t size_, size_t cost_)
|
||||
CacheEntry(const Item& item_, size_t size_, size_t cost_)
|
||||
: item(item_), divider((float)size_)
|
||||
{
|
||||
size = size_;
|
||||
@ -647,7 +647,7 @@ class Cache
|
||||
public:
|
||||
Cache() : mgr() {}
|
||||
|
||||
void add(Key key, Item item, size_t size, size_t cost)
|
||||
void add(const Key& key, const Item& item, size_t size, size_t cost)
|
||||
{
|
||||
return mgr.add(key, Entry(item, size, cost));
|
||||
}
|
||||
@ -656,7 +656,7 @@ public:
|
||||
// if present and determine size via retrieve(), so no need for
|
||||
// error checking.
|
||||
// useful for invalidating single cache entries.
|
||||
void remove(Key key)
|
||||
void remove(const Key& key)
|
||||
{
|
||||
mgr.remove(key);
|
||||
}
|
||||
@ -668,7 +668,7 @@ public:
|
||||
// tending to keep it in cache longer. this parameter is not used in
|
||||
// normal operation - it's only for special cases where we need to
|
||||
// make an end run around the cache accounting (e.g. for cache simulator).
|
||||
bool retrieve(Key key, Item& item, size_t* psize = 0, bool refill_credit = true)
|
||||
bool retrieve(const Key& key, Item& item, size_t* psize = 0, bool refill_credit = true)
|
||||
{
|
||||
const Entry* entry;
|
||||
if(!mgr.find(key, &entry))
|
||||
@ -684,7 +684,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool peek(Key key, Item& item, size_t* psize = 0)
|
||||
bool peek(const Key& key, Item& item, size_t* psize = 0)
|
||||
{
|
||||
return retrieve(key, item, psize, false);
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ cassert(sizeof(ECDR) == 22);
|
||||
class ArchiveFile_Zip : public IArchiveFile
|
||||
{
|
||||
public:
|
||||
ArchiveFile_Zip(PIFile file, off_t ofs, off_t csize, u32 checksum, ZipMethod method)
|
||||
ArchiveFile_Zip(const PIFile& file, off_t ofs, off_t csize, u32 checksum, ZipMethod method)
|
||||
: m_file(file), m_ofs(ofs)
|
||||
, m_csize(csize), m_checksum(checksum), m_method((u16)method)
|
||||
, m_flags(NeedsFixup)
|
||||
@ -248,7 +248,7 @@ public:
|
||||
return 'A';
|
||||
}
|
||||
|
||||
virtual LibError Load(const std::string& UNUSED(name), shared_ptr<u8> buf, size_t size) const
|
||||
virtual LibError Load(const std::string& UNUSED(name), const shared_ptr<u8>& buf, size_t size) const
|
||||
{
|
||||
AdjustOffset();
|
||||
|
||||
@ -439,7 +439,7 @@ private:
|
||||
// search for ECDR in the last <maxScanSize> bytes of the file.
|
||||
// if found, fill <dst_ecdr> with a copy of the (little-endian) ECDR and
|
||||
// return INFO::OK, otherwise IO error or ERR::CORRUPTED.
|
||||
static LibError ScanForEcdr(PIFile file, off_t fileSize, u8* buf, off_t maxScanSize, size_t& cd_numEntries, off_t& cd_ofs, off_t& cd_size)
|
||||
static LibError ScanForEcdr(const PIFile& file, off_t fileSize, u8* buf, off_t maxScanSize, size_t& cd_numEntries, off_t& cd_ofs, off_t& cd_size)
|
||||
{
|
||||
// don't scan more than the entire file
|
||||
const off_t scanSize = std::min(maxScanSize, fileSize);
|
||||
@ -458,7 +458,7 @@ private:
|
||||
return INFO::OK;
|
||||
}
|
||||
|
||||
static LibError LocateCentralDirectory(PIFile file, off_t fileSize, off_t& cd_ofs, size_t& cd_numEntries, off_t& cd_size)
|
||||
static LibError LocateCentralDirectory(const PIFile& file, off_t fileSize, off_t& cd_ofs, size_t& cd_numEntries, off_t& cd_size)
|
||||
{
|
||||
const off_t maxScanSize = 66000u; // see below
|
||||
shared_ptr<u8> buf = io_Allocate(maxScanSize, BLOCK_SIZE-1); // assume worst-case for alignment
|
||||
|
@ -82,7 +82,7 @@ bool OutputBufferManager::IsAllowableBuffer(u8* buffer, size_t size)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
Stream::Stream(PICodec codec)
|
||||
Stream::Stream(const PICodec& codec)
|
||||
: m_codec(codec)
|
||||
, m_inConsumed(0), m_outProduced(0)
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ private:
|
||||
class Stream
|
||||
{
|
||||
public:
|
||||
Stream(PICodec codec);
|
||||
Stream(const PICodec& codec);
|
||||
|
||||
void SetOutputBuffer(u8* out, size_t outSize);
|
||||
|
||||
|
@ -8,7 +8,7 @@ struct IFileLoader
|
||||
virtual size_t Precedence() const = 0;
|
||||
virtual char LocationCode() const = 0;
|
||||
|
||||
virtual LibError Load(const std::string& name, shared_ptr<u8> buf, size_t size) const = 0;
|
||||
virtual LibError Load(const std::string& name, const shared_ptr<u8>& buf, size_t size) const = 0;
|
||||
};
|
||||
|
||||
typedef shared_ptr<IFileLoader> PIFileLoader;
|
||||
|
@ -24,7 +24,7 @@ RealDirectory::RealDirectory(const Path& path, size_t priority, int flags)
|
||||
}
|
||||
|
||||
|
||||
/*virtual*/ LibError RealDirectory::Load(const std::string& name, shared_ptr<u8> buf, size_t size) const
|
||||
/*virtual*/ LibError RealDirectory::Load(const std::string& name, const shared_ptr<u8>& buf, size_t size) const
|
||||
{
|
||||
PIFile file = CreateFile_Posix();
|
||||
RETURN_ERR(file->Open(m_path/name, 'r'));
|
||||
@ -34,7 +34,7 @@ RealDirectory::RealDirectory(const Path& path, size_t priority, int flags)
|
||||
}
|
||||
|
||||
|
||||
LibError RealDirectory::Store(const std::string& name, shared_ptr<u8> fileContents, size_t size)
|
||||
LibError RealDirectory::Store(const std::string& name, const shared_ptr<u8>& fileContents, size_t size)
|
||||
{
|
||||
const Path pathname(m_path/name);
|
||||
|
||||
@ -60,7 +60,7 @@ void RealDirectory::Watch()
|
||||
}
|
||||
|
||||
|
||||
PRealDirectory CreateRealSubdirectory(PRealDirectory realDirectory, const std::string& subdirectoryName)
|
||||
PRealDirectory CreateRealSubdirectory(const PRealDirectory& realDirectory, const std::string& subdirectoryName)
|
||||
{
|
||||
const Path path(realDirectory->GetPath()/subdirectoryName);
|
||||
return PRealDirectory(new RealDirectory(path, realDirectory->Priority(), realDirectory->Flags()));
|
||||
|
@ -27,9 +27,9 @@ public:
|
||||
// IFileLoader
|
||||
virtual size_t Precedence() const;
|
||||
virtual char LocationCode() const;
|
||||
virtual LibError Load(const std::string& name, shared_ptr<u8> buf, size_t size) const;
|
||||
virtual LibError Load(const std::string& name, const shared_ptr<u8>& buf, size_t size) const;
|
||||
|
||||
LibError Store(const std::string& name, shared_ptr<u8> fileContents, size_t size);
|
||||
LibError Store(const std::string& name, const shared_ptr<u8>& fileContents, size_t size);
|
||||
|
||||
void Watch();
|
||||
|
||||
@ -53,6 +53,6 @@ private:
|
||||
|
||||
typedef shared_ptr<RealDirectory> PRealDirectory;
|
||||
|
||||
extern PRealDirectory CreateRealSubdirectory(PRealDirectory realDirectory, const std::string& subdirectoryName);
|
||||
extern PRealDirectory CreateRealSubdirectory(const PRealDirectory& realDirectory, const std::string& subdirectoryName);
|
||||
|
||||
#endif // #ifndef INCLUDED_REAL_DIRECTORY
|
||||
|
@ -51,7 +51,7 @@ bool BlockId::operator!=(const BlockId& rhs) const
|
||||
|
||||
struct Block
|
||||
{
|
||||
Block(BlockId id, shared_ptr<u8> buf)
|
||||
Block(BlockId id, const shared_ptr<u8>& buf)
|
||||
{
|
||||
this->id = id;
|
||||
this->buf = buf;
|
||||
@ -76,7 +76,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void Add(BlockId id, shared_ptr<u8> buf)
|
||||
void Add(BlockId id, const shared_ptr<u8>& buf)
|
||||
{
|
||||
if(m_blocks.size() > m_maxBlocks)
|
||||
{
|
||||
@ -129,7 +129,7 @@ BlockCache::BlockCache(size_t numBlocks)
|
||||
{
|
||||
}
|
||||
|
||||
void BlockCache::Add(BlockId id, shared_ptr<u8> buf)
|
||||
void BlockCache::Add(BlockId id, const shared_ptr<u8>& buf)
|
||||
{
|
||||
impl->Add(id, buf);
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
* satisfy subsequent Retrieve calls for the same id.
|
||||
* if CONFIG2_CACHE_READ_ONLY, the memory is made read-only.
|
||||
**/
|
||||
void Add(BlockId id, shared_ptr<u8> buf);
|
||||
void Add(BlockId id, const shared_ptr<u8>& buf);
|
||||
|
||||
/**
|
||||
* Attempt to retrieve a block's contents.
|
||||
|
@ -114,7 +114,7 @@ shared_ptr<u8> io_Allocate(size_t size, off_t ofs)
|
||||
class BlockIo
|
||||
{
|
||||
public:
|
||||
LibError Issue(PIFile file, off_t alignedOfs, u8* alignedBuf)
|
||||
LibError Issue(const PIFile& file, off_t alignedOfs, u8* alignedBuf)
|
||||
{
|
||||
m_file = file;
|
||||
m_blockId = BlockId(file->Pathname(), alignedOfs);
|
||||
@ -210,7 +210,7 @@ public:
|
||||
m_misalignment = ofs - m_alignedOfs;
|
||||
}
|
||||
|
||||
LibError Run(PIFile file, IoCallback cb = 0, uintptr_t cbData = 0)
|
||||
LibError Run(const PIFile& file, IoCallback cb = 0, uintptr_t cbData = 0)
|
||||
{
|
||||
ScopedIoMonitor monitor;
|
||||
|
||||
@ -289,7 +289,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
LibError io_Scan(PIFile file, off_t ofs, off_t size, IoCallback cb, uintptr_t cbData)
|
||||
LibError io_Scan(const PIFile& file, off_t ofs, off_t size, IoCallback cb, uintptr_t cbData)
|
||||
{
|
||||
u8* alignedBuf = 0; // use temporary block buffers
|
||||
IoSplitter splitter(ofs, alignedBuf, size);
|
||||
@ -297,7 +297,7 @@ LibError io_Scan(PIFile file, off_t ofs, off_t size, IoCallback cb, uintptr_t cb
|
||||
}
|
||||
|
||||
|
||||
LibError io_Read(PIFile file, off_t ofs, u8* alignedBuf, size_t size, u8*& data)
|
||||
LibError io_Read(const PIFile& file, off_t ofs, u8* alignedBuf, size_t size, u8*& data)
|
||||
{
|
||||
IoSplitter splitter(ofs, alignedBuf, (off_t)size);
|
||||
RETURN_ERR(splitter.Run(file));
|
||||
@ -306,7 +306,7 @@ LibError io_Read(PIFile file, off_t ofs, u8* alignedBuf, size_t size, u8*& data)
|
||||
}
|
||||
|
||||
|
||||
LibError io_WriteAligned(PIFile file, off_t alignedOfs, const u8* alignedData, size_t size)
|
||||
LibError io_WriteAligned(const PIFile& file, off_t alignedOfs, const u8* alignedData, size_t size)
|
||||
{
|
||||
debug_assert(IsAligned_Offset(alignedOfs));
|
||||
debug_assert(IsAligned_Data(alignedData));
|
||||
@ -316,7 +316,7 @@ LibError io_WriteAligned(PIFile file, off_t alignedOfs, const u8* alignedData, s
|
||||
}
|
||||
|
||||
|
||||
LibError io_ReadAligned(PIFile file, off_t alignedOfs, u8* alignedBuf, size_t size)
|
||||
LibError io_ReadAligned(const PIFile& file, off_t alignedOfs, u8* alignedBuf, size_t size)
|
||||
{
|
||||
debug_assert(IsAligned_Offset(alignedOfs));
|
||||
debug_assert(IsAligned_Data(alignedBuf));
|
||||
|
@ -28,11 +28,11 @@ LIB_API shared_ptr<u8> io_Allocate(size_t size, off_t ofs = 0);
|
||||
**/
|
||||
typedef LibError (*IoCallback)(uintptr_t cbData, const u8* block, size_t blockSize);
|
||||
|
||||
LIB_API LibError io_Scan(PIFile file, off_t ofs, off_t size, IoCallback cb, uintptr_t cbData);
|
||||
LIB_API LibError io_Scan(const PIFile& file, off_t ofs, off_t size, IoCallback cb, uintptr_t cbData);
|
||||
|
||||
LIB_API LibError io_Read(PIFile file, off_t ofs, u8* alignedBuf, size_t size, u8*& data);
|
||||
LIB_API LibError io_Read(const PIFile& file, off_t ofs, u8* alignedBuf, size_t size, u8*& data);
|
||||
|
||||
LIB_API LibError io_WriteAligned(PIFile file, off_t alignedOfs, const u8* alignedData, size_t size);
|
||||
LIB_API LibError io_ReadAligned(PIFile file, off_t alignedOfs, u8* alignedBuf, size_t size);
|
||||
LIB_API LibError io_WriteAligned(const PIFile& file, off_t alignedOfs, const u8* alignedData, size_t size);
|
||||
LIB_API LibError io_ReadAligned(const PIFile& file, off_t alignedOfs, u8* alignedBuf, size_t size);
|
||||
|
||||
#endif // #ifndef INCLUDED_IO
|
||||
|
@ -39,7 +39,7 @@ void WriteBuffer::Overwrite(const void* data, size_t size, size_t offset)
|
||||
// UnalignedWriter
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
UnalignedWriter::UnalignedWriter(PIFile file, off_t ofs)
|
||||
UnalignedWriter::UnalignedWriter(const PIFile& file, off_t ofs)
|
||||
: m_file(file), m_alignedBuf(io_Allocate(BLOCK_SIZE))
|
||||
{
|
||||
m_alignedOfs = AlignedOffset(ofs);
|
||||
|
@ -32,7 +32,7 @@ private:
|
||||
class UnalignedWriter : public noncopyable
|
||||
{
|
||||
public:
|
||||
UnalignedWriter(PIFile file, off_t ofs);
|
||||
UnalignedWriter(const PIFile& file, off_t ofs);
|
||||
~UnalignedWriter();
|
||||
|
||||
/**
|
||||
|
@ -55,7 +55,7 @@ typedef shared_ptr<Allocator> PAllocator;
|
||||
class FileCacheDeleter
|
||||
{
|
||||
public:
|
||||
FileCacheDeleter(size_t size, PAllocator allocator)
|
||||
FileCacheDeleter(size_t size, const PAllocator& allocator)
|
||||
: m_size(size), m_allocator(allocator)
|
||||
{
|
||||
}
|
||||
@ -78,7 +78,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
shared_ptr<u8> Allocate(size_t size, PAllocator pthis)
|
||||
shared_ptr<u8> Allocate(size_t size, const PAllocator& pthis)
|
||||
{
|
||||
const size_t alignedSize = round_up(size, BLOCK_SIZE);
|
||||
|
||||
@ -171,7 +171,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void Add(const VfsPath& pathname, shared_ptr<u8> data, size_t size, size_t cost)
|
||||
void Add(const VfsPath& pathname, const shared_ptr<u8>& data, size_t size, size_t cost)
|
||||
{
|
||||
// zero-copy cache => all users share the contents => must not
|
||||
// allow changes. this will be reverted when deallocating.
|
||||
@ -217,7 +217,7 @@ shared_ptr<u8> FileCache::Reserve(size_t size)
|
||||
return impl->Reserve(size);
|
||||
}
|
||||
|
||||
void FileCache::Add(const VfsPath& pathname, shared_ptr<u8> data, size_t size, size_t cost)
|
||||
void FileCache::Add(const VfsPath& pathname, const shared_ptr<u8>& data, size_t size, size_t cost)
|
||||
{
|
||||
impl->Add(pathname, data, size, cost);
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
* @param cost is the expected cost of retrieving the file again and
|
||||
* influences how/when it is evicted from the cache.
|
||||
**/
|
||||
void Add(const VfsPath& pathname, shared_ptr<u8> data, size_t size, size_t cost = 1);
|
||||
void Add(const VfsPath& pathname, const shared_ptr<u8>& data, size_t size, size_t cost = 1);
|
||||
|
||||
/**
|
||||
* Remove a file's contents from the cache (if it exists).
|
||||
|
@ -65,12 +65,12 @@ public:
|
||||
|
||||
// note: only allowing either reads or writes simplifies file cache
|
||||
// coherency (need only invalidate when closing a FILE_WRITE file).
|
||||
virtual LibError CreateFile(const VfsPath& pathname, shared_ptr<u8> fileContents, size_t size)
|
||||
virtual LibError CreateFile(const VfsPath& pathname, const shared_ptr<u8>& fileContents, size_t size)
|
||||
{
|
||||
VfsDirectory* directory;
|
||||
CHECK_ERR(vfs_Lookup(pathname, &m_rootDirectory, directory, 0, VFS_LOOKUP_ADD|VFS_LOOKUP_CREATE));
|
||||
|
||||
PRealDirectory realDirectory = directory->AssociatedDirectory();
|
||||
const PRealDirectory& realDirectory = directory->AssociatedDirectory();
|
||||
const std::string& name = pathname.leaf();
|
||||
RETURN_ERR(realDirectory->Store(name, fileContents, size));
|
||||
|
||||
@ -146,7 +146,7 @@ public:
|
||||
{
|
||||
VfsDirectory* directory;
|
||||
CHECK_ERR(vfs_Lookup(pathname, &m_rootDirectory, directory, 0));
|
||||
PRealDirectory realDirectory = directory->AssociatedDirectory();
|
||||
const PRealDirectory& realDirectory = directory->AssociatedDirectory();
|
||||
realPathname = realDirectory->GetPath() / pathname.leaf();
|
||||
return INFO::OK;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ struct IVFS
|
||||
* rationale: disallowing partial writes simplifies file cache coherency
|
||||
* (need only be invalidated when closing a FILE_WRITE file).
|
||||
**/
|
||||
virtual LibError CreateFile(const VfsPath& pathname, shared_ptr<u8> fileContents, size_t size) = 0;
|
||||
virtual LibError CreateFile(const VfsPath& pathname, const shared_ptr<u8>& fileContents, size_t size) = 0;
|
||||
|
||||
/**
|
||||
* read an entire file into memory.
|
||||
|
@ -32,7 +32,7 @@ static size_t s_numArchivedFiles;
|
||||
class PopulateHelper : noncopyable
|
||||
{
|
||||
public:
|
||||
PopulateHelper(VfsDirectory* directory, PRealDirectory realDirectory)
|
||||
PopulateHelper(VfsDirectory* directory, const PRealDirectory& realDirectory)
|
||||
: m_directory(directory), m_realDirectory(realDirectory)
|
||||
{
|
||||
}
|
||||
@ -121,7 +121,7 @@ static LibError Populate(VfsDirectory* directory)
|
||||
if(!directory->ShouldPopulate())
|
||||
return INFO::OK;
|
||||
|
||||
PRealDirectory realDirectory = directory->AssociatedDirectory();
|
||||
const PRealDirectory& realDirectory = directory->AssociatedDirectory();
|
||||
|
||||
if(realDirectory->Flags() & VFS_MOUNT_WATCH)
|
||||
realDirectory->Watch();
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
VfsFile::VfsFile(const std::string& name, off_t size, time_t mtime, size_t priority, PIFileLoader loader)
|
||||
VfsFile::VfsFile(const std::string& name, off_t size, time_t mtime, size_t priority, const PIFileLoader& loader)
|
||||
: m_name(name), m_size(size), m_mtime(mtime), m_priority(priority), m_loader(loader)
|
||||
{
|
||||
}
|
||||
@ -62,7 +62,7 @@ void VfsFile::GenerateDescription(char* text, size_t maxChars) const
|
||||
}
|
||||
|
||||
|
||||
LibError VfsFile::Load(shared_ptr<u8> buf) const
|
||||
LibError VfsFile::Load(const shared_ptr<u8>& buf) const
|
||||
{
|
||||
return m_loader->Load(Name(), buf, Size());
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
class VfsFile
|
||||
{
|
||||
public:
|
||||
VfsFile(const std::string& name, off_t size, time_t mtime, size_t priority, PIFileLoader provider);
|
||||
VfsFile(const std::string& name, off_t size, time_t mtime, size_t priority, const PIFileLoader& provider);
|
||||
|
||||
const std::string& Name() const
|
||||
{
|
||||
@ -39,7 +39,7 @@ public:
|
||||
|
||||
void GenerateDescription(char* text, size_t maxChars) const;
|
||||
|
||||
LibError Load(shared_ptr<u8> buf) const;
|
||||
LibError Load(const shared_ptr<u8>& buf) const;
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
@ -80,7 +80,7 @@ public:
|
||||
|
||||
void Attach(const PRealDirectory& realDirectory);
|
||||
|
||||
PRealDirectory AssociatedDirectory() const
|
||||
const PRealDirectory& AssociatedDirectory() const
|
||||
{
|
||||
return m_realDirectory;
|
||||
}
|
||||
|
@ -496,7 +496,7 @@ bool tex_is_known_extension(const char* filename)
|
||||
//
|
||||
// we need only add bookkeeping information and "wrap" it in
|
||||
// our Tex struct, hence the name.
|
||||
LibError tex_wrap(size_t w, size_t h, size_t bpp, int flags, shared_ptr<u8> data, size_t ofs, Tex* t)
|
||||
LibError tex_wrap(size_t w, size_t h, size_t bpp, int flags, const shared_ptr<u8>& data, size_t ofs, Tex* t)
|
||||
{
|
||||
t->w = w;
|
||||
t->h = h;
|
||||
@ -587,7 +587,7 @@ size_t tex_hdr_size(const VfsPath& filename)
|
||||
// read/write from memory and disk
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
LibError tex_decode(shared_ptr<u8> data, size_t data_size, Tex* t)
|
||||
LibError tex_decode(const shared_ptr<u8>& data, size_t data_size, Tex* t)
|
||||
{
|
||||
const TexCodecVTbl* c;
|
||||
RETURN_ERR(tex_codec_for_header(data.get(), data_size, &c));
|
||||
|
@ -255,7 +255,7 @@ extern void tex_codec_register_all();
|
||||
* @param t output texture object.
|
||||
* @return LibError.
|
||||
**/
|
||||
extern LibError tex_decode(shared_ptr<u8> data, size_t data_size, Tex* t);
|
||||
extern LibError tex_decode(const shared_ptr<u8>& data, size_t data_size, Tex* t);
|
||||
|
||||
/**
|
||||
* encode a texture into a memory buffer in the desired file format.
|
||||
@ -291,7 +291,7 @@ extern LibError tex_encode(Tex* t, const std::string& extension, DynArray* da);
|
||||
* @param t output texture object.
|
||||
* @return LibError
|
||||
**/
|
||||
extern LibError tex_wrap(size_t w, size_t h, size_t bpp, int flags, shared_ptr<u8> data, size_t ofs, Tex* t);
|
||||
extern LibError tex_wrap(size_t w, size_t h, size_t bpp, int flags, const shared_ptr<u8>& data, size_t ofs, Tex* t);
|
||||
|
||||
/**
|
||||
* free all resources associated with the image and make further
|
||||
|
@ -98,7 +98,7 @@ void CXeromyces::Terminate()
|
||||
|
||||
|
||||
// Find out write location of the XMB file corresponding to xmlFilename
|
||||
void CXeromyces::GetXMBPath(PIVFS vfs, const VfsPath& xmlFilename, const VfsPath& xmbFilename, VfsPath& xmbActualPath)
|
||||
void CXeromyces::GetXMBPath(const PIVFS& vfs, const VfsPath& xmlFilename, const VfsPath& xmbFilename, VfsPath& xmbActualPath)
|
||||
{
|
||||
// rationale:
|
||||
// - it is necessary to write out XMB files into a subdirectory
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
private:
|
||||
|
||||
// Find out write location of the XMB file corresponding to xmlFilename
|
||||
static void GetXMBPath(PIVFS vfs, const VfsPath& xmlFilename, const VfsPath& xmbFilename, VfsPath& xmbActualPath);
|
||||
static void GetXMBPath(const PIVFS& vfs, const VfsPath& xmlFilename, const VfsPath& xmbFilename, VfsPath& xmbActualPath);
|
||||
|
||||
bool ReadXMBFile(const VfsPath& filename);
|
||||
|
||||
|
@ -41,12 +41,12 @@ struct FFModelDef : public CModelDefRPrivate
|
||||
/// UV coordinates are stored in the static array
|
||||
VertexArray::Attribute m_UV;
|
||||
|
||||
FFModelDef(CModelDefPtr mdef);
|
||||
FFModelDef(const CModelDefPtr& mdef);
|
||||
~FFModelDef() { delete[] m_Indices; }
|
||||
};
|
||||
|
||||
|
||||
FFModelDef::FFModelDef(CModelDefPtr mdef)
|
||||
FFModelDef::FFModelDef(const CModelDefPtr& mdef)
|
||||
: m_Array(false)
|
||||
{
|
||||
size_t numVertices = mdef->GetNumVertices();
|
||||
@ -230,7 +230,7 @@ void FixedFunctionModelRenderer::EndPass(int streamflags)
|
||||
|
||||
|
||||
// Prepare UV coordinates for this modeldef
|
||||
void FixedFunctionModelRenderer::PrepareModelDef(int streamflags, CModelDefPtr def)
|
||||
void FixedFunctionModelRenderer::PrepareModelDef(int streamflags, const CModelDefPtr& def)
|
||||
{
|
||||
m->ffmodeldef = (FFModelDef*)def->GetRenderData(m);
|
||||
|
||||
@ -279,5 +279,3 @@ void FixedFunctionModelRenderer::RenderModel(int streamflags, CModel* model, voi
|
||||
g_Renderer.m_Stats.m_DrawCalls++;
|
||||
g_Renderer.m_Stats.m_ModelTris += numFaces;
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
|
||||
void BeginPass(int streamflags, const CMatrix3D* texturematrix);
|
||||
void EndPass(int streamflags);
|
||||
void PrepareModelDef(int streamflags, CModelDefPtr def);
|
||||
void PrepareModelDef(int streamflags, const CModelDefPtr& def);
|
||||
void RenderModel(int streamflags, CModel* model, void* data);
|
||||
|
||||
private:
|
||||
|
@ -39,12 +39,12 @@ struct HWLModelDef : public CModelDefRPrivate
|
||||
u16* m_Indices;
|
||||
|
||||
|
||||
HWLModelDef(CModelDefPtr mdef);
|
||||
HWLModelDef(const CModelDefPtr& mdef);
|
||||
~HWLModelDef() { delete[] m_Indices; }
|
||||
};
|
||||
|
||||
|
||||
HWLModelDef::HWLModelDef(CModelDefPtr mdef)
|
||||
HWLModelDef::HWLModelDef(const CModelDefPtr& mdef)
|
||||
{
|
||||
m_Indices = new u16[mdef->GetNumFaces()*3];
|
||||
ModelRenderer::BuildIndices(mdef, m_Indices);
|
||||
@ -272,7 +272,7 @@ void HWLightingModelRenderer::EndPass(int streamflags)
|
||||
|
||||
|
||||
// Prepare UV coordinates for this modeldef
|
||||
void HWLightingModelRenderer::PrepareModelDef(int UNUSED(streamflags), CModelDefPtr def)
|
||||
void HWLightingModelRenderer::PrepareModelDef(int UNUSED(streamflags), const CModelDefPtr& def)
|
||||
{
|
||||
m->hwlmodeldef = (HWLModelDef*)def->GetRenderData(m);
|
||||
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
|
||||
void BeginPass(int streamflags, const CMatrix3D* texturematrix);
|
||||
void EndPass(int streamflags);
|
||||
void PrepareModelDef(int streamflags, CModelDefPtr def);
|
||||
void PrepareModelDef(int streamflags, const CModelDefPtr& def);
|
||||
void RenderModel(int streamflags, CModel* model, void* data);
|
||||
|
||||
/**
|
||||
|
@ -47,12 +47,12 @@ struct IModelDef : public CModelDefRPrivate
|
||||
u16* m_Indices;
|
||||
|
||||
|
||||
IModelDef(CModelDefPtr mdef);
|
||||
IModelDef(const CModelDefPtr& mdef);
|
||||
~IModelDef() { delete[] m_Indices; }
|
||||
};
|
||||
|
||||
|
||||
IModelDef::IModelDef(CModelDefPtr mdef)
|
||||
IModelDef::IModelDef(const CModelDefPtr& mdef)
|
||||
: m_Array(false)
|
||||
{
|
||||
size_t numVertices = mdef->GetNumVertices();
|
||||
@ -222,7 +222,7 @@ void InstancingModelRenderer::EndPass(int streamflags)
|
||||
|
||||
|
||||
// Prepare UV coordinates for this modeldef
|
||||
void InstancingModelRenderer::PrepareModelDef(int streamflags, CModelDefPtr def)
|
||||
void InstancingModelRenderer::PrepareModelDef(int streamflags, const CModelDefPtr& def)
|
||||
{
|
||||
m->imodeldef = (IModelDef*)def->GetRenderData(m);
|
||||
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
|
||||
void BeginPass(int streamflags, const CMatrix3D* texturematrix);
|
||||
void EndPass(int streamflags);
|
||||
void PrepareModelDef(int streamflags, CModelDefPtr def);
|
||||
void PrepareModelDef(int streamflags, const CModelDefPtr& def);
|
||||
void RenderModel(int streamflags, CModel* model, void* data);
|
||||
|
||||
/**
|
||||
|
@ -35,9 +35,9 @@
|
||||
|
||||
// Helper function to copy object-space position and normal vectors into arrays.
|
||||
void ModelRenderer::CopyPositionAndNormals(
|
||||
CModelDefPtr mdef,
|
||||
VertexArrayIterator<CVector3D> Position,
|
||||
VertexArrayIterator<CVector3D> Normal)
|
||||
const CModelDefPtr& mdef,
|
||||
const VertexArrayIterator<CVector3D>& Position,
|
||||
const VertexArrayIterator<CVector3D>& Normal)
|
||||
{
|
||||
size_t numVertices = mdef->GetNumVertices();
|
||||
SModelVertex* vertices = mdef->GetVertices();
|
||||
@ -52,8 +52,8 @@ void ModelRenderer::CopyPositionAndNormals(
|
||||
// Helper function to transform position and normal vectors into world-space.
|
||||
void ModelRenderer::BuildPositionAndNormals(
|
||||
CModel* model,
|
||||
VertexArrayIterator<CVector3D> Position,
|
||||
VertexArrayIterator<CVector3D> Normal)
|
||||
const VertexArrayIterator<CVector3D>& Position,
|
||||
const VertexArrayIterator<CVector3D>& Normal)
|
||||
{
|
||||
CModelDefPtr mdef = model->GetModelDef();
|
||||
size_t numVertices = mdef->GetNumVertices();
|
||||
@ -96,8 +96,8 @@ void ModelRenderer::BuildPositionAndNormals(
|
||||
// Helper function for lighting
|
||||
void ModelRenderer::BuildColor4ub(
|
||||
CModel* model,
|
||||
VertexArrayIterator<CVector3D> Normal,
|
||||
VertexArrayIterator<SColor4ub> Color,
|
||||
const VertexArrayIterator<CVector3D>& Normal,
|
||||
const VertexArrayIterator<SColor4ub>& Color,
|
||||
bool onlyDiffuse)
|
||||
{
|
||||
PROFILE( "lighting vertices" );
|
||||
@ -135,23 +135,23 @@ void ModelRenderer::BuildColor4ub(
|
||||
|
||||
// Copy UV coordinates
|
||||
void ModelRenderer::BuildUV(
|
||||
CModelDefPtr mdef,
|
||||
VertexArrayIterator<float[2]> UV)
|
||||
const CModelDefPtr& mdef,
|
||||
const VertexArrayIterator<float[2]>& UV)
|
||||
{
|
||||
size_t numVertices = mdef->GetNumVertices();
|
||||
SModelVertex* vertices = mdef->GetVertices();
|
||||
|
||||
for (size_t j=0; j < numVertices; ++j, ++UV)
|
||||
for (size_t j=0; j < numVertices; ++j)
|
||||
{
|
||||
(*UV)[0] = vertices[j].m_U;
|
||||
(*UV)[1] = 1.0-vertices[j].m_V;
|
||||
UV[j][0] = vertices[j].m_U;
|
||||
UV[j][1] = 1.0-vertices[j].m_V;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Build default indices array.
|
||||
void ModelRenderer::BuildIndices(
|
||||
CModelDefPtr mdef,
|
||||
const CModelDefPtr& mdef,
|
||||
u16* Indices)
|
||||
{
|
||||
size_t idxidx = 0;
|
||||
@ -209,7 +209,7 @@ struct BMRModelData : public CModelRData
|
||||
*/
|
||||
struct BMRModelDefTracker : public CModelDefRPrivate
|
||||
{
|
||||
BMRModelDefTracker(CModelDefPtr mdef)
|
||||
BMRModelDefTracker(const CModelDefPtr& mdef)
|
||||
: m_ModelDef(mdef), m_Next(0), m_Slots(0) { }
|
||||
|
||||
/// Back-link to the CModelDef object
|
||||
@ -258,7 +258,7 @@ struct BatchModelRendererInternals
|
||||
vertexRenderer->DestroyModelData(model, data);
|
||||
}
|
||||
|
||||
void RenderAllModels(RenderModifierPtr modifier, int filterflags, int pass, int streamflags);
|
||||
void RenderAllModels(const RenderModifierPtr& modifier, int filterflags, int pass, int streamflags);
|
||||
};
|
||||
|
||||
BMRModelData::~BMRModelData()
|
||||
@ -406,7 +406,7 @@ bool BatchModelRenderer::HaveSubmissions()
|
||||
|
||||
|
||||
// Render models, outer loop for multi-passing
|
||||
void BatchModelRenderer::Render(RenderModifierPtr modifier, int flags)
|
||||
void BatchModelRenderer::Render(const RenderModifierPtr& modifier, int flags)
|
||||
{
|
||||
debug_assert(m->phase == BMRRender);
|
||||
|
||||
@ -434,7 +434,7 @@ void BatchModelRenderer::Render(RenderModifierPtr modifier, int flags)
|
||||
|
||||
// Render one frame worth of models
|
||||
void BatchModelRendererInternals::RenderAllModels(
|
||||
RenderModifierPtr modifier, int filterflags,
|
||||
const RenderModifierPtr& modifier, int filterflags,
|
||||
int pass, int streamflags)
|
||||
{
|
||||
for(BMRModelDefTracker* mdeftracker = submissions; mdeftracker; mdeftracker = mdeftracker->m_Next)
|
||||
|
@ -153,7 +153,7 @@ public:
|
||||
* If flags is non-zero, only models that contain flags in their
|
||||
* CModel::GetFlags() are rendered.
|
||||
*/
|
||||
virtual void Render(RenderModifierPtr modifier, int flags) = 0;
|
||||
virtual void Render(const RenderModifierPtr& modifier, int flags) = 0;
|
||||
|
||||
/**
|
||||
* CopyPositionAndNormals: Copy unanimated object-space vertices and
|
||||
@ -168,9 +168,9 @@ public:
|
||||
* The array behind the iterator must be as large as the Position array.
|
||||
*/
|
||||
static void CopyPositionAndNormals(
|
||||
CModelDefPtr mdef,
|
||||
VertexArrayIterator<CVector3D> Position,
|
||||
VertexArrayIterator<CVector3D> Normal);
|
||||
const CModelDefPtr& mdef,
|
||||
const VertexArrayIterator<CVector3D>& Position,
|
||||
const VertexArrayIterator<CVector3D>& Normal);
|
||||
|
||||
/**
|
||||
* BuildPositionAndNormals: Build animated vertices and normals,
|
||||
@ -187,8 +187,8 @@ public:
|
||||
*/
|
||||
static void BuildPositionAndNormals(
|
||||
CModel* model,
|
||||
VertexArrayIterator<CVector3D> Position,
|
||||
VertexArrayIterator<CVector3D> Normal);
|
||||
const VertexArrayIterator<CVector3D>& Position,
|
||||
const VertexArrayIterator<CVector3D>& Normal);
|
||||
|
||||
/**
|
||||
* BuildColor4ub: Build lighting colors for the given model,
|
||||
@ -205,8 +205,8 @@ public:
|
||||
*/
|
||||
static void BuildColor4ub(
|
||||
CModel* model,
|
||||
VertexArrayIterator<CVector3D> Normal,
|
||||
VertexArrayIterator<SColor4ub> Color,
|
||||
const VertexArrayIterator<CVector3D>& Normal,
|
||||
const VertexArrayIterator<SColor4ub>& Color,
|
||||
bool onlyDiffuse);
|
||||
|
||||
/**
|
||||
@ -218,8 +218,8 @@ public:
|
||||
* mdef->GetNumVertices() vertices.
|
||||
*/
|
||||
static void BuildUV(
|
||||
CModelDefPtr mdef,
|
||||
VertexArrayIterator<float[2]> UV);
|
||||
const CModelDefPtr& mdef,
|
||||
const VertexArrayIterator<float[2]>& UV);
|
||||
|
||||
/**
|
||||
* BuildIndices: Create the indices array for the given CModelDef.
|
||||
@ -229,7 +229,7 @@ public:
|
||||
* mdef->GetNumFaces()*3 elements.
|
||||
*/
|
||||
static void BuildIndices(
|
||||
CModelDefPtr mdef,
|
||||
const CModelDefPtr& mdef,
|
||||
u16* Indices);
|
||||
};
|
||||
|
||||
@ -257,7 +257,7 @@ public:
|
||||
virtual void PrepareModels();
|
||||
virtual void EndFrame();
|
||||
virtual bool HaveSubmissions();
|
||||
virtual void Render(RenderModifierPtr modifier, int flags);
|
||||
virtual void Render(const RenderModifierPtr& modifier, int flags);
|
||||
|
||||
private:
|
||||
BatchModelRendererInternals* m;
|
||||
|
@ -137,7 +137,7 @@ public:
|
||||
* BeginPass.
|
||||
* @param def The model definition.
|
||||
*/
|
||||
virtual void PrepareModelDef(int streamflags, CModelDefPtr def) = 0;
|
||||
virtual void PrepareModelDef(int streamflags, const CModelDefPtr& def) = 0;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -39,7 +39,7 @@
|
||||
*/
|
||||
struct PSModelDef : public CModelDefRPrivate
|
||||
{
|
||||
PSModelDef(CModelDefPtr mdef);
|
||||
PSModelDef(const CModelDefPtr& mdef);
|
||||
|
||||
/// Static vertex array
|
||||
VertexArray m_Array;
|
||||
@ -48,7 +48,7 @@ struct PSModelDef : public CModelDefRPrivate
|
||||
VertexArray::Attribute m_UV;
|
||||
};
|
||||
|
||||
PSModelDef::PSModelDef(CModelDefPtr mdef)
|
||||
PSModelDef::PSModelDef(const CModelDefPtr& mdef)
|
||||
: m_Array(false)
|
||||
{
|
||||
m_UV.type = GL_FLOAT;
|
||||
@ -315,7 +315,7 @@ void PolygonSortModelRenderer::EndPass(int streamflags)
|
||||
|
||||
|
||||
// Prepare for rendering models using this CModelDef
|
||||
void PolygonSortModelRenderer::PrepareModelDef(int streamflags, CModelDefPtr def)
|
||||
void PolygonSortModelRenderer::PrepareModelDef(int streamflags, const CModelDefPtr& def)
|
||||
{
|
||||
if (streamflags & STREAM_UV0)
|
||||
{
|
||||
@ -510,7 +510,7 @@ bool SortModelRenderer::HaveSubmissions()
|
||||
|
||||
|
||||
// Render submitted models (filtered by flags) using the given modifier
|
||||
void SortModelRenderer::Render(RenderModifierPtr modifier, int flags)
|
||||
void SortModelRenderer::Render(const RenderModifierPtr& modifier, int flags)
|
||||
{
|
||||
int pass = 0;
|
||||
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
|
||||
void BeginPass(int streamflags, const CMatrix3D* texturematrix);
|
||||
void EndPass(int streamflags);
|
||||
void PrepareModelDef(int streamflags, CModelDefPtr def);
|
||||
void PrepareModelDef(int streamflags, const CModelDefPtr& def);
|
||||
void RenderModel(int streamflags, CModel* model, void* data);
|
||||
|
||||
private:
|
||||
@ -72,7 +72,7 @@ public:
|
||||
void PrepareModels();
|
||||
void EndFrame();
|
||||
bool HaveSubmissions();
|
||||
void Render(RenderModifierPtr modifier, int flags);
|
||||
void Render(const RenderModifierPtr& modifier, int flags);
|
||||
|
||||
private:
|
||||
SortModelRendererInternals* m;
|
||||
|
Loading…
Reference in New Issue
Block a user