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

Use C++11 enum class for Utf8CheckMode #8490

Merged
merged 2 commits into from Apr 15, 2021

Conversation

georgthegreat
Copy link
Contributor

@georgthegreat georgthegreat commented Apr 14, 2021

At the time this enum includes members named STRICT and NONE, both of which are known to have problems under Windows (at least port_undef.inc has workaround for this macro).

As protobuf now builds in C++11 mode, enum class is a better solution to avoid name conflicts.

This is part 1 / x in #8494 fix.

VERIFY = 1, // Only log an error but parsing will succeed.
NONE = 2, // No UTF-8 check.
enum class Utf8CheckMode {
Strict = 0, // Parsing will fail if non UTF-8 data is in string fields.
Copy link
Member

Choose a reason for hiding this comment

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

Looks great to me but one small thing: our style for enum names is to name them kStrict, kVerify, kNone. (Sometimes we don't use that convention in our existing code because our previous convention was to use ALL_CAPS names.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

@acozzette acozzette merged commit 568fd62 into protocolbuffers:master Apr 15, 2021
@georgthegreat georgthegreat deleted the utf8-enum-class branch April 15, 2021 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants