diff options
author | Jacek Antonelli | 2008-08-15 23:44:59 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:59 -0500 |
commit | a408bac29378072fbf36864164149458c978cfcc (patch) | |
tree | 67feccf1a5d3816611ba48d6762f86f0f7f4b1f6 /linden/indra/llvfs | |
parent | Second Life viewer sources 1.17.0.12 (diff) | |
download | meta-impy-a408bac29378072fbf36864164149458c978cfcc.zip meta-impy-a408bac29378072fbf36864164149458c978cfcc.tar.gz meta-impy-a408bac29378072fbf36864164149458c978cfcc.tar.bz2 meta-impy-a408bac29378072fbf36864164149458c978cfcc.tar.xz |
Second Life viewer sources 1.17.1.0
Diffstat (limited to 'linden/indra/llvfs')
-rw-r--r-- | linden/indra/llvfs/llvfs.cpp | 71 |
1 files changed, 32 insertions, 39 deletions
diff --git a/linden/indra/llvfs/llvfs.cpp b/linden/indra/llvfs/llvfs.cpp index b83d12c..dd5854c 100644 --- a/linden/indra/llvfs/llvfs.cpp +++ b/linden/indra/llvfs/llvfs.cpp | |||
@@ -504,7 +504,7 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r | |||
504 | } | 504 | } |
505 | 505 | ||
506 | // Figure out where the last block ended. | 506 | // Figure out where the last block ended. |
507 | U32 loc = last_file_block->mLocation+last_file_block->mLength; | 507 | S32 loc = last_file_block->mLocation+last_file_block->mLength; |
508 | 508 | ||
509 | // Figure out how much space there is between where | 509 | // Figure out how much space there is between where |
510 | // the last block ended and this block begins. | 510 | // the last block ended and this block begins. |
@@ -512,7 +512,7 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r | |||
512 | 512 | ||
513 | // Check for more errors... Seeing if the current | 513 | // Check for more errors... Seeing if the current |
514 | // entry and the last entry make sense together. | 514 | // entry and the last entry make sense together. |
515 | if (length < 0 || loc < 0 || loc > data_size) | 515 | if (length < 0 || loc < 0 || (U32)loc > data_size) |
516 | { | 516 | { |
517 | // Invalid VFS | 517 | // Invalid VFS |
518 | unlockAndClose( mIndexFP ); | 518 | unlockAndClose( mIndexFP ); |
@@ -1790,53 +1790,46 @@ void LLVFS::audit() | |||
1790 | 1790 | ||
1791 | delete[] buffer; | 1791 | delete[] buffer; |
1792 | 1792 | ||
1793 | if (vfs_corrupt) | 1793 | if (!vfs_corrupt) |
1794 | { | 1794 | { |
1795 | for (std::vector<LLVFSFileBlock*>::iterator iter = audit_blocks.begin(); | 1795 | for (fileblock_map::iterator it = mFileBlocks.begin(); it != mFileBlocks.end(); ++it) |
1796 | iter != audit_blocks.end(); ++iter) | ||
1797 | { | 1796 | { |
1798 | delete *iter; | 1797 | LLVFSFileBlock* block = (*it).second; |
1799 | } | ||
1800 | audit_blocks.clear(); | ||
1801 | return; | ||
1802 | } | ||
1803 | |||
1804 | for (fileblock_map::iterator it = mFileBlocks.begin(); it != mFileBlocks.end(); ++it) | ||
1805 | { | ||
1806 | LLVFSFileBlock* block = (*it).second; | ||
1807 | 1798 | ||
1808 | if (block->mSize > 0) | 1799 | if (block->mSize > 0) |
1809 | { | ||
1810 | if (! found_files.count(*block)) | ||
1811 | { | 1800 | { |
1812 | llwarns << "VFile " << block->mFileID << ":" << block->mFileType << " in memory, not on disk, loc " << block->mIndexLocation<< llendl; | 1801 | if (! found_files.count(*block)) |
1813 | fseek(mIndexFP, block->mIndexLocation, SEEK_SET); | 1802 | { |
1814 | U8 buf[LLVFSFileBlock::SERIAL_SIZE]; | 1803 | llwarns << "VFile " << block->mFileID << ":" << block->mFileType << " in memory, not on disk, loc " << block->mIndexLocation<< llendl; |
1815 | fread(buf, LLVFSFileBlock::SERIAL_SIZE, 1, mIndexFP); | 1804 | fseek(mIndexFP, block->mIndexLocation, SEEK_SET); |
1805 | U8 buf[LLVFSFileBlock::SERIAL_SIZE]; | ||
1806 | fread(buf, LLVFSFileBlock::SERIAL_SIZE, 1, mIndexFP); | ||
1816 | 1807 | ||
1817 | LLVFSFileBlock disk_block; | 1808 | LLVFSFileBlock disk_block; |
1818 | disk_block.deserialize(buf, block->mIndexLocation); | 1809 | disk_block.deserialize(buf, block->mIndexLocation); |
1819 | 1810 | ||
1820 | llwarns << "Instead found " << disk_block.mFileID << ":" << block->mFileType << llendl; | 1811 | llwarns << "Instead found " << disk_block.mFileID << ":" << block->mFileType << llendl; |
1821 | } | 1812 | } |
1822 | else | 1813 | else |
1823 | { | 1814 | { |
1824 | block = found_files.find(*block)->second; | 1815 | block = found_files.find(*block)->second; |
1825 | found_files.erase(*block); | 1816 | found_files.erase(*block); |
1826 | delete block; | 1817 | } |
1827 | } | 1818 | } |
1828 | } | 1819 | } |
1829 | } | ||
1830 | 1820 | ||
1831 | for (std::map<LLVFSFileSpecifier, LLVFSFileBlock*>::iterator iter = found_files.begin(); | 1821 | for (std::map<LLVFSFileSpecifier, LLVFSFileBlock*>::iterator iter = found_files.begin(); |
1832 | iter != found_files.end(); iter++) | 1822 | iter != found_files.end(); iter++) |
1833 | { | 1823 | { |
1834 | LLVFSFileBlock* block = iter->second; | 1824 | LLVFSFileBlock* block = iter->second; |
1835 | llwarns << "VFile " << block->mFileID << ":" << block->mFileType << " szie:" << block->mSize << " leftover" << llendl; | 1825 | llwarns << "VFile " << block->mFileID << ":" << block->mFileType << " szie:" << block->mSize << " leftover" << llendl; |
1836 | } | 1826 | } |
1837 | 1827 | ||
1838 | llinfos << "VFS: audit OK" << llendl; | 1828 | llinfos << "VFS: audit OK" << llendl; |
1839 | // mutex released by LLMutexLock() destructor. | 1829 | // mutex released by LLMutexLock() destructor. |
1830 | } | ||
1831 | |||
1832 | for_each(audit_blocks.begin(), audit_blocks.end(), DeletePointer()); | ||
1840 | } | 1833 | } |
1841 | 1834 | ||
1842 | 1835 | ||