diff options
-rw-r--r-- | backends/fs/stdiostream.cpp | 15 | ||||
-rw-r--r-- | common/file.cpp | 8 |
2 files changed, 20 insertions, 3 deletions
diff --git a/backends/fs/stdiostream.cpp b/backends/fs/stdiostream.cpp index dfb01362e1..70739cab08 100644 --- a/backends/fs/stdiostream.cpp +++ b/backends/fs/stdiostream.cpp @@ -194,6 +194,21 @@ void StdioStream::flush() { StdioStream *StdioStream::makeFromPath(const Common::String &path, bool writeMode) { 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 (handle) return new StdioStream(handle); return 0; diff --git a/common/file.cpp b/common/file.cpp index 5c0668e06f..090606d523 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -200,9 +200,11 @@ static FILE *fopenNoCase(const String &filename, const String &directory, const #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. + // 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 (file) { setvbuf(file, NULL, _IOFBF, 8192); |