diff options
| author | heretic <[email protected]> | 2022-06-14 13:29:31 +0300 |
|---|---|---|
| committer | heretic <[email protected]> | 2022-06-14 13:29:31 +0300 |
| commit | 16f8be4f481c275c34795233c18f8d078382fcb3 (patch) | |
| tree | 2363f1306ce2e17e72c0a48614256acd046990e6 /contrib/libs/protoc/src/google/protobuf/compiler/parser.cc | |
| parent | 647dc68b78e469e5ab416e9b62885c9846fd511d (diff) | |
Update protobuf to 3.18.1
ref:4846abb21711ea0dc148d4c5df7b5edd3d1bdc69
Diffstat (limited to 'contrib/libs/protoc/src/google/protobuf/compiler/parser.cc')
| -rw-r--r-- | contrib/libs/protoc/src/google/protobuf/compiler/parser.cc | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/parser.cc b/contrib/libs/protoc/src/google/protobuf/compiler/parser.cc index 41d70aa255f..fa3dffbdb6c 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/parser.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/parser.cc @@ -97,19 +97,19 @@ TProtoStringType MapEntryName(const TProtoStringType& field_name) { static const char kSuffix[] = "Entry"; result.reserve(field_name.size() + sizeof(kSuffix)); bool cap_next = true; - for (int i = 0; i < field_name.size(); ++i) { - if (field_name[i] == '_') { + for (const char field_name_char : field_name) { + if (field_name_char == '_') { cap_next = true; } else if (cap_next) { // Note: Do not use ctype.h due to locales. - if ('a' <= field_name[i] && field_name[i] <= 'z') { - result.push_back(field_name[i] - 'a' + 'A'); + if ('a' <= field_name_char && field_name_char <= 'z') { + result.push_back(field_name_char - 'a' + 'A'); } else { - result.push_back(field_name[i]); + result.push_back(field_name_char); } cap_next = false; } else { - result.push_back(field_name[i]); + result.push_back(field_name_char); } } result.append(kSuffix); @@ -131,8 +131,8 @@ bool IsUpperCamelCase(const TProtoStringType& name) { return false; } // Must not contains underscore. - for (int i = 1; i < name.length(); i++) { - if (name[i] == '_') { + for (const char c : name) { + if (c == '_') { return false; } } @@ -140,8 +140,7 @@ bool IsUpperCamelCase(const TProtoStringType& name) { } bool IsUpperUnderscore(const TProtoStringType& name) { - for (int i = 0; i < name.length(); i++) { - const char c = name[i]; + for (const char c : name) { if (!IsUppercase(c) && c != '_' && !IsNumber(c)) { return false; } @@ -150,8 +149,7 @@ bool IsUpperUnderscore(const TProtoStringType& name) { } bool IsLowerUnderscore(const TProtoStringType& name) { - for (int i = 0; i < name.length(); i++) { - const char c = name[i]; + for (const char c : name) { if (!IsLowercase(c) && c != '_' && !IsNumber(c)) { return false; } |
