mirror of https://github.com/PCSX2/pcsx2.git
pcsx2: use int instead of uint on file reader
Fix a crash when offset was negative. Offet becomes bigger than my input file.
This commit is contained in:
parent
1d5b250b58
commit
9e774eb41c
|
@ -25,11 +25,11 @@
|
|||
class AsyncFileReader
|
||||
{
|
||||
protected:
|
||||
AsyncFileReader(void) {m_dataoffset=0;}
|
||||
AsyncFileReader() : m_dataoffset(0) {}
|
||||
|
||||
wxString m_filename;
|
||||
|
||||
uint m_dataoffset;
|
||||
int m_dataoffset;
|
||||
uint m_blocksize;
|
||||
|
||||
public:
|
||||
|
@ -48,7 +48,7 @@ public:
|
|||
virtual uint GetBlockCount(void) const=0;
|
||||
|
||||
virtual void SetBlockSize(uint bytes) {}
|
||||
virtual void SetDataOffset(uint bytes) {}
|
||||
virtual void SetDataOffset(int bytes) {}
|
||||
|
||||
uint GetBlockSize() const { return m_blocksize; }
|
||||
|
||||
|
@ -92,7 +92,7 @@ public:
|
|||
virtual uint GetBlockCount(void) const;
|
||||
|
||||
virtual void SetBlockSize(uint bytes) { m_blocksize = bytes; }
|
||||
virtual void SetDataOffset(uint bytes) { m_dataoffset = bytes; }
|
||||
virtual void SetDataOffset(int bytes) { m_dataoffset = bytes; }
|
||||
};
|
||||
|
||||
// Factory - creates an AsyncFileReader derived instance which can read a compressed file
|
||||
|
|
|
@ -225,7 +225,7 @@ public:
|
|||
};
|
||||
|
||||
virtual void SetBlockSize(uint bytes) { m_blocksize = bytes; }
|
||||
virtual void SetDataOffset(uint bytes) { m_dataoffset = bytes; }
|
||||
virtual void SetDataOffset(int bytes) { m_dataoffset = bytes; }
|
||||
private:
|
||||
class Czstate {
|
||||
public:
|
||||
|
|
|
@ -49,7 +49,7 @@ int FlatFileReader::ReadSync(void* pBuffer, uint sector, uint count)
|
|||
void FlatFileReader::BeginRead(void* pBuffer, uint sector, uint count)
|
||||
{
|
||||
u64 offset;
|
||||
offset = sector * (u64)m_blocksize + m_dataoffset;
|
||||
offset = sector * (s64)m_blocksize + m_dataoffset;
|
||||
|
||||
u32 bytesToRead = count * m_blocksize;
|
||||
|
||||
|
|
Loading…
Reference in New Issue