COMMON: Fix WriteStream::pos() once again

MemoryReadWriteStream now returns int32, not uint32. It actually doesn't
ever return -1 to indicate that an error occured, so uint32 was a better
choice, but that's what is used in WriteStream base class now.

That method is abstract, so that's also why OutSaveFile had to override
it.
This commit is contained in:
Alexander Tkachev 2016-08-24 16:24:16 +06:00
parent ea360ef8f2
commit 368f664c81
3 changed files with 6 additions and 1 deletions

View File

@ -50,6 +50,10 @@ uint32 OutSaveFile::write(const void *dataPtr, uint32 dataSize) {
return _wrapped->write(dataPtr, dataSize);
}
int32 OutSaveFile::pos() const {
return _wrapped->pos();
}
bool SaveFileManager::copySavefile(const String &oldFilename, const String &newFilename) {
InSaveFile *inFile = 0;
OutSaveFile *outFile = 0;

View File

@ -286,7 +286,7 @@ public:
return dataSize;
}
uint32 pos() const { return _pos - _length; } //'read' position in the stream
int32 pos() const { return _pos - _length; } //'read' position in the stream
uint32 size() const { return _size; } //that's also 'write' position in the stream, as it's append-only
byte *getData() { return _data; }

View File

@ -58,6 +58,7 @@ public:
virtual void finalize();
virtual bool flush();
virtual uint32 write(const void *dataPtr, uint32 dataSize);
virtual int32 pos() const;
};
/**