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

[native] Change C-style casts to C++-style #24237

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jkhaliqi
Copy link
Contributor

@jkhaliqi jkhaliqi commented Dec 10, 2024

Description

As per the security guideline in
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es49-if-you-must-use-a-cast-use-a-named-cast

Covers the findings in the list from this issue and
closes #2493

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

== NO RELEASE NOTE ==

@jkhaliqi jkhaliqi requested a review from a team as a code owner December 10, 2024 21:32
@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Dec 10, 2024
@prestodb-ci prestodb-ci requested review from a team, infvg and wanglinsong and removed request for a team December 10, 2024 21:32
@jkhaliqi jkhaliqi force-pushed the jk_cve branch 2 times, most recently from a3998f5 to 2507ca2 Compare December 10, 2024 22:07
@jkhaliqi jkhaliqi changed the title refactor: Change C-style casts to C++-style [native] Change C-style casts to C++-style Dec 10, 2024
@jkhaliqi jkhaliqi force-pushed the jk_cve branch 4 times, most recently from b902b86 to fd5d1eb Compare December 11, 2024 00:52
Copy link
Contributor

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jkhaliqi. Had one comment about this change.

@@ -65,10 +65,10 @@ void toThrift(const std::vector<P>& p, std::vector<T>& t) {
}

void toThrift(const protocol::TaskState& proto, thrift::TaskState& thrift) {
thrift = (thrift::TaskState)((int)proto);
thrift = (thrift::TaskState)(static_cast<int>(proto));
Copy link
Contributor

@aditi-pandit aditi-pandit Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a static_cast from int -> thrift::TaskState enum as well ?

Same comment for the line below also.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @aditi-pandit good catch, updated with the change, thank you!

Copy link
Contributor

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jkhaliqi

Copy link
Contributor

@mohsaka mohsaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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

Successfully merging this pull request may close these issues.

4 participants