dev: Fix a bug in the use of seekp/seekg
This patch fixes two instances of incorrect use of the seekp/seekg stream member functions. These two functions return a stream reference (*this), and should not be compared to an integer value.
This commit is contained in:
parent
c704b7be16
commit
234c9a36a2
1 changed files with 4 additions and 2 deletions
|
@ -108,7 +108,8 @@ RawDiskImage::read(uint8_t *data, std::streampos offset) const
|
|||
if (!stream.is_open())
|
||||
panic("file not open!\n");
|
||||
|
||||
if (stream.seekg(offset * SectorSize, ios::beg) < 0)
|
||||
stream.seekg(offset * SectorSize, ios::beg);
|
||||
if (!stream.good())
|
||||
panic("Could not seek to location in file");
|
||||
|
||||
streampos pos = stream.tellg();
|
||||
|
@ -132,7 +133,8 @@ RawDiskImage::write(const uint8_t *data, std::streampos offset)
|
|||
if (!stream.is_open())
|
||||
panic("file not open!\n");
|
||||
|
||||
if (stream.seekp(offset * SectorSize, ios::beg) < 0)
|
||||
stream.seekp(offset * SectorSize, ios::beg);
|
||||
if (!stream.good())
|
||||
panic("Could not seek to location in file");
|
||||
|
||||
DPRINTF(DiskImageWrite, "write: offset=%d\n", (uint64_t)offset);
|
||||
|
|
Loading…
Reference in a new issue