Forráskód Böngészése

more win32 goodness

David Rose 23 éve
szülő
commit
1ce6f9db76
2 módosított fájl, 20 hozzáadás és 0 törlés
  1. 19 0
      panda/src/express/subStreamBuf.cxx
  2. 1 0
      panda/src/express/subStreamBuf.h

+ 19 - 0
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

+ 1 - 0
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);