Browse Source

- Some minor future compatibility changes to FileStream/Stream. Really needs a good rework.

MelvMay-GG 12 years ago
parent
commit
8f4dc93
3 changed files with 11 additions and 7 deletions
  1. 6 6
      engine/source/io/fileStream.cc
  2. 2 1
      engine/source/io/fileStream.h
  3. 3 0
      engine/source/io/stream.h

+ 6 - 6
engine/source/io/fileStream.cc

@@ -85,7 +85,7 @@ bool FileStream::setPosition(const U32 i_newPosition)
    {
       // flush the buffer if its dirty
       if (true == mDirty)
-         flush();
+         Flush();
       // and clear out the state of the file stream
       clearBuffer();
 
@@ -165,7 +165,7 @@ void FileStream::close()
 
    // make sure nothing in the buffer differs from what is on disk
    if (true == mDirty)
-      flush();
+      Flush();
     
    // and close the file
    File::Status closeResult;
@@ -178,7 +178,7 @@ void FileStream::close()
 }
 
 //-----------------------------------------------------------------------------
-bool FileStream::flush()
+bool FileStream::Flush()
 {
    AssertWarn(0 != mStreamCaps, "FileStream::flush: the stream isn't open");
    AssertFatal(false == mDirty || BUFFER_INVALID != mBuffHead, "FileStream::flush: buffer must be valid if its dirty");
@@ -255,7 +255,7 @@ bool FileStream::_read(const U32 i_numBytes, void *o_pBuffer)
 
          if (mBuffPos > mBuffTail && remaining != 0)
          {
-            flush();
+            Flush();
             mBuffHead = BUFFER_INVALID;
             if (mEOF == true)
                Stream::setStatus(EOS);
@@ -267,7 +267,7 @@ bool FileStream::_read(const U32 i_numBytes, void *o_pBuffer)
       {
          // flush the buffer if its dirty, since we now need to go to disk
          if (true == mDirty)
-            flush();
+            Flush();
 
          // make sure we know the current read location in the underlying file
          mBuffPos = mFile.getPosition();
@@ -366,7 +366,7 @@ bool FileStream::_write(const U32 i_numBytes, const void *i_pBuffer)
       {
          // flush the buffer if its dirty, since we now need to go to disk
          if (true == mDirty)
-            flush();
+            Flush();
 
          // make sure we know the current write location in the underlying file
          mBuffPos = mFile.getPosition();

+ 2 - 1
engine/source/io/fileStream.h

@@ -75,7 +75,8 @@ public:
    virtual bool open(const char *i_pFilename, AccessMode i_openMode);
    virtual void close();
 
-   bool flush();
+   bool Flush();
+
 
 protected:
    // more mandatory methods from Stream base class...

+ 3 - 0
engine/source/io/stream.h

@@ -137,6 +137,8 @@ class Stream {
    /// writeString is safer.
    void writeLongString(U32 maxStringLen, const char *string);
 
+   inline bool Put( char character ) { return write( character ); }
+
    /// Writes a string to the stream.
    virtual void writeString(const char *stringBuf, S32 maxLen=255);
 
@@ -167,6 +169,7 @@ class Stream {
    }
    DECLARE_OVERLOADED_WRITE(S8)
    DECLARE_OVERLOADED_WRITE(U8)
+   DECLARE_OVERLOADED_WRITE(char)
 
    DECLARE_ENDIAN_OVERLOADED_WRITE(S16)
    DECLARE_ENDIAN_OVERLOADED_WRITE(S32)