diff --git a/apps/openmw/mwsound/ffmpeg_decoder.hpp b/apps/openmw/mwsound/ffmpeg_decoder.hpp index 0af9a77d98..c51639a972 100644 --- a/apps/openmw/mwsound/ffmpeg_decoder.hpp +++ b/apps/openmw/mwsound/ffmpeg_decoder.hpp @@ -24,7 +24,7 @@ extern "C" #pragma warning (pop) #endif -#include +#include #include diff --git a/components/bsa/bsa_file.cpp b/components/bsa/bsa_file.cpp index 02c70d29cb..9fc6448c2b 100644 --- a/components/bsa/bsa_file.cpp +++ b/components/bsa/bsa_file.cpp @@ -23,6 +23,8 @@ #include "bsa_file.hpp" +#include + #include #include #include @@ -256,6 +258,11 @@ void Bsa::BSAFile::close() mIsLoaded = false; } +Files::IStreamPtr Bsa::BSAFile::getFile(const FileStruct *file) +{ + return Files::openConstrainedFileStream(mFilename, file->offset, file->fileSize); +} + void Bsa::BSAFile::addFile(const std::string& filename, std::istream& file) { if (!mIsLoaded) diff --git a/components/bsa/bsa_file.hpp b/components/bsa/bsa_file.hpp index 66c8234bbd..f6af2e3269 100644 --- a/components/bsa/bsa_file.hpp +++ b/components/bsa/bsa_file.hpp @@ -28,8 +28,7 @@ #include #include -#include - +#include namespace Bsa { @@ -123,10 +122,7 @@ public: /** Open a file contained in the archive. * @note Thread safe. */ - Files::IStreamPtr getFile(const FileStruct *file) - { - return Files::openConstrainedFileStream(mFilename, file->offset, file->fileSize); - } + Files::IStreamPtr getFile(const FileStruct *file); void addFile(const std::string& filename, std::istream& file); diff --git a/components/bsa/compressedbsafile.cpp b/components/bsa/compressedbsafile.cpp index ee3a5a0a80..67e172e3db 100644 --- a/components/bsa/compressedbsafile.cpp +++ b/components/bsa/compressedbsafile.cpp @@ -47,6 +47,7 @@ #include #include #include +#include namespace Bsa { diff --git a/components/esm/reader.hpp b/components/esm/reader.hpp index fc3845d87e..a1ddf35641 100644 --- a/components/esm/reader.hpp +++ b/components/esm/reader.hpp @@ -3,7 +3,6 @@ #include -#include #include #include "common.hpp" // MasterData diff --git a/components/esm4/reader.cpp b/components/esm4/reader.cpp index 72421711af..3c0ac470c4 100644 --- a/components/esm4/reader.cpp +++ b/components/esm4/reader.cpp @@ -49,6 +49,7 @@ #include #include +#include #include "formid.hpp" @@ -182,6 +183,16 @@ void Reader::open(Files::IStreamPtr&& stream, const std::string &filename) throw std::runtime_error("Unknown file format"); // can't yet use fail() as mCtx is not setup } +void Reader::openRaw(const std::string& filename) +{ + openRaw(Files::openConstrainedFileStream(filename), filename); +} + +void Reader::open(const std::string& filename) +{ + open(Files::openConstrainedFileStream(filename), filename); +} + void Reader::setRecHeaderSize(const std::size_t size) { mCtx.recHeaderSize = size; diff --git a/components/esm4/reader.hpp b/components/esm4/reader.hpp index aaebeb335a..d4979d034a 100644 --- a/components/esm4/reader.hpp +++ b/components/esm4/reader.hpp @@ -26,11 +26,14 @@ #include #include #include +#include #include "common.hpp" #include "loadtes4.hpp" #include "../esm/reader.hpp" +#include + namespace ESM4 { // bytes read from group, updated by // getRecordHeader() in advance @@ -129,15 +132,9 @@ namespace ESM4 { ~Reader(); // FIXME: should be private but ESMTool uses it - void openRaw(const std::string& filename) - { - openRaw(Files::openConstrainedFileStream(filename), filename); - } + void openRaw(const std::string& filename); - void open(const std::string& filename) - { - open(Files::openConstrainedFileStream(filename), filename); - } + void open(const std::string& filename); void close() final; diff --git a/components/files/constrainedfilestream.hpp b/components/files/constrainedfilestream.hpp index c32c719f22..f00bd3a488 100644 --- a/components/files/constrainedfilestream.hpp +++ b/components/files/constrainedfilestream.hpp @@ -3,9 +3,8 @@ #include "constrainedfilestreambuf.hpp" #include "streamwithbuffer.hpp" +#include "istreamptr.hpp" -#include -#include #include #include @@ -15,8 +14,6 @@ namespace Files /// A file stream constrained to a specific region in the file, specified by the 'start' and 'length' parameters. using ConstrainedFileStream = StreamWithBuffer; -typedef std::unique_ptr IStreamPtr; - IStreamPtr openConstrainedFileStream(const std::string& filename, std::size_t start = 0, std::size_t length = std::numeric_limits::max()); diff --git a/components/files/istreamptr.hpp b/components/files/istreamptr.hpp new file mode 100644 index 0000000000..6dee8b7a60 --- /dev/null +++ b/components/files/istreamptr.hpp @@ -0,0 +1,12 @@ +#ifndef OPENMW_COMPONENTS_FILES_ISTREAMPTR_H +#define OPENMW_COMPONENTS_FILES_ISTREAMPTR_H + +#include +#include + +namespace Files +{ + using IStreamPtr = std::unique_ptr; +} + +#endif diff --git a/components/nif/niffile.hpp b/components/nif/niffile.hpp index aa53f516fd..358428e94c 100644 --- a/components/nif/niffile.hpp +++ b/components/nif/niffile.hpp @@ -6,9 +6,10 @@ #include #include #include +#include #include -#include +#include #include "record.hpp" diff --git a/components/nif/nifstream.hpp b/components/nif/nifstream.hpp index 04583131b9..acf1dd4704 100644 --- a/components/nif/nifstream.hpp +++ b/components/nif/nifstream.hpp @@ -9,8 +9,9 @@ #include #include #include +#include -#include +#include #include #include diff --git a/components/vfs/archive.hpp b/components/vfs/archive.hpp index faefe30dfe..22df09e06c 100644 --- a/components/vfs/archive.hpp +++ b/components/vfs/archive.hpp @@ -3,7 +3,7 @@ #include -#include +#include namespace VFS { diff --git a/components/vfs/bsaarchive.cpp b/components/vfs/bsaarchive.cpp index d4d1a5a38b..c0db4c071c 100644 --- a/components/vfs/bsaarchive.cpp +++ b/components/vfs/bsaarchive.cpp @@ -2,6 +2,7 @@ #include #include +#include namespace VFS { diff --git a/components/vfs/filesystemarchive.cpp b/components/vfs/filesystemarchive.cpp index 8b74fb788a..7b57c93944 100644 --- a/components/vfs/filesystemarchive.cpp +++ b/components/vfs/filesystemarchive.cpp @@ -5,6 +5,7 @@ #include #include +#include namespace VFS { diff --git a/components/vfs/filesystemarchive.hpp b/components/vfs/filesystemarchive.hpp index fa9b50edc5..2c50e5300b 100644 --- a/components/vfs/filesystemarchive.hpp +++ b/components/vfs/filesystemarchive.hpp @@ -3,6 +3,8 @@ #include "archive.hpp" +#include + namespace VFS { diff --git a/components/vfs/manager.cpp b/components/vfs/manager.cpp index bd7418d4b5..4a3ff94cc1 100644 --- a/components/vfs/manager.cpp +++ b/components/vfs/manager.cpp @@ -1,6 +1,7 @@ #include "manager.hpp" #include +#include #include diff --git a/components/vfs/manager.hpp b/components/vfs/manager.hpp index bb1ee6ad39..93023f565f 100644 --- a/components/vfs/manager.hpp +++ b/components/vfs/manager.hpp @@ -1,11 +1,12 @@ #ifndef OPENMW_COMPONENTS_RESOURCEMANAGER_H #define OPENMW_COMPONENTS_RESOURCEMANAGER_H -#include +#include #include #include #include +#include namespace VFS {