@@ -161,7 +161,7 @@ class GoGenerator : public BaseGenerator {
161
161
162
162
// A single enum member.
163
163
void EnumMember (const EnumDef &enum_def, const EnumVal &ev,
164
- const int max_name_length, std::string *code_ptr) {
164
+ size_t max_name_length, std::string *code_ptr) {
165
165
std::string &code = *code_ptr;
166
166
code += " \t " ;
167
167
code += enum_def.name ;
@@ -189,7 +189,7 @@ class GoGenerator : public BaseGenerator {
189
189
190
190
// A single enum name member.
191
191
void EnumNameMember (const EnumDef &enum_def, const EnumVal ev,
192
- const int max_name_length, std::string *code_ptr) {
192
+ size_t max_name_length, std::string *code_ptr) {
193
193
std::string &code = *code_ptr;
194
194
code += " \t " ;
195
195
code += enum_def.name ;
@@ -229,7 +229,7 @@ class GoGenerator : public BaseGenerator {
229
229
230
230
// A single enum value member.
231
231
void EnumValueMember (const EnumDef &enum_def, const EnumVal ev,
232
- const int max_name_length, std::string *code_ptr) {
232
+ size_t max_name_length, std::string *code_ptr) {
233
233
std::string &code = *code_ptr;
234
234
code += " \t\" " ;
235
235
code += ev.name ;
@@ -775,7 +775,7 @@ class GoGenerator : public BaseGenerator {
775
775
void GenEnum (const EnumDef &enum_def, std::string *code_ptr) {
776
776
if (enum_def.generated ) return ;
777
777
778
- const int max_name_length = MaxNameLength (enum_def);
778
+ auto max_name_length = MaxNameLength (enum_def);
779
779
cur_name_space_ = enum_def.defined_namespace ;
780
780
781
781
GenComment (enum_def.doc_comment , code_ptr, nullptr );
@@ -989,12 +989,11 @@ class GoGenerator : public BaseGenerator {
989
989
990
990
const Namespace *CurrentNameSpace () const { return cur_name_space_; }
991
991
992
- static int MaxNameLength (const EnumDef &enum_def) {
993
- int max = 0 ;
992
+ static size_t MaxNameLength (const EnumDef &enum_def) {
993
+ size_t max = 0 ;
994
994
for (auto it = enum_def.Vals ().begin (); it != enum_def.Vals ().end ();
995
995
++it) {
996
- const int length = (*it)->name .length ();
997
- max = length > max ? length : max;
996
+ max = std::max ((*it)->name .length (), max);
998
997
}
999
998
return max;
1000
999
}
0 commit comments