Logo Search packages:      
Sourcecode: scummvm version File versions

StdioStream * StdioStream::makeFromPath ( const Common::String path,
bool  writeMode 
) [static]

Given a path, invokes fopen on that path and wrap the result in a StdioStream instance.

Definition at line 80 of file stdiostream.cpp.

Referenced by RoninCDFileNode::createReadStream(), and Common::MacResManager::open().

                                                                               {
      FILE *handle = fopen(path.c_str(), writeMode ? "wb" : "rb");

#ifdef __amigaos4__
      //
      // Work around for possibility that someone uses AmigaOS "newlib" build
      // with SmartFileSystem (blocksize 512 bytes), leading to buffer size
      // being only 512 bytes. "Clib2" sets the buffer size to 8KB, resulting
      // smooth movie playback. This forces the buffer to be enough also when
      // using "newlib" compile on SFS.
      //
      if (handle && !writeMode) {
            setvbuf(handle, NULL, _IOFBF, 8192);
      }
#endif

#if defined(__WII__)
      // disable newlib's buffering, the device libraries handle caching
      if (handle)
            setvbuf(handle, NULL, _IONBF, 0);
#endif

      if (handle)
            return new StdioStream(handle);
      return 0;
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index