From de84452e5a2f1a51d5e08f9af65edcec80a9c995 Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 9 Dec 2015 04:50:59 +0100 Subject: [PATCH] NifFile: close the stream after reading (Fixes #3070) --- components/nif/niffile.cpp | 8 +++----- components/nif/niffile.hpp | 4 +--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/components/nif/niffile.cpp b/components/nif/niffile.cpp index ccfcdfc73..f6e489527 100644 --- a/components/nif/niffile.cpp +++ b/components/nif/niffile.cpp @@ -12,9 +12,8 @@ NIFFile::NIFFile(Files::IStreamPtr stream, const std::string &name) : ver(0) , filename(name) , mUseSkinning(false) - , mStream(stream) { - parse(); + parse(stream); } NIFFile::~NIFFile() @@ -115,7 +114,6 @@ static std::map makeFactory() ///Make the factory map used for parsing the file static const std::map factories = makeFactory(); -/// Get the file's version in a human readable form std::string NIFFile::printVersion(unsigned int version) { union ver_quad @@ -134,9 +132,9 @@ std::string NIFFile::printVersion(unsigned int version) return stream.str(); } -void NIFFile::parse() +void NIFFile::parse(Files::IStreamPtr stream) { - NIFStream nif (this, mStream); + NIFStream nif (this, stream); // Check the header string std::string head = nif.getVersionString(); diff --git a/components/nif/niffile.hpp b/components/nif/niffile.hpp index 6fbef31ca..900c360bb 100644 --- a/components/nif/niffile.hpp +++ b/components/nif/niffile.hpp @@ -35,7 +35,7 @@ class NIFFile bool mUseSkinning; /// Parse the file - void parse(); + void parse(Files::IStreamPtr stream); /// Get the file's version in a human readable form ///\returns A string containing a human readable NIF version number @@ -46,8 +46,6 @@ class NIFFile ///\overload void operator = (NIFFile const &); - Files::IStreamPtr mStream; - public: /// Used if file parsing fails void fail(const std::string &msg)