Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getRawPacketReadOnly() const-correctness #1573

Open
luizfeldmann opened this issue Sep 11, 2024 · 2 comments
Open

getRawPacketReadOnly() const-correctness #1573

luizfeldmann opened this issue Sep 11, 2024 · 2 comments
Labels

Comments

@luizfeldmann
Copy link

Hi,

It seems that both the read-only and non-read-only getters of the raw packet from the parsed packet have the exact same signature and behaviour:

RawPacket* getRawPacket() const;
RawPacket* getRawPacketReadOnly() const;

Wouldn't it be more correct to declare the read-only getter as returning a pointer-to-const, and similarly, the non-read-only method not be marked as const method as it can alter the underlying object ?

RawPacket* getRawPacket();
const RawPacket* getRawPacketReadOnly() const;

Best regards,

@tigercosmos
Copy link
Collaborator

Yes, it's a bug.

@egecetin
Copy link
Collaborator

@luizfeldmann Feel free to open a PR to fix it if you have time. Contributions are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants