Addressed some mismatched news/deletes caused by the new glTF2 sources.
parent
1eb7eceddf
commit
5804667dbb
|
@ -511,7 +511,7 @@ namespace glTF2
|
||||||
|
|
||||||
/// \fn ~SEncodedRegion()
|
/// \fn ~SEncodedRegion()
|
||||||
/// Destructor.
|
/// Destructor.
|
||||||
~SEncodedRegion() { delete [] DecodedData; }
|
~SEncodedRegion() { delete[] DecodedData; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************* Variables *******************/
|
/******************* Variables *******************/
|
||||||
|
|
|
@ -313,7 +313,7 @@ inline void Buffer::Read(Value& obj, Asset& r)
|
||||||
if (dataURI.base64) {
|
if (dataURI.base64) {
|
||||||
uint8_t* data = 0;
|
uint8_t* data = 0;
|
||||||
this->byteLength = Util::DecodeBase64(dataURI.data, dataURI.dataLength, data);
|
this->byteLength = Util::DecodeBase64(dataURI.data, dataURI.dataLength, data);
|
||||||
this->mData.reset(data);
|
this->mData.reset(data, std::default_delete<uint8_t[]>());
|
||||||
|
|
||||||
if (statedLength > 0 && this->byteLength != statedLength) {
|
if (statedLength > 0 && this->byteLength != statedLength) {
|
||||||
throw DeadlyImportError("GLTF: buffer \"" + id + "\", expected " + to_string(statedLength) +
|
throw DeadlyImportError("GLTF: buffer \"" + id + "\", expected " + to_string(statedLength) +
|
||||||
|
@ -326,7 +326,7 @@ inline void Buffer::Read(Value& obj, Asset& r)
|
||||||
" bytes, but found " + to_string(dataURI.dataLength));
|
" bytes, but found " + to_string(dataURI.dataLength));
|
||||||
}
|
}
|
||||||
|
|
||||||
this->mData.reset(new uint8_t[dataURI.dataLength]);
|
this->mData.reset(new uint8_t[dataURI.dataLength], std::default_delete<uint8_t[]>());
|
||||||
memcpy( this->mData.get(), dataURI.data, dataURI.dataLength );
|
memcpy( this->mData.get(), dataURI.data, dataURI.dataLength );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -432,7 +432,7 @@ uint8_t* new_data;
|
||||||
// Copy data which place after replacing part.
|
// Copy data which place after replacing part.
|
||||||
memcpy(&new_data[pBufferData_Offset + pReplace_Count], &mData.get()[pBufferData_Offset + pBufferData_Count], pBufferData_Offset);
|
memcpy(&new_data[pBufferData_Offset + pReplace_Count], &mData.get()[pBufferData_Offset + pBufferData_Count], pBufferData_Offset);
|
||||||
// Apply new data
|
// Apply new data
|
||||||
mData.reset(new_data);
|
mData.reset(new_data, std::default_delete<uint8_t[]>());
|
||||||
byteLength = new_data_size;
|
byteLength = new_data_size;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue