forked from mirror/openmw-tes3mp
NifFile: close the stream after reading (Fixes #3070)
This commit is contained in:
parent
6f98982bc2
commit
de84452e5a
2 changed files with 4 additions and 8 deletions
|
@ -12,9 +12,8 @@ NIFFile::NIFFile(Files::IStreamPtr stream, const std::string &name)
|
||||||
: ver(0)
|
: ver(0)
|
||||||
, filename(name)
|
, filename(name)
|
||||||
, mUseSkinning(false)
|
, mUseSkinning(false)
|
||||||
, mStream(stream)
|
|
||||||
{
|
{
|
||||||
parse();
|
parse(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
NIFFile::~NIFFile()
|
NIFFile::~NIFFile()
|
||||||
|
@ -115,7 +114,6 @@ static std::map<std::string,RecordFactoryEntry> makeFactory()
|
||||||
///Make the factory map used for parsing the file
|
///Make the factory map used for parsing the file
|
||||||
static const std::map<std::string,RecordFactoryEntry> factories = makeFactory();
|
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)
|
std::string NIFFile::printVersion(unsigned int version)
|
||||||
{
|
{
|
||||||
union ver_quad
|
union ver_quad
|
||||||
|
@ -134,9 +132,9 @@ std::string NIFFile::printVersion(unsigned int version)
|
||||||
return stream.str();
|
return stream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NIFFile::parse()
|
void NIFFile::parse(Files::IStreamPtr stream)
|
||||||
{
|
{
|
||||||
NIFStream nif (this, mStream);
|
NIFStream nif (this, stream);
|
||||||
|
|
||||||
// Check the header string
|
// Check the header string
|
||||||
std::string head = nif.getVersionString();
|
std::string head = nif.getVersionString();
|
||||||
|
|
|
@ -35,7 +35,7 @@ class NIFFile
|
||||||
bool mUseSkinning;
|
bool mUseSkinning;
|
||||||
|
|
||||||
/// Parse the file
|
/// Parse the file
|
||||||
void parse();
|
void parse(Files::IStreamPtr stream);
|
||||||
|
|
||||||
/// Get the file's version in a human readable form
|
/// Get the file's version in a human readable form
|
||||||
///\returns A string containing a human readable NIF version number
|
///\returns A string containing a human readable NIF version number
|
||||||
|
@ -46,8 +46,6 @@ class NIFFile
|
||||||
///\overload
|
///\overload
|
||||||
void operator = (NIFFile const &);
|
void operator = (NIFFile const &);
|
||||||
|
|
||||||
Files::IStreamPtr mStream;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Used if file parsing fails
|
/// Used if file parsing fails
|
||||||
void fail(const std::string &msg)
|
void fail(const std::string &msg)
|
||||||
|
|
Loading…
Reference in a new issue