Skip to content

Commit

Permalink
cppcheck fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
robertosfield committed Oct 14, 2024
1 parent e0604b9 commit 19ab95f
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 9 deletions.
10 changes: 9 additions & 1 deletion cmake/cppcheck-suppression-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,24 @@ shadowFunction:*/src/vsg/io/tile.cpp
shadowFunction:*/src/vsg/io/FileSystem.cpp
shadowFunction:*/src/vsg/io/Path.cpp
shadowFunction:*/src/vsg/app/Trackball.cpp
shadowFunction:*/src/vsg/app/RecordTraversal.cpp
shadowFunction:*/src/vsg/commands/PipelineBarrier.cpp
shadowFunction:*/src/vsg/state/ArrayState.cpp
shadowFunction:*/src/vsg/state/DescriptorBuffer.cpp
shadowFunction:*/src/vsg/state/Image.cpp
shadowFunction:*/src/vsg/state/ImageView.cpp
shadowFunction:*/src/vsg/state/MultisampleState.cpp
shadowFunction:*/src/vsg/state/DescriptorImage.cpp

// suppress unhelpful warning of c casts
cstyleCast:*/include/vsg/io/mem_stream.h
cstyleCast:*/src/vsg/io/mem_stream.cpp

// suppress unhelpful warnings of override that make inform programmers what is being done
uselessOverride:include/vsg/utils/TracyInstrumentation.h
uselessOverride:*/include/vsg/utils/TracyInstrumentation.h

// suppress inappropriate warning
constParameterReference:*/include/vsg/utils/RecordAndSubmitTask.h

// suppress inappropriate warning
constVariableReference:*/src/vsg/app/RecordTraversal.cpp
2 changes: 1 addition & 1 deletion include/vsg/vk/Instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace vsg
class VSG_DECLSPEC Instance : public Inherit<Object, Instance>
{
public:
Instance(Names instanceExtensions, Names layers, uint32_t vulkanApiVersion = VK_API_VERSION_1_0, AllocationCallbacks* allocator = nullptr);
Instance(const Names& instanceExtensions, const Names& layers, uint32_t vulkanApiVersion = VK_API_VERSION_1_0, AllocationCallbacks* allocator = nullptr);

/// Vulkan apiVersion used when creating the VkInstance
const uint32_t apiVersion = VK_API_VERSION_1_0;
Expand Down
4 changes: 2 additions & 2 deletions src/vsg/app/TransferTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void TransferTask::_transferBufferInfos(DataToCopy& dataToCopy, VkCommandBuffer
// record region
pRegions[regionCount++] = VkBufferCopy{offset, bufferInfo->offset, bufferInfo->range};

log(level, " copying ", bufferInfo, ", ", bufferInfo->data, " to ", (void*)ptr);
log(level, " copying ", bufferInfo, ", ", bufferInfo->data, " to ", static_cast<void*>(ptr));

VkDeviceSize endOfEntry = offset + bufferInfo->range;
offset = (/*alignment == 1 ||*/ (endOfEntry % alignment) == 0) ? endOfEntry : ((endOfEntry / alignment) + 1) * alignment;
Expand Down Expand Up @@ -365,7 +365,7 @@ TransferTask::TransferResult TransferTask::_transferData(DataToCopy& dataToCopy)
for (auto& entry : dataToCopy.dataMap)
{
auto& bufferInfos = entry.second;
for (auto& offset_bufferInfo : bufferInfos)
for (const auto& offset_bufferInfo : bufferInfos)
{
const auto& bufferInfo = offset_bufferInfo.second;
VkDeviceSize endOfEntry = offset + bufferInfo->range;
Expand Down
2 changes: 1 addition & 1 deletion src/vsg/app/Viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ void Viewer::compile(ref_ptr<ResourceHints> hints)
// create the Vulkan objects
for (const auto& task : recordAndSubmitTasks)
{
auto& deviceResource = deviceResourceMap[task->device];
const auto& deviceResource = deviceResourceMap[task->device];
const auto& resourceRequirements = deviceResource.collectResources.requirements;

bool task_containsPagedLOD = false;
Expand Down
2 changes: 1 addition & 1 deletion src/vsg/state/BufferInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ void vsg::assignVulkanArrayData(uint32_t deviceID, const BufferInfoList& arrays,

for (size_t i = 0; i < arrays.size(); ++i)
{
auto& bufferInfo = arrays[i];
const auto& bufferInfo = arrays[i];
if (bufferInfo->buffer)
{
vkd.vkBuffers[i] = bufferInfo->buffer->vk(deviceID);
Expand Down
2 changes: 1 addition & 1 deletion src/vsg/state/DescriptorBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void DescriptorBuffer::compile(Context& context)
}

bool requiresAssignmentOfBuffers = false;
for (auto& bufferInfo : bufferInfoList)
for (const auto& bufferInfo : bufferInfoList)
{
if (bufferInfo->buffer == nullptr) requiresAssignmentOfBuffers = true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/vsg/state/GraphicsPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ int GraphicsPipeline::compare(const Object& rhs_object) const
int result = Object::compare(rhs_object);
if (result != 0) return result;

auto& rhs = static_cast<decltype(*this)>(rhs_object);
const auto& rhs = static_cast<decltype(*this)>(rhs_object);

if ((result = compare_pointer_container(stages, rhs.stages))) return result;
if ((result = compare_pointer_container(pipelineStates, rhs.pipelineStates))) return result;
Expand Down
2 changes: 1 addition & 1 deletion src/vsg/vk/Instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL debugUtilsMessengerCallback(
return VK_FALSE;
}

Instance::Instance(Names instanceExtensions, Names layers, uint32_t vulkanApiVersion, AllocationCallbacks* allocator) :
Instance::Instance(const Names& instanceExtensions, const Names& layers, uint32_t vulkanApiVersion, AllocationCallbacks* allocator) :
apiVersion(vulkanApiVersion)
{
// application info
Expand Down

0 comments on commit 19ab95f

Please sign in to comment.