Commit 08204052 authored by hybrid's avatar hybrid

Fix FVF data loading of binary .x files

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2053 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 2563bf14
...@@ -1001,6 +1001,12 @@ bool CXMeshFileLoader::parseDataObjectMesh(SXMesh &mesh) ...@@ -1001,6 +1001,12 @@ bool CXMeshFileLoader::parseDataObjectMesh(SXMesh &mesh)
else else
if (objectName == "FVFData") if (objectName == "FVFData")
{ {
if (!readHeadOfDataObject())
{
os::Printer::log("No starting brace in FVFData found.", ELL_WARNING);
os::Printer::log("Line", core::stringc(Line).c_str(), ELL_ERROR);
return false;
}
const u32 dataformat = readInt(); const u32 dataformat = readInt();
const u32 datasize = readInt(); const u32 datasize = readInt();
u32* data = new u32[datasize]; u32* data = new u32[datasize];
...@@ -1017,22 +1023,19 @@ bool CXMeshFileLoader::parseDataObjectMesh(SXMesh &mesh) ...@@ -1017,22 +1023,19 @@ bool CXMeshFileLoader::parseDataObjectMesh(SXMesh &mesh)
dataptr += size; dataptr += size;
} }
} }
delete [] data;
if (!checkForOneFollowingSemicolons()) if (!checkForOneFollowingSemicolons())
{ {
os::Printer::log("No finishing semicolon in FVFData found.", ELL_WARNING); os::Printer::log("No finishing semicolon in FVFData found.", ELL_WARNING);
os::Printer::log("Line", core::stringc(Line).c_str(), ELL_ERROR); os::Printer::log("Line", core::stringc(Line).c_str(), ELL_ERROR);
delete [] data;
return false; return false;
} }
if (!checkForClosingBrace()) if (!checkForClosingBrace())
{ {
os::Printer::log("No closing brace in FVFData found in x file", ELL_WARNING); os::Printer::log("No closing brace in FVFData found in x file", ELL_WARNING);
os::Printer::log("Line", core::stringc(Line).c_str(), ELL_ERROR); os::Printer::log("Line", core::stringc(Line).c_str(), ELL_ERROR);
delete [] data;
return false; return false;
} }
delete [] data;
} }
else else
if (objectName == "XSkinMeshHeader") if (objectName == "XSkinMeshHeader")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment