Skip to content

Const correctness of PackedImageDesc #2114

Description

@jmather-sesi

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions