mirror of
https://github.com/jakcron/nstool
synced 2024-12-25 14:11:14 +00:00
[nstool] Fixed a bug in OffsetAdjustedIFile that failed to track file position.
This commit is contained in:
parent
7c024c290b
commit
e1ccf81e54
1 changed files with 6 additions and 3 deletions
|
@ -36,13 +36,14 @@ size_t OffsetAdjustedIFile::size()
|
|||
void OffsetAdjustedIFile::seek(size_t offset)
|
||||
{
|
||||
mCurrentOffset = MIN(offset, mSize);
|
||||
mFile->seek(offset + mBaseOffset);
|
||||
}
|
||||
|
||||
void OffsetAdjustedIFile::read(byte_t* out, size_t len)
|
||||
{
|
||||
seek(mCurrentOffset);
|
||||
// assert proper position in file
|
||||
mFile->seek(mCurrentOffset + mBaseOffset);
|
||||
mFile->read(out, len);
|
||||
mCurrentOffset += len;
|
||||
}
|
||||
|
||||
void OffsetAdjustedIFile::read(byte_t* out, size_t offset, size_t len)
|
||||
|
@ -53,8 +54,10 @@ void OffsetAdjustedIFile::read(byte_t* out, size_t offset, size_t len)
|
|||
|
||||
void OffsetAdjustedIFile::write(const byte_t* out, size_t len)
|
||||
{
|
||||
seek(mCurrentOffset);
|
||||
// assert proper position in file
|
||||
mFile->seek(mCurrentOffset + mBaseOffset);
|
||||
mFile->write(out, len);
|
||||
mCurrentOffset += len;
|
||||
}
|
||||
|
||||
void OffsetAdjustedIFile::write(const byte_t* out, size_t offset, size_t len)
|
||||
|
|
Loading…
Reference in a new issue