DiscIO: Get rid of a few explicit deletes

This commit is contained in:
Lioncash
2015-12-07 19:53:42 -05:00
parent 9719804cd2
commit 6295297ab3
11 changed files with 86 additions and 120 deletions

View File

@ -14,6 +14,7 @@
// detect whether the file is a compressed blob, or just a big hunk of data, or a drive, and
// automatically do the right thing.
#include <array>
#include <memory>
#include <string>
#include "Common/CommonTypes.h"
@ -57,8 +58,6 @@ class SectorReader : public IBlobReader
public:
virtual ~SectorReader();
// A pointer returned by GetBlockData is invalidated as soon as GetBlockData, Read, or ReadMultipleAlignedBlocks is called again.
const u8 *GetBlockData(u64 block_num);
bool Read(u64 offset, u64 size, u8 *out_ptr) override;
friend class DriveReader;
@ -69,10 +68,13 @@ protected:
virtual bool ReadMultipleAlignedBlocks(u64 block_num, u64 num_blocks, u8 *out_ptr);
private:
// A reference returned by GetBlockData is invalidated as soon as GetBlockData, Read, or ReadMultipleAlignedBlocks is called again.
const std::vector<u8>& GetBlockData(u64 block_num);
enum { CACHE_SIZE = 32 };
int m_blocksize;
u8* m_cache[CACHE_SIZE];
u64 m_cache_tags[CACHE_SIZE];
std::array<std::vector<u8>, CACHE_SIZE> m_cache;
std::array<u64, CACHE_SIZE> m_cache_tags;
};
// Factory function - examines the path to choose the right type of IBlobReader, and returns one.