Merge pull request #4934 from turol/terragen_fix

Fix Terragen loader
kimkulling/close_memleak-issue-3416^2
Kim Kulling 2023-02-03 11:42:15 +01:00 committed by GitHub
commit 8c6b3fe69a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

@ -230,8 +230,8 @@ void TerragenImporter::InternReadFile(const std::string &pFile,
} }
// Get to the next chunk (4 byte aligned) // Get to the next chunk (4 byte aligned)
unsigned dtt = reader.GetCurrentPos(); unsigned dtt = reader.GetCurrentPos() & 0x3;
if (dtt & 0x3) { if (dtt) {
reader.IncPtr(4 - dtt); reader.IncPtr(4 - dtt);
} }
} }

View File

@ -48,13 +48,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
class utTerragenImportExport : public AbstractImportExportBase { class utTerragenImportExport : public AbstractImportExportBase {
public: public:
virtual bool importerTest() { virtual bool importerTest() {
/*Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/TER/RealisticTerrain.ter", aiProcess_ValidateDataStructure); const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/TER/RealisticTerrain.ter", aiProcess_ValidateDataStructure);
return nullptr != scene;*/ return nullptr != scene;
return true;
} }
}; };
TEST_F(utTerragenImportExport, importX3DFromFileTest) { TEST_F(utTerragenImportExport, importFromFileTest) {
EXPECT_TRUE(importerTest()); EXPECT_TRUE(importerTest());
} }