[Scummvm-cvs-logs] CVS: scummvm/common stream.h,1.5,1.6
Eugene Sandulenko
sev at users.sourceforge.net
Thu Jun 24 07:07:05 CEST 2004
Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21715
Modified Files:
stream.h
Log Message:
Extended ReadMemoryStream class with seek method
Index: stream.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/stream.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- stream.h 4 May 2004 03:27:00 -0000 1.5
+++ stream.h 24 Jun 2004 14:06:22 -0000 1.6
@@ -143,6 +143,35 @@
_size = _sizeOrig;
_pos = 0;
}
+
+ void seek(uint32 offs, int whence = SEEK_SET) {
+ switch (whence) {
+ case SEEK_SET:
+ rewind();
+ if (offs > _size)
+ offs = _size;
+ _size -= offs;
+ _ptr += offs;
+ _pos += offs;
+ break;
+
+ case SEEK_CUR:
+ _size -= offs;
+ _ptr += offs;
+ _pos += offs;
+ break;
+
+ case SEEK_END:
+ rewind();
+ if (offs > _size)
+ offs = 0;
+ offs = _size - offs;
+ _size -= offs;
+ _ptr += offs;
+ _pos += offs;
+ break;
+ }
+ }
};
} // End of namespace Common
More information about the Scummvm-git-logs
mailing list