Added 0 to end of array.
This commit is contained in:
parent
a7360d6a40
commit
e8a9064eac
@ -294,12 +294,19 @@ bool daeReader::convert( std::istream& fin )
|
|||||||
|
|
||||||
// get the size of the file and rewind
|
// get the size of the file and rewind
|
||||||
fin.seekg(0, std::ios::end);
|
fin.seekg(0, std::ios::end);
|
||||||
std::streampos length = fin.tellg();
|
unsigned long length = static_cast<unsigned long>(fin.tellg());
|
||||||
fin.seekg(0, std::ios::beg);
|
fin.seekg(0, std::ios::beg);
|
||||||
|
|
||||||
// use a vector as buffer and read from stream
|
// use a vector as buffer and read from stream
|
||||||
std::vector<char> buffer(length);
|
std::vector<char> buffer(length + 1ul);
|
||||||
|
buffer[length] = 0;
|
||||||
|
|
||||||
fin.read(&buffer[0], length);
|
fin.read(&buffer[0], length);
|
||||||
|
if (fin.fail())
|
||||||
|
{
|
||||||
|
OSG_WARN << "daeReader::convert: Failed to read istream" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
domElement* loaded_element = _dae->openFromMemory(fileURI, &buffer[0]);
|
domElement* loaded_element = _dae->openFromMemory(fileURI, &buffer[0]);
|
||||||
_document = dynamic_cast<domCOLLADA*>(loaded_element);
|
_document = dynamic_cast<domCOLLADA*>(loaded_element);
|
||||||
|
Loading…
Reference in New Issue
Block a user