diff options
Diffstat (limited to 'backends/saves')
-rw-r--r-- | backends/saves/compressed/compressed-saves.cpp | 21 | ||||
-rw-r--r-- | backends/saves/compressed/compressed-saves.h | 1 | ||||
-rw-r--r-- | backends/saves/default/default-saves.cpp | 19 | ||||
-rw-r--r-- | backends/saves/default/default-saves.h | 1 | ||||
-rw-r--r-- | backends/saves/savefile.cpp | 1 |
5 files changed, 19 insertions, 24 deletions
diff --git a/backends/saves/compressed/compressed-saves.cpp b/backends/saves/compressed/compressed-saves.cpp index dae2c707ef..150cf5c47d 100644 --- a/backends/saves/compressed/compressed-saves.cpp +++ b/backends/saves/compressed/compressed-saves.cpp @@ -23,7 +23,6 @@ * */ -#include "common/stdafx.h" #include "common/savefile.h" #include "common/util.h" #include "backends/saves/compressed/compressed-saves.h" @@ -45,7 +44,7 @@ protected: enum { BUFSIZE = 16384 // 1 << MAX_WBITS }; - + byte _buf[BUFSIZE]; Common::InSaveFile *_wrapped; @@ -62,13 +61,13 @@ public: _stream.zalloc = Z_NULL; _stream.zfree = Z_NULL; _stream.opaque = Z_NULL; - + // Verify file header is correct once more w->seek(0, SEEK_SET); uint16 header = w->readUint16BE(); assert(header == 0x1F8B || ((header & 0x0F00) == 0x0800 && header % 31 == 0)); - + if (header == 0x1F8B) { // Retrieve the original file size w->seek(-4, SEEK_END); @@ -79,7 +78,7 @@ public: } _pos = 0; w->seek(0, SEEK_SET); - + // Adding 32 to windowBits indicates to zlib that it is supposed to // automatically detect whether gzip or zlib headers are used for // the compressed file. This feature was added in zlib 1.2.0.4, @@ -88,7 +87,7 @@ public: _zlibErr = inflateInit2(&_stream, MAX_WBITS + 32); if (_zlibErr != Z_OK) return; - + // Setup input buffer _stream.next_in = _buf; _stream.avail_in = 0; @@ -115,7 +114,7 @@ public: } _zlibErr = inflate(&_stream, Z_NO_FLUSH); } - + // Update the position counter _pos += dataSize - _stream.avail_out; @@ -155,7 +154,7 @@ public: // in the constructor, and wrap it into a MemoryReadStream -- but that // would be rather wasteful. As long as we don't need it, I'd rather not // implement this at all. -- Fingolfin - + // Skip the given amount of data (very inefficient if one tries to skip // huge amounts of data, but usually client code will only skip a few // bytes, so this should be fine. @@ -176,7 +175,7 @@ protected: enum { BUFSIZE = 16384 // 1 << MAX_WBITS }; - + byte _buf[BUFSIZE]; Common::OutSaveFile *_wrapped; z_stream _stream; @@ -203,7 +202,7 @@ public: _stream.zalloc = Z_NULL; _stream.zfree = Z_NULL; _stream.opaque = Z_NULL; - + // Adding 16 to windowBits indicates to zlib that it is supposed to // write gzip headers. This feature was added in zlib 1.2.0.4, // released 10 August 2003. @@ -267,7 +266,7 @@ public: // of the const keyword. _stream.next_in = const_cast<byte *>((const byte *)dataPtr); _stream.avail_in = dataSize; - + // ... and flush it to disk processData(Z_NO_FLUSH); diff --git a/backends/saves/compressed/compressed-saves.h b/backends/saves/compressed/compressed-saves.h index 031007ef8b..205c5db05b 100644 --- a/backends/saves/compressed/compressed-saves.h +++ b/backends/saves/compressed/compressed-saves.h @@ -26,7 +26,6 @@ #ifndef BACKEND_SAVES_COMPRESSED_H #define BACKEND_SAVES_COMPRESSED_H -#include "common/stdafx.h" #include "common/savefile.h" /** diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp index f4742f15a0..702b404434 100644 --- a/backends/saves/default/default-saves.cpp +++ b/backends/saves/default/default-saves.cpp @@ -25,7 +25,6 @@ #if !defined(DISABLE_DEFAULT_SAVEFILEMANAGER) -#include "common/stdafx.h" #include "common/savefile.h" #include "common/util.h" #include "common/fs.h" @@ -119,13 +118,13 @@ Common::StringList DefaultSaveFileManager::listSavefiles(const char *regex) { FSList savefiles; Common::StringList results; Common::String search(regex); - + if (savePath.lookupFile(savefiles, savePath, search, false, true)) { for (FSList::const_iterator file = savefiles.begin(); file != savefiles.end(); file++) { results.push_back(file->getPath()); } } - + return results; } @@ -148,11 +147,11 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const char *filename) // Ensure that the savepath exists and is writeable. If not, generate // an appropriate error const char *savePath = getSavePath(); - + #if defined(UNIX) || defined(__SYMBIAN32__) struct stat sb; clearError(); - + // Check whether the dir exists if (stat(savePath, &sb) == -1) { // The dir does not exist, or stat failed for some other reason. @@ -174,7 +173,7 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const char *filename) // or is not writeable, the path could be completly bogus, etc. warning("mkdir for '%s' failed!", savePath); perror("mkdir"); - + switch (errno) { case EACCES: setError(SFM_DIR_ACCESS, Common::String("Search or write permission denied")); @@ -198,19 +197,19 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const char *filename) setError(SFM_DIR_ROFS, Common::String("The parent directory resides on a read-only file system")); break; } - + return 0; } break; case ENOTDIR: setError(SFM_DIR_NOTDIR, Common::String("A component of the path prefix is not a directory")); break; - } + } } else { // So stat() succeeded. But is the path actually pointing to a directory? if (!S_ISDIR(sb.st_mode)) { setError(SFM_DIR_NOTDIR, Common::String("The given savepath is not a directory")); - + return 0; } } @@ -225,7 +224,7 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const char *filename) delete sf; sf = 0; } - + return wrapOutSaveFile(sf); } diff --git a/backends/saves/default/default-saves.h b/backends/saves/default/default-saves.h index 9346e79700..8c4fe54bb7 100644 --- a/backends/saves/default/default-saves.h +++ b/backends/saves/default/default-saves.h @@ -26,7 +26,6 @@ #if !defined(BACKEND_SAVES_DEFAULT_H) && !defined(DISABLE_DEFAULT_SAVEFILEMANAGER) #define BACKEND_SAVES_DEFAULT_H -#include "common/stdafx.h" #include "common/savefile.h" #include "common/str.h" diff --git a/backends/saves/savefile.cpp b/backends/saves/savefile.cpp index 4b50e9c57d..499edb0b28 100644 --- a/backends/saves/savefile.cpp +++ b/backends/saves/savefile.cpp @@ -23,7 +23,6 @@ * */ -#include "common/stdafx.h" #include "common/util.h" #include "common/config-manager.h" #include "common/savefile.h" |