mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-24 13:33:11 +00:00
refactor path interface:
- use wrapper class instead of std::wstring (reduces mixing of strings/paths; allows safe+easy join via operator/ and convenient case-insensitive comparison via operator==, avoids NativePathFromString, similar to boost::filesystem) - NativePath -> OsPath - add hash and To/FromJSVal for Path - add TS_ASSERT_PATH_EQUALS - replace _wfopen_s with sys_OpenFile - remove obsolete SortFiles/Directories This was SVN commit r9107.
This commit is contained in:
@@ -43,9 +43,10 @@ BlockId::BlockId()
|
||||
{
|
||||
}
|
||||
|
||||
BlockId::BlockId(const NativePath& pathname, off_t ofs)
|
||||
BlockId::BlockId(const OsPath& pathname, off_t ofs)
|
||||
{
|
||||
m_id = fnv_hash64(pathname.c_str(), pathname.length()*sizeof(pathname[0]));
|
||||
const Path::String& string = pathname.string();
|
||||
m_id = fnv_hash64(string.c_str(), string.length()*sizeof(string[0]));
|
||||
const size_t indexBits = 16;
|
||||
m_id <<= indexBits;
|
||||
const off_t blockIndex = off_t(ofs / BLOCK_SIZE);
|
||||
|
||||
Reference in New Issue
Block a user