AcademySoftwareFoundation / AcademySoftwareFoundation/OpenColorIO

Const correctness of PackedImageDesc

Open
#2,114 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.1k
Forks
503
PR merge metrics
No merged PRs in 30d

Description

In our use case, we are passing const void pointers to build a source `PackedImageDesc` for use in `CPUProcessor::apply`. However, `PackedImageDesc` requires a non-const pointer. I assume this is so that users with non-const data can call `getData` and modify the result. This makes it dangerous to const_cast our pointer as a caller could then end up inadvertently modifying a const buffer through those calls.

Perhaps there should be a `ConstPackedImageDesc`? Or is the design to keep the scope of `PackedImageDesc` tightly around the `apply` call so that it's unlikely that users can access the `getData` functions?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.