Merge branch 'master' into pugi_xml

This commit is contained in:
Kim Kulling
2020-09-25 21:00:09 +02:00
161 changed files with 12572 additions and 1672 deletions

View File

@@ -109,9 +109,12 @@ const aiImporterDesc *ObjFileImporter::GetInfo() const {
void ObjFileImporter::InternReadFile(const std::string &file, aiScene *pScene, IOSystem *pIOHandler) {
// Read file into memory
static const std::string mode = "rb";
std::unique_ptr<IOStream> fileStream(pIOHandler->Open(file, mode));
auto streamCloser = [&](IOStream *pStream) {
pIOHandler->Close(pStream);
};
std::unique_ptr<IOStream, decltype(streamCloser)> fileStream(pIOHandler->Open(file, mode), streamCloser);
if (!fileStream.get()) {
throw DeadlyImportError("Failed to open file " + file + ".");
throw DeadlyImportError("Failed to open file ", file, ".");
}
// Get the file-size and validate it, throwing an exception when fails