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

chore: resolve ValidChar function lint/compile warnings #234

Merged
merged 2 commits into from
Sep 5, 2023

Conversation

cwaldren-ld
Copy link
Contributor

The argument to ValidChar is a char, so its max value is 255 rendering the check redundant. This causes a warning on our Mac compilations as well as a linter warning.

(unless we have a platform that has a char wider than 8 bits..)

@cwaldren-ld cwaldren-ld changed the title chore: resolve mac compile warning due to redundant check on ValidChar function chore: resolve ValidChar function lint/compile warnings Sep 5, 2023
@@ -21,9 +21,9 @@ tl::expected<std::string, Error> AppInfoBuilder::Tag::Build() const {
}

bool ValidChar(char c) {
if(c > 0 && c < 255) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could put a static_assert(std::numeric_limits<char>::max() <= 0xFF). Is that too paranoid?

@cwaldren-ld cwaldren-ld marked this pull request as ready for review September 5, 2023 20:30
@cwaldren-ld cwaldren-ld requested review from a team and kinyoklion September 5, 2023 20:30
// The MSVC implementation of isalnum will assert if the number it outside
// its lookup table.
if (c > 0) {
// The MSVC implementation of isalnum will assert if the number it
Copy link
Member

Choose a reason for hiding this comment

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

I must have typoed this 'it'. Should be 'is'.

Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
@cwaldren-ld cwaldren-ld merged commit 1db6db9 into server-side Sep 5, 2023
@cwaldren-ld cwaldren-ld deleted the cw/fix-mac-warning-valid-char branch September 5, 2023 22:23
cwaldren-ld added a commit that referenced this pull request Sep 11, 2023
The argument to `ValidChar` is a `char`, so its max value is `255`
rendering the check redundant. This causes a warning on our Mac
compilations as well as a linter warning.

---------

Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
cwaldren-ld added a commit that referenced this pull request Sep 11, 2023
The argument to `ValidChar` is a `char`, so its max value is `255`
rendering the check redundant. This causes a warning on our Mac
compilations as well as a linter warning.

Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants