Fix new[]/delete mismatch warning

This commit is contained in:
Dale Glass 2022-06-05 13:14:09 +02:00
parent 178017db2b
commit 50e1399cb5
2 changed files with 7 additions and 7 deletions

View file

@ -175,7 +175,7 @@ graphics::MeshPointer Mesh::map(std::function<glm::vec3(glm::vec3)> vertexFunc,
gpu::BufferView::Index numColors = (gpu::BufferView::Index)colorsBufferView.getNumElements();
gpu::Resource::Size colorSize = numColors * sizeof(glm::vec3);
std::unique_ptr<unsigned char> resultColorData{ new unsigned char[colorSize] };
std::unique_ptr<unsigned char[]> resultColorData{ new unsigned char[colorSize] };
unsigned char* colorDataCursor = resultColorData.get();
auto colorAttribute = vertexFormat->getAttribute(attributeTypeColor);
@ -200,7 +200,7 @@ graphics::MeshPointer Mesh::map(std::function<glm::vec3(glm::vec3)> vertexFunc,
const gpu::BufferView& normalsBufferView = getAttributeBuffer(attributeTypeNormal);
gpu::BufferView::Index numNormals = (gpu::BufferView::Index)normalsBufferView.getNumElements();
gpu::Resource::Size normalSize = numNormals * sizeof(glm::vec3);
std::unique_ptr<unsigned char> resultNormalData{ new unsigned char[normalSize] };
std::unique_ptr<unsigned char[]> resultNormalData{ new unsigned char[normalSize] };
unsigned char* normalDataCursor = resultNormalData.get();
auto normalAttribute = vertexFormat->getAttribute(attributeTypeNormal);
@ -226,7 +226,7 @@ graphics::MeshPointer Mesh::map(std::function<glm::vec3(glm::vec3)> vertexFunc,
const gpu::BufferView& indexBufferView = getIndexBuffer();
gpu::BufferView::Index numIndexes = (gpu::BufferView::Index)getNumIndices();
gpu::Resource::Size indexSize = numIndexes * sizeof(uint32_t);
std::unique_ptr<unsigned char> resultIndexData{ new unsigned char[indexSize] };
std::unique_ptr<unsigned char[]> resultIndexData{ new unsigned char[indexSize] };
unsigned char* indexDataCursor = resultIndexData.get();
for (gpu::BufferView::Index i = 0; i < numIndexes; i++) {

View file

@ -60,19 +60,19 @@ QScriptValue ModelScriptingInterface::appendMeshes(MeshProxyList in) {
// alloc the resulting mesh
gpu::Resource::Size combinedVertexSize = totalVertexCount * sizeof(glm::vec3);
std::unique_ptr<unsigned char> combinedVertexData{ new unsigned char[combinedVertexSize] };
std::unique_ptr<unsigned char[]> combinedVertexData{ new unsigned char[combinedVertexSize] };
unsigned char* combinedVertexDataCursor = combinedVertexData.get();
gpu::Resource::Size combinedColorSize = totalColorCount * sizeof(glm::vec3);
std::unique_ptr<unsigned char> combinedColorData{ new unsigned char[combinedColorSize] };
std::unique_ptr<unsigned char[]> combinedColorData{ new unsigned char[combinedColorSize] };
unsigned char* combinedColorDataCursor = combinedColorData.get();
gpu::Resource::Size combinedNormalSize = totalNormalCount * sizeof(glm::vec3);
std::unique_ptr<unsigned char> combinedNormalData{ new unsigned char[combinedNormalSize] };
std::unique_ptr<unsigned char[]> combinedNormalData{ new unsigned char[combinedNormalSize] };
unsigned char* combinedNormalDataCursor = combinedNormalData.get();
gpu::Resource::Size combinedIndexSize = totalIndexCount * sizeof(uint32_t);
std::unique_ptr<unsigned char> combinedIndexData{ new unsigned char[combinedIndexSize] };
std::unique_ptr<unsigned char[]> combinedIndexData{ new unsigned char[combinedIndexSize] };
unsigned char* combinedIndexDataCursor = combinedIndexData.get();
uint32_t indexStartOffset { 0 };