NifFile: close the stream after reading (Fixes #3070)

openmw-38
scrawl 9 years ago
parent 6f98982bc2
commit de84452e5a

@ -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<std::string,RecordFactoryEntry> makeFactory()
///Make the factory map used for parsing the file
static const std::map<std::string,RecordFactoryEntry> 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();

@ -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)

Loading…
Cancel
Save