diff --git a/panda/src/express/subStreamBuf.cxx b/panda/src/express/subStreamBuf.cxx index 289ad69bf2..5d71676ebb 100644 --- a/panda/src/express/subStreamBuf.cxx +++ b/panda/src/express/subStreamBuf.cxx @@ -155,6 +155,25 @@ seekoff(streamoff off, ios::seek_dir dir, int mode) { return new_pos - _start; } +//////////////////////////////////////////////////////////////////// +// Function: SubStreamBuf::seekpos +// Access: Public, Virtual +// Description: A variant on seekoff() to implement seeking within a +// stream. +// +// The MSDN Library claims that it is necessary to +// redefine this only seekoff(), and not seekpos() as +// well, as the default implementation of seekpos() is +// supposed to map to seekoff() exactly as I am doing +// here; but in fact it must do something else, because +// seeking didn't work on Windows until I redefined this +// function as well. +//////////////////////////////////////////////////////////////////// +streampos SubStreamBuf:: +seekpos(streampos pos, int mode) { + return seekoff(pos, ios::beg, mode); +} + //////////////////////////////////////////////////////////////////// // Function: SubStreamBuf::overflow // Access: Protected, Virtual diff --git a/panda/src/express/subStreamBuf.h b/panda/src/express/subStreamBuf.h index 437b89d4a2..634f4a26e5 100644 --- a/panda/src/express/subStreamBuf.h +++ b/panda/src/express/subStreamBuf.h @@ -34,6 +34,7 @@ public: void close(); virtual streampos seekoff(streamoff off, ios::seek_dir dir, int mode); + virtual streampos seekpos(streampos pos, int mode); protected: virtual int overflow(int c);