[Scummvm-cvs-logs] SF.net SVN: scummvm:[49750] scummvm/trunk/common
sev at users.sourceforge.net
sev at users.sourceforge.net
Tue Jun 15 12:34:15 CEST 2010
Revision: 49750
http://scummvm.svn.sourceforge.net/scummvm/?rev=49750&view=rev
Author: sev
Date: 2010-06-15 10:34:14 +0000 (Tue, 15 Jun 2010)
Log Message:
-----------
Added seek() method to MemoryWriteStreamDynamic.
If it deserves a separate class, shout.
Modified Paths:
--------------
scummvm/trunk/common/stream.cpp
scummvm/trunk/common/stream.h
Modified: scummvm/trunk/common/stream.cpp
===================================================================
--- scummvm/trunk/common/stream.cpp 2010-06-15 10:33:57 UTC (rev 49749)
+++ scummvm/trunk/common/stream.cpp 2010-06-15 10:34:14 UTC (rev 49750)
@@ -303,4 +303,29 @@
return true; // FIXME: STREAM REWRITE
}
+bool MemoryWriteStreamDynamic::seek(int32 offs, int whence) {
+ // Pre-Condition
+ assert(_pos <= _size);
+ switch (whence) {
+ case SEEK_END:
+ // SEEK_END works just like SEEK_SET, only 'reversed',
+ // i.e. from the end.
+ offs = _size + offs;
+ // Fall through
+ case SEEK_SET:
+ _ptr = _data + offs;
+ _pos = offs;
+ break;
+
+ case SEEK_CUR:
+ _ptr += offs;
+ _pos += offs;
+ break;
+ }
+ // Post-Condition
+ assert(_pos <= _size);
+
+ return true; // FIXME: STREAM REWRITE
+}
+
} // End of namespace Common
Modified: scummvm/trunk/common/stream.h
===================================================================
--- scummvm/trunk/common/stream.h 2010-06-15 10:33:57 UTC (rev 49749)
+++ scummvm/trunk/common/stream.h 2010-06-15 10:34:14 UTC (rev 49750)
@@ -687,6 +687,8 @@
uint32 size() const { return _size; }
byte *getData() { return _data; }
+
+ bool seek(int32 offset, int whence = SEEK_SET);
};
} // End of namespace Common
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list